# HG changeset patch # User Daniele Nicolodi # Date 1323194842 -3600 # Node ID a59cdb8aaf31da8f3f9c4eced843df2b03f152c4 # Parent f90d4f666cc76594658c7a4186adddee9bb02cce# Parent 409a22968d5ead13cfb69fbafb73af493bd6745c Merge diff -r f90d4f666cc7 -r a59cdb8aaf31 m-toolbox/classes/+utils/@math/math.m --- a/m-toolbox/classes/+utils/@math/math.m Mon Dec 05 18:04:34 2011 +0100 +++ b/m-toolbox/classes/+utils/@math/math.m Tue Dec 06 19:07:22 2011 +0100 @@ -11,7 +11,7 @@ % HISTORY: M Hewitson 26-05-08 % Creation % -% VERSION: $Id: math.m,v 1.77 2011/10/07 08:19:06 miquel Exp $ +% VERSION: $Id: math.m,v 1.79 2011/12/01 09:41:22 hewitson Exp $ % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -27,7 +27,7 @@ %------------------------------------------------------------- % List other methods %------------------------------------------------------------- - + varargout = welchscale(varargin); varargout = intfact(varargin); % Compute two integers P and Q varargout = cpf(varargin) varargout = lp2z(varargin) @@ -80,7 +80,7 @@ best = diffStepFish(i1,i2,S11,S12,S21,S22,N,meval,params,ngrid,ranges,freqs,inNames,outNames) best = diffStepFish_1x1(i1,S11,N,meval,params,values,ngrid,ranges,freqs,inNames,outNames) loglk = loglikelihood(varargin) - loglk = loglikelihood_ssm(varargin) + [loglk snr] = loglikelihood_ssm(varargin) [loglk snr] = loglikelihood_matrix(varargin) snrexp = stnr(tmplt1,tmplt2,out1,out2,InvS11,InvS22,InvS12,InvS21) loglk = loglikelihood_ssm_td(xp,in,out,parnames,model,inNames,outNames,Noise,varargin) @@ -101,7 +101,7 @@ Covar = corr2cov(CorrC,SigC) R = Rcovmat(x) smpl = mhsample_td(model,in,out,cov,number,limit,parnames,Tc,xi,xo,search,jumps,parplot,dbg_info,inNames,outNames,inNoise,inNoiseNames,cutbefore,cutafter) - Bxy = rjsample(model,in,out,nse,cov,number,limit,param,Tc,xi,xo,search,jumps,parplot,dbg_info,inNames,outNames,inModel,outModel) + [Bxy LogLambda] = rjsample(mmdl,fin,fout,mnse,cvar,N,rang,param,Tc,xi,xo,search,jumps,parplot,debug,inNames,outNames,anneal,SNR0,DeltaL,inModel,outModel); [Fout,x] = ecdf(y) cVal = SKcriticalvalues(n1,n2,alph) x = Finv(p,n1,n2) diff -r f90d4f666cc7 -r a59cdb8aaf31 m-toolbox/classes/+utils/@math/rjsample.m --- a/m-toolbox/classes/+utils/@math/rjsample.m Mon Dec 05 18:04:34 2011 +0100 +++ b/m-toolbox/classes/+utils/@math/rjsample.m Tue Dec 06 19:07:22 2011 +0100 @@ -287,6 +287,7 @@ figure (2) for jj = 3:(nummodels+2) %if (mnacc(nacc,jj-2) ~= 0) + smpl(smpl==0) = nan; plot(smpl(:,jj-2),'color',coloor(jj-2,:)) legen = [legen ; sprintf('model%d',jj-2)]; % legend legend(legen) diff -r f90d4f666cc7 -r a59cdb8aaf31 m-toolbox/classes/+utils/@math/welchscale.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/+utils/@math/welchscale.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,54 @@ +% WELCHSCALE scales the output of welch to be in the required units +% +% $Id: welchscale.m,v 1.1 2011/12/01 09:41:22 hewitson Exp $ +% + +function [yy, dyy, info] = welchscale(xx, dxx, win, fs, norm, inunits) + + nfft = length(win); + S1 = sum(win); + S2 = sum(win.^2); + enbw = fs * S2 / (S1*S1); + + if isempty(norm) + norm = 'None'; + end + switch lower(norm) + case 'asd' + yy = sqrt(xx); + if isempty(dxx) + dyy = dxx; + else + dyy = 1./2./sqrt(xx) .* dxx; + end + info.units = inunits ./ unit('Hz^0.5'); + case 'psd' + yy = xx; + dyy = dxx; + info.units = inunits.^2/unit('Hz'); + case 'as' + yy = sqrt(xx * enbw); + if isempty(dxx) + dyy = dxx; + else + dyy = 1./2./sqrt(xx) .* dxx * enbw; + end + info.units = inunits; + case 'ps' + yy = xx * enbw; + dyy = dxx * enbw; + info.units = inunits.^2; + case 'none' + yy = xx; + dyy = dxx; + info.units = inunits; + otherwise + error('Unknown normalisation'); + end + + info.nfft = nfft; + info.enbw = enbw; + info.norm = norm; + +end + diff -r f90d4f666cc7 -r a59cdb8aaf31 m-toolbox/classes/+utils/@models/built_in_model_template.m --- a/m-toolbox/classes/+utils/@models/built_in_model_template.m Mon Dec 05 18:04:34 2011 +0100 +++ b/m-toolbox/classes/+utils/@models/built_in_model_template.m Tue Dec 06 19:07:22 2011 +0100 @@ -20,7 +20,7 @@ % REFERENCES: % % -% VERSION: $Id: built_in_model_template.m,v 1.1 2011/04/29 07:05:54 hewitson Exp $ +% VERSION: $Id: built_in_model_template.m,v 1.2 2011/12/02 09:15:11 hewitson Exp $ % % HISTORY: % @@ -99,11 +99,14 @@ return; end - % build model - pl = varargin{1}; - + %--- Input plist + % Changes to this plist will be captured in the history + historyPlist = varargin{1}; + % This can be locally modified without the changes being reflected in the history + localPlist = copy(historyPlist, 1); + % Get parameters - p = pl.find('My Parameter'); + p = localPlist.find('My Parameter'); % Build the model object the way you want @@ -124,6 +127,6 @@ %-------------------------------------------------------------------------- function v = getVersion - v = '$Id: built_in_model_template.m,v 1.1 2011/04/29 07:05:54 hewitson Exp $'; + v = '$Id: built_in_model_template.m,v 1.2 2011/12/02 09:15:11 hewitson Exp $'; end diff -r f90d4f666cc7 -r a59cdb8aaf31 m-toolbox/classes/+utils/@models/mainFnc.m --- a/m-toolbox/classes/+utils/@models/mainFnc.m Mon Dec 05 18:04:34 2011 +0100 +++ b/m-toolbox/classes/+utils/@models/mainFnc.m Tue Dec 06 19:07:22 2011 +0100 @@ -20,7 +20,7 @@ % getVersion - a function handle to the getVersion function % versionTable - a function handle to the versionTable function % -% VERSION: $Id: mainFnc.m,v 1.3 2011/04/29 14:25:14 hewitson Exp $ +% VERSION: $Id: mainFnc.m,v 1.4 2011/12/02 09:03:20 hewitson Exp $ % % function varargout = mainFnc(inputs, modelFilename, getModelDescription, getModelDocumentation, getVersion, versionTable) @@ -39,13 +39,12 @@ end % Build the object - hpl = copy(pl, 1); out = fcn(pl); % Set the method version string in the minfo object if ~isempty(constructorInfo) && utils.helper.isSubclassOf(class(out), 'ltpda_uoh') % If this is a user-call via a constructor, then we add history - out = addHistoryStep(out, constructorInfo, hpl); + out = addHistoryStep(out, constructorInfo, pl); end if nargout > 0 diff -r f90d4f666cc7 -r a59cdb8aaf31 m-toolbox/classes/@ao/ao.m --- a/m-toolbox/classes/@ao/ao.m Mon Dec 05 18:04:34 2011 +0100 +++ b/m-toolbox/classes/@ao/ao.m Tue Dec 06 19:07:22 2011 +0100 @@ -29,7 +29,7 @@ % % Parameters Description % -% VERSION: $Id: ao.m,v 1.361 2011/08/22 05:23:45 hewitson Exp $ +% VERSION: $Id: ao.m,v 1.362 2011/12/01 08:30:52 hewitson Exp $ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -110,7 +110,7 @@ % given in the parameter list % % -% VERSION: $Id: ao.m,v 1.361 2011/08/22 05:23:45 hewitson Exp $ +% VERSION: $Id: ao.m,v 1.362 2011/12/01 08:30:52 hewitson Exp $ % % Parameter sets for plist constructor (in order of priority): % @@ -775,7 +775,7 @@ end function out = VEROUT() - out = '$Id: ao.m,v 1.361 2011/08/22 05:23:45 hewitson Exp $'; + out = '$Id: ao.m,v 1.362 2011/12/01 08:30:52 hewitson Exp $'; end function ii = getInfo(varargin) @@ -1358,6 +1358,7 @@ methods (Static = true, Access = private) % constructor functions % Spectral estimate function + varargout = wosa(varargin); [yy, dyy, info] = welchscale(xx, dxx, win, fs, norm, inunits) [x,M,isreal_x,y,Ly,win,winName,winParam,noverlap,k,L,options] = welchparse(x,esttype,varargin) [P,f] = computeperiodogram(x,win,nfft,esttype,varargin) diff -r f90d4f666cc7 -r a59cdb8aaf31 m-toolbox/classes/@ao/cohere.m --- a/m-toolbox/classes/@ao/cohere.m Mon Dec 05 18:04:34 2011 +0100 +++ b/m-toolbox/classes/@ao/cohere.m Tue Dec 06 19:07:22 2011 +0100 @@ -20,7 +20,7 @@ % % Parameters Description % -% VERSION: $Id: cohere.m,v 1.43 2011/04/08 08:56:16 hewitson Exp $ +% VERSION: $Id: cohere.m,v 1.44 2011/12/01 09:35:42 hewitson Exp $ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -82,7 +82,7 @@ pl = getDefaultPlist(); end % Build info object - ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.sigproc, '$Id: cohere.m,v 1.43 2011/04/08 08:56:16 hewitson Exp $', sets, pl); + ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.sigproc, '$Id: cohere.m,v 1.44 2011/12/01 09:35:42 hewitson Exp $', sets, pl); ii.setModifier(false); ii.setArgsmin(2); end @@ -110,5 +110,8 @@ '
  • C - Complex Coherence:
    Sxy / sqrt(Sxx * Syy)
  • ']}, {1, {'C', 'MS'}, paramValue.SINGLE}); pl.append(p); + p = param('newMethod', paramValue.TRUE_FALSE); + pl.append(p); + end diff -r f90d4f666cc7 -r a59cdb8aaf31 m-toolbox/classes/@ao/cpsd.m --- a/m-toolbox/classes/@ao/cpsd.m Mon Dec 05 18:04:34 2011 +0100 +++ b/m-toolbox/classes/@ao/cpsd.m Tue Dec 06 19:07:22 2011 +0100 @@ -14,7 +14,7 @@ % % Parameters Description % -% VERSION: $Id: cpsd.m,v 1.38 2011/04/08 08:56:13 hewitson Exp $ +% VERSION: $Id: cpsd.m,v 1.39 2011/12/01 08:51:34 hewitson Exp $ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -68,7 +68,7 @@ pl = getDefaultPlist(); end % Build info object - ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.sigproc, '$Id: cpsd.m,v 1.38 2011/04/08 08:56:13 hewitson Exp $', sets, pl); + ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.sigproc, '$Id: cpsd.m,v 1.39 2011/12/01 08:51:34 hewitson Exp $', sets, pl); ii.setModifier(false); ii.setArgsmin(2); end @@ -90,5 +90,7 @@ % General plist for Welch-based, linearly spaced spectral estimators pl = plist.WELCH_PLIST; + p = param('newMethod', paramValue.TRUE_FALSE); + pl.append(p); end diff -r f90d4f666cc7 -r a59cdb8aaf31 m-toolbox/classes/@ao/tfe.m --- a/m-toolbox/classes/@ao/tfe.m Mon Dec 05 18:04:34 2011 +0100 +++ b/m-toolbox/classes/@ao/tfe.m Tue Dec 06 19:07:22 2011 +0100 @@ -17,7 +17,7 @@ % % Parameters Description % -% VERSION: $Id: tfe.m,v 1.36 2011/04/08 08:56:13 hewitson Exp $ +% VERSION: $Id: tfe.m,v 1.37 2011/12/01 09:01:48 hewitson Exp $ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -71,7 +71,7 @@ pl = getDefaultPlist(); end % Build info object - ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.sigproc, '$Id: tfe.m,v 1.36 2011/04/08 08:56:13 hewitson Exp $', sets, pl); + ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.sigproc, '$Id: tfe.m,v 1.37 2011/12/01 09:01:48 hewitson Exp $', sets, pl); ii.setModifier(false); ii.setArgsmin(2); end @@ -92,5 +92,7 @@ % General plist for Welch-based, linearly spaced spectral estimators pl = plist.WELCH_PLIST; + p = param('newMethod', paramValue.TRUE_FALSE); + pl.append(p); end diff -r f90d4f666cc7 -r a59cdb8aaf31 m-toolbox/classes/@ao/wosa.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/@ao/wosa.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,317 @@ +% WOSA implements Welch's overlaped segmented averaging algorithm with +% segment detrending and variance estimation. +% +% [pxx, f, info] = wosa(x,type,pl) +% [pxx, f, info] = wosa(x,y,type,pl) +% +% INPUTS: x - input analysis objects +% y - input analysis objects +% type - type of estimation: +% 'psd' - compute Power Spectral Denstiy (PSD) +% 'cpsd' - compute cross-spectral density +% 'tfe' - estimate transfer function between inputs +% 'mscohere' - estimate magnitude-squared cross-coherence +% 'cohere' - estimate complex cross-coherence +% pl - input parameter list +% +% PARAMETERS: 'Win' - a specwin window object [default: Kaiser -200dB psll] +% 'Olap' - segment percent overlap [default: taken from window function] +% 'Nfft' - number of samples in each fft [default: length of input data] +% 'Scale' - one of +% 'ASD' - amplitude spectral density +% 'PSD' - power spectral density [default] +% 'AS' - amplitude spectrum +% 'PS' - power spectrum +% * applies only to spectrum 'Type' 'psd' +% 'Order' - order of segment detrending +% -1 - no detrending +% 0 - subtract mean [default] +% 1 - subtract linear fit +% N - subtract fit of polynomial, order N +% +% Version: $Id: wosa.m,v 1.5 2011/12/02 07:08:11 hewitson Exp $ +% + +function varargout = wosa(varargin) + import utils.const.* + + % Process inputs + if nargin == 3 + a = varargin{1}; + esttype = varargin{2}; + pl = varargin{3}; + inunits = a.data.yunits; + L = a.len; + else + a = varargin{1}; + b = varargin{2}; + esttype = varargin{3}; + pl = varargin{4}; + if a.data.fs ~= b.data.fs + error('The two time-series have different sample rates.'); + end + inunits = b.data.yunits / a.data.yunits; + L = min(a.len, b.len); + end + + % Parse inputs + win = find(pl, 'Win'); + nfft = find(pl, 'Nfft'); + percentOlap = find(pl, 'Olap')/100; + scale = find(pl, 'scale'); + xOlap = round(percentOlap*nfft); + detrendOrder = find(pl, 'order'); + fs = a.fs; + winVals = win.win.'; % because we always get a column from ao.y + + % Compute segment details + + nSegments = fix((L - xOlap)./(nfft - xOlap)); + utils.helper.msg(msg.PROC3, 'N segment: %d', nfft); + utils.helper.msg(msg.PROC3, 'N overlap: %d', xOlap); + utils.helper.msg(msg.PROC3, 'N segments: %d', nSegments); + + % Compute start and end indices of each segment + segmentStep = nfft-xOlap; + segmentStarts = 1:segmentStep:nSegments*segmentStep; + segmentEnds = segmentStarts+nfft-1; + + % Estimate the averaged periodogram for the desired quantity + switch lower(esttype) + case 'psd' + % Compute averaged periodogram + [Sxx, Svxx] = psdPeriodogram(a, winVals, nSegments, segmentStarts, segmentEnds, detrendOrder); + case 'cpsd' + [Sxx, Svxx] = cpsdPeriodogram(a, b, winVals, nSegments, segmentStarts, segmentEnds, detrendOrder); + case 'tfe' + [Sxx, Sxy, Syy] = tfePeriodogram(a, b, winVals, nSegments, segmentStarts, segmentEnds, detrendOrder); + case {'mscohere','cohere'} + [Sxx, Sxy, Syy] = tfePeriodogram(a, b, winVals, nSegments, segmentStarts, segmentEnds, detrendOrder); + otherwise + error('Unknown estimation type %s', esttype); + end + + % Scale to PSD + switch lower(esttype) + case {'psd','cpsd'} + [P, Pvxx] = scaleToPSD(Sxx, Svxx, nfft, fs); + % the 1/nSegments factor should come after welchscale if we don't + % want to apply sqrt() to it. + % We correct for that here. It is only needed for 'asd','as' in + % psd/cpsd, the other cases go always through 'PSD'. + if (strcmpi(scale,'PSD') || strcmpi(scale,'PS')) + dP = Pvxx; + elseif (strcmpi(scale,'ASD') || strcmpi(scale,'AS')) + dP = Pvxx/nSegments; + else + error('### Unknown scale') + end + case 'tfe' + % Compute the 1-sided or 2-sided PSD [Power/freq] or mean-square [Power]. + % Also, corresponding freq vector and freq units. + % In the Cross PSD, the frequency vector and xunits are not used. + Pxx = scaleToPSD(Sxx, [], nfft, fs); + Pxy = scaleToPSD(Sxy, [], nfft, fs); + Pyy = scaleToPSD(Syy, [], nfft, fs); + % mean and std + P = Pxy ./ Pxx; % Txy + if nSegments == 1 + dP =[]; + else + dP = (nSegments/(nSegments-1)^2)*(Pyy./Pxx).*(1 - (abs(Pxy).^2)./(Pxx.*Pyy)); + end + case 'mscohere' + % Magnitude Square Coherence estimate. + % Auto PSD for 2nd input vector. The freq vector & xunits are not + % used. + Pxx = scaleToPSD(Sxx, [], nfft, fs); + Pxy = scaleToPSD(Sxy, [], nfft, fs); + Pyy = scaleToPSD(Syy, [], nfft, fs); + % mean and std + P = (abs(Pxy).^2)./(Pxx.*Pyy); % Magnitude-squared coherence + dP = (2*P/nSegments).*(1-P).^2; + case 'cohere' + % Complex Coherence estimate. + % Auto PSD for 2nd input vector. The freq vector & xunits are not + % used. + Pxx = scaleToPSD(Sxx, [], nfft, fs); + Pxy = scaleToPSD(Sxy, [], nfft, fs); + Pyy = scaleToPSD(Syy, [], nfft, fs); + P = Pxy./sqrt(Pxx.*Pyy); % Complex coherence + dP = (2*abs(P)/nSegments).*(1-abs(P)).^2; + + end + + % Compute frequencies + freqs = psdfreqvec('npts', nfft,'Fs', fs, 'Range', 'half').'; + + % Scale to required units + [Pxx, dP, info] = utils.math.welchscale(P, dP, winVals, fs, scale, inunits); + info.navs = nSegments; + + if nSegments ==1 + dev = []; + else + dev = sqrt(dP); + end + + % Set outputs + varargout = {Pxx, freqs, info, dev}; + +end + +% scale averaged periodogram to PSD +function [Pxx, Pvxx] = scaleToPSD(Sxx, Svxx, nfft, fs) + + % Take 1-sided spectrum which means we double the power in the + % appropriate bins + if rem(nfft,2), + indices = 1:(nfft+1)/2; % ODD + Sxx1sided = Sxx(indices,:); + % double the power except for the DC bin + Sxx = [Sxx1sided(1,:); 2*Sxx1sided(2:end,:)]; + if ~isempty(Svxx) + Svxx1sided = Svxx(indices,:); + Svxx = [Svxx1sided(1,:); 4*Svxx1sided(2:end,:)]; + end + else + indices = 1:nfft/2+1; % EVEN + Sxx1sided = Sxx(indices,:); + % Double power except the DC bin and the Nyquist bin + Sxx = [Sxx1sided(1,:); 2*Sxx1sided(2:end-1,:); Sxx1sided(end,:)]; + if ~isempty(Svxx) + Svxx1sided = Svxx(indices,:); % Take only [0,pi] or [0,pi) + Svxx = [Svxx1sided(1,:); 4*Svxx1sided(2:end-1,:); Svxx1sided(end,:)]; + end + end + + % Now scale to PSD + Pxx = Sxx./fs; + Pvxx = Svxx./fs^2; + +end + +% compute tfe +function [Sxx, Sxy, Syy] = tfePeriodogram(x, y, winVals, nSegments, segmentStarts, segmentEnds, detrendOrder) + + nfft = segmentEnds(1); + Sxx = zeros(nfft,1); % Initialize Sxx + Sxy = zeros(nfft,1); % Initialize Sxy + Syy = zeros(nfft,1); % Initialize Syy + % loop over segments + for ii = 1:nSegments + if detrendOrder < 0 + xseg = x.y(segmentStarts(ii):segmentEnds(ii)); + yseg = y.y(segmentStarts(ii):segmentEnds(ii)); + else + [xseg,coeffs] = ltpda_polyreg(x.y(segmentStarts(ii):segmentEnds(ii)), detrendOrder); + [yseg,coeffs] = ltpda_polyreg(y.y(segmentStarts(ii):segmentEnds(ii)), detrendOrder); + end + + % Compute periodograms + Sxxk = wosa_periodogram(xseg, [], winVals, nfft); + Sxyk = wosa_periodogram(yseg, xseg, winVals, nfft); + Syyk = wosa_periodogram(yseg, [], winVals, nfft); + + Sxx = Sxx + Sxxk; + Sxy = Sxy + Sxyk; + Syy = Syy + Syyk; + % don't need to be divided by k because only rations are used here + end + +end + +% compute cpsd +function [Sxx, Svxx] = cpsdPeriodogram(x, y, winVals, nSegments, segmentStarts, segmentEnds, detrendOrder) + + Mnxx = 0; + Mn2xx = 0; + nfft = segmentEnds(1); + for ii = 1:nSegments + if detrendOrder < 0 + xseg = x.y(segmentStarts(ii):segmentEnds(ii)); + yseg = y.y(segmentStarts(ii):segmentEnds(ii)); + else + [xseg,coeffs] = ltpda_polyreg(x.y(segmentStarts(ii):segmentEnds(ii)), detrendOrder); + [yseg,coeffs] = ltpda_polyreg(y.y(segmentStarts(ii):segmentEnds(ii)), detrendOrder); + end + + % Compute periodogram + Sxxk = wosa_periodogram(xseg, yseg, winVals, nfft); + + % Welford's algorithm to update mean and variance + Qxx = Sxxk - Mnxx; + Mnxx = Mnxx +Qxx/ii; + Mn2xx = Mn2xx + abs(Qxx.*conj(Sxxk - Mnxx)); + end + Sxx = Mnxx; + if nSegments ==1 + Svxx = []; + else + Svxx = Mn2xx/(nSegments-1)/nSegments; + end + + +end + +% compute psd +function [Sxx, Svxx] = psdPeriodogram(x, winVals, nSegments, segmentStarts, segmentEnds, detrendOrder) + + Mnxx = 0; + Mn2xx = 0; + nfft = segmentEnds(1); + % Loop over the segments + for ii = 1:nSegments + % Detrend if desired + if detrendOrder < 0 + seg = x.y(segmentStarts(ii):segmentEnds(ii)); + else + [seg,coeffs] = ltpda_polyreg(x.y(segmentStarts(ii):segmentEnds(ii)), detrendOrder); + end + % Compute periodogram + Sxxk = wosa_periodogram(seg, [], winVals,nfft); + % Welford's algorithm for updating mean and variance + if ii == 1 + Mnxx = Sxxk; + else + Qxx = Sxxk - Mnxx; + Mnxx = Mnxx + Qxx/ii; + Mn2xx = Mn2xx + Qxx.*(Sxxk - Mnxx); + end + end + Sxx = Mnxx; + if nSegments == 1 + Svxx = []; + else + Svxx = Mn2xx/(nSegments-1)/nSegments; + end + +end + +% Scaled periodogram of one or two input signals +function Sxx = wosa_periodogram(x, y, win, nfft) + + % window data + xwin = x.*win; + isCross = false; + if ~isempty(y) + ywin = y.*win; + isCross = true; + end + + % take fft + X = fft(xwin, nfft); + if isCross + Y = fft(ywin, nfft); + end + + % Compute scale factor to compensate for the window power + K = win'*win; + + % Compute scaled power + Sxx = X.*conj(X)/K; + if isCross, + Sxx = X.*conj(Y)/K; + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 m-toolbox/classes/@ao/xspec.m --- a/m-toolbox/classes/@ao/xspec.m Mon Dec 05 18:04:34 2011 +0100 +++ b/m-toolbox/classes/@ao/xspec.m Tue Dec 06 19:07:22 2011 +0100 @@ -21,7 +21,7 @@ % % OUTPUTS: b - output AO % -% VERSION: $Id: xspec.m,v 1.61 2011/05/22 22:09:44 mauro Exp $ +% VERSION: $Id: xspec.m,v 1.62 2011/12/01 08:51:11 hewitson Exp $ % % HISTORY: 30-05-2007 M Hewitson % Creation @@ -39,7 +39,7 @@ mi = varargin{4}; invars = varargin{5}; - VERSION = '$Id: xspec.m,v 1.61 2011/05/22 22:09:44 mauro Exp $'; + VERSION = '$Id: xspec.m,v 1.62 2011/12/01 08:51:11 hewitson Exp $'; % Set the method version string in the minfo object mi.setMversion([VERSION '-->' mi.mversion]); @@ -133,8 +133,12 @@ % -------- Make Xspec estimate % Compute xspec using welch and always scale to PSD - [txy, f, info, dev] = welch(tsao(1), tsao(2), method, usepl.pset('Scale', 'PSD')); - + if usepl.find('newmethod') + [txy, f, info, dev] = ao.wosa(tsao(1), tsao(2), method, usepl.pset('Scale', 'PSD')); + else + [txy, f, info, dev] = welch(tsao(1), tsao(2), method, usepl.pset('Scale', 'PSD')); + end + % Keep the data shape of the first input AO if size(tsao(1).data.y,1) == 1 txy = txy.'; diff -r f90d4f666cc7 -r a59cdb8aaf31 m-toolbox/classes/@ltpda_uo/fromModel.m --- a/m-toolbox/classes/@ltpda_uo/fromModel.m Mon Dec 05 18:04:34 2011 +0100 +++ b/m-toolbox/classes/@ltpda_uo/fromModel.m Tue Dec 06 19:07:22 2011 +0100 @@ -12,7 +12,7 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -function [obj, ii, fcnname] = fromModel(obj, pl) +function [obj, ii, fcnname, pl] = fromModel(obj, pl) % Get the name of the model the user wants model = find(pl, 'built-in'); diff -r f90d4f666cc7 -r a59cdb8aaf31 m-toolbox/classes/@ltpda_uo/retrieve.m --- a/m-toolbox/classes/@ltpda_uo/retrieve.m Mon Dec 05 18:04:34 2011 +0100 +++ b/m-toolbox/classes/@ltpda_uo/retrieve.m Tue Dec 06 19:07:22 2011 +0100 @@ -28,7 +28,7 @@ % If only a single object is requested, it is returned as an object, % not packed in a cell array. % -% VERSION: $Id: retrieve.m,v 1.28 2011/07/01 14:38:57 ingo Exp $ +% VERSION: $Id: retrieve.m,v 1.29 2011/11/30 06:49:01 hewitson Exp $ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff -r f90d4f666cc7 -r a59cdb8aaf31 m-toolbox/classes/@ltpda_uoh/fromModel.m --- a/m-toolbox/classes/@ltpda_uoh/fromModel.m Mon Dec 05 18:04:34 2011 +0100 +++ b/m-toolbox/classes/@ltpda_uoh/fromModel.m Tue Dec 06 19:07:22 2011 +0100 @@ -10,13 +10,13 @@ % % PARAMETER: pl: Parameter list object % -% VERSION: $Id: fromModel.m,v 1.13 2011/08/15 12:59:04 hewitson Exp $ +% VERSION: $Id: fromModel.m,v 1.14 2011/12/02 09:05:15 hewitson Exp $ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function obj = fromModel(obj, pl) - [obj, ii, fcnname] = fromModel@ltpda_uo(obj, pl); + [obj, ii, fcnname, pl] = fromModel@ltpda_uo(obj, pl); % Add history try feval(fcnname, 'info'); @@ -26,6 +26,20 @@ obj.addHistory(ii, pl, [], []); end + % Here we make a check on the default plist keys because these properties + % may have been set in the model. We make the assumption that if they are + % empty, the user had no intention of setting them so we can remove them + % and keep the value set in the model. + if isempty(pl.find('name')) + pl.remove('name'); + end + if isempty(pl.find('description')) + pl.remove('description'); + end + if isempty(pl.find('plotinfo')) + pl.remove('plotinfo'); + end + % Set object properties obj.setObjectProperties(pl); diff -r f90d4f666cc7 -r a59cdb8aaf31 m-toolbox/classes/@ltpda_uoh/ltpda_uoh.m --- a/m-toolbox/classes/@ltpda_uoh/ltpda_uoh.m Mon Dec 05 18:04:34 2011 +0100 +++ b/m-toolbox/classes/@ltpda_uoh/ltpda_uoh.m Tue Dec 06 19:07:22 2011 +0100 @@ -20,7 +20,7 @@ % plotinfo - plist with the plot information % procinfo - plist with additional information for an object. % -% VERSION: $Id: ltpda_uoh.m,v 1.64 2011/09/16 04:59:23 hewitson Exp $ +% VERSION: $Id: ltpda_uoh.m,v 1.65 2011/12/02 09:03:42 hewitson Exp $ % % SEE ALSO: ltpda_obj, ltpda_uo, ltpda_tf, ltpda_filter, % ao, miir, mfir, filterbank, timespan, pzmodel, history, ssm, @@ -157,7 +157,7 @@ end function out = VEROUT() - out = '$Id: ltpda_uoh.m,v 1.64 2011/09/16 04:59:23 hewitson Exp $'; + out = '$Id: ltpda_uoh.m,v 1.65 2011/12/02 09:03:42 hewitson Exp $'; end function out = SETS() @@ -202,6 +202,7 @@ function pl = removeGlobalKeys(pl) pl.remove('name'); pl.remove('description'); + pl.remove('plotinfo'); end end diff -r f90d4f666cc7 -r a59cdb8aaf31 m-toolbox/classes/@matrix/fromInput.m --- a/m-toolbox/classes/@matrix/fromInput.m Mon Dec 05 18:04:34 2011 +0100 +++ b/m-toolbox/classes/@matrix/fromInput.m Tue Dec 06 19:07:22 2011 +0100 @@ -7,20 +7,34 @@ % % CALL: matrix = matrix.fromInput(inobjs) % -% VERSION: $Id: fromInput.m,v 1.9 2011/02/14 13:20:24 ingo Exp $ +% VERSION: $Id: fromInput.m,v 1.10 2011/12/05 07:40:23 hewitson Exp $ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function obj = fromInput(obj, pli, callerIsMethod) + VERSION = '$Id: fromInput.m,v 1.10 2011/12/05 07:40:23 hewitson Exp $'; + import utils.const.* if callerIsMethod % do nothing - pl = pli; else - utils.helper.msg(msg.OPROC1, 'Construct from inputs'); - pl = combine(pli, matrix.getDefaultPlist('From Input')); + % get AO info + ii = matrix.getInfo('matrix', 'From Input'); + + % Set the method version string in the minfo object + ii.setMversion([VERSION '-->' ii.mversion]); end + + % Combine input plist with default values + if callerIsMethod + pl = pli; + else + % Combine input plist with default values + % TODO: the parse step should be removed and included somehow into plist/applyDefaults + pl = applyDefaults(ii.plists, pli); + end + shape = pl.find('shape'); objs = pl.find('objs'); @@ -53,17 +67,9 @@ inhists = [inobjs(:).hist]; end obj.addHistory(matrix.getInfo('matrix', 'None'), pl, [], inhists); - warning('off', utils.const.warnings.METHOD_NOT_FOUND); - % remove parameters we already used - pl_set = copy(pl,1); - if pl_set.isparam('objs') - pl_set.remove('objs'); - end - if pl_set.isparam('shape') - pl_set.remove('shape'); - end - obj.setProperties(pl_set); - warning('on', utils.const.warnings.METHOD_NOT_FOUND); + + % Set any remaining object properties which exist in the default plist + obj.setObjectProperties(pl); end end diff -r f90d4f666cc7 -r a59cdb8aaf31 m-toolbox/classes/@ssm/ssm.m --- a/m-toolbox/classes/@ssm/ssm.m Mon Dec 05 18:04:34 2011 +0100 +++ b/m-toolbox/classes/@ssm/ssm.m Tue Dec 06 19:07:22 2011 +0100 @@ -107,7 +107,7 @@ % % Parameters Description % -% VERSION: $Id: ssm.m,v 1.199 2011/05/13 15:14:39 ingo Exp $ +% VERSION: $Id: ssm.m,v 1.200 2011/12/02 09:02:35 hewitson Exp $ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -716,7 +716,7 @@ end function out = VEROUT() - out = '$Id: ssm.m,v 1.199 2011/05/13 15:14:39 ingo Exp $'; + out = '$Id: ssm.m,v 1.200 2011/12/02 09:02:35 hewitson Exp $'; end function out = SETS() @@ -753,7 +753,7 @@ case 'from built-in model' % Built-in % This is inherited - pl = plist.FROM_BUILT_IN; + pl = combine(pl, plist.FROM_BUILT_IN); % withParams --> withparams changed to 'symbolic params' p = param({'symbolic params',['Give a cell-array of parameter names to keep in the expression.
    ',... 'By default this is empty and the model will be returned fully numeric.',... diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/buildxml.rb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/buildxml.rb Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,220 @@ +#!/usr/bin/ruby + +require 'ostruct' +require 'unittest' +require 'rexml/document' +include REXML + +options = OpenStruct.new +options.outfile = "" +options.infile = "" +options.version = "unknown" + +if ARGV[1]==nil then + puts "Usage: buildxml.rb " + exit +else + options.infile = ARGV[0] + options.outfile = ARGV[1] +end + +class UnitTestProcessor + attr_accessor :ut + + def initialize + @ut = UnitTest.new + @results = [] + end + + def result=(newResult) + testvalues = newResult.split(",") + @ut.path = getPath(testvalues) + @ut.title = getTitle(testvalues) + @ut.code = getCode(testvalues) + result = Result.new + result.syntax = testvalues[1] + result.algorithm = testvalues[2] + result.date = Date.new(testvalues[4].to_i) + result.number = testvalues[3].to_i + @ut.results << result + end + + # generates the path out of the test name + def getPath(testvalues) + parts = testvalues[0].split("_") + folder = parts[1] + parts.pop + filename = parts.join("_") + ".m" + "utps/" + folder + "/" + filename + end + + # generates the title out of the test name + def getTitle(testvalues) + parts = testvalues[0].split("_") + parts.pop + parts.shift + #parts[0].upcase! + parts.join(" ") + end + + # generates the title out of the test name + def getCode(testvalues) + parts = testvalues[0].split("_") + parts.pop + parts.join("_") + end + + def parseFile + begin + if !File.exists? @ut.path then + return + end + inFile = File.new(@ut.path) + currentTest = SubTest.new + while line = inFile.readline.chomp + # TODO: strip HTML-Tags + # remove trailing spaces + line.rstrip! + + if line.match /[%]+[ ]+UTP_[0-9]+/ then + currentTest = SubTest.new + parts = line.split("_") + currentTest.number = parts[1].to_i + end + + if line.match(/[%]+[ ]+END[ ]+UTP_[0-9]+/) and currentTest.number > 0 then + @ut.tests << currentTest + end + + if line.match "" then writeTo = "none" end + if line.match "" then writeTo = "none" end + if line.match "" then writeTo = "none" end + if line.match "" then writeTo = "none" end + if line.match "" then writeTo = "none" end + if line.match "" then writeTo = "none" end + + + + case writeTo + when "none" then + a = 1 + when "algoCode" then + currentTest.algoCode += line + "\n" + when "algoDescription" then + currentTest.algoDescription += removeComment line + when "syntaxCode" then + currentTest.syntaxCode += line + "\n" + when "syntaxDescription" then + currentTest.syntaxDescription += removeComment line + when "methodDescription" then + @ut.methodDescription += removeComment line + when "testDescription" then + currentTest.testDescription += removeComment line + end + + if line.match "" then writeTo = "methodDescription" end + if line.match "" then writeTo = "syntaxDescription" end + if line.match "" then writeTo = "testDescription" end + if line.match "" then writeTo = "algoDescription" end + if line.match "" then writeTo = "syntaxCode" end + if line.match "" then writeTo = "algoCode" end + + end + rescue EOFError + inFile.close + end + end + + # The analysis of a single line of the .m file + def removeComment(line) + line.strip! + while line.match /^%/ + # not elegant, but works in every realistic case (cut off at 100000 chars) + line = line[1,100000] + line.strip! + end + if line.length>0 then + line = line + "
    " + end + line + end + + # Merge Results and Test for easier access + def mergeTestsAndResults + @ut.tests.each do |t| + @ut.results.each do |r| + if t.number == r.number then + t.date = r.date + t.syntaxResult = r.syntax.to_i + t.algoResult = r.algorithm.to_i + if t.syntaxResult==0 or t.algoResult==0 then + @ut.tainted = true + end + end + end + end + end +end + +infile = File.open(options.infile, 'r'); +outfile = File.open(options.outfile, 'w'); + +tests = [] + +begin + while line = infile.readline.chomp + testvalues = line.split(",") + parts = testvalues[0].split("_") + parts.pop + tests << parts.join("_") + end +rescue EOFError + infile.close +end + +tests = tests.uniq + +# For testing: tests fet only for the first test +#tests = [] +#tests << "utp_ao_join_fsdata" +utps = [] +puts "Collecting data ..." +tests.each do |t| + inFile = File.open(options.infile, 'r') + utp = UnitTestProcessor.new + begin + while line = inFile.readline.chomp + if line.match t then + utp.result = line + end + end + rescue EOFError + inFile.close + end + utps << utp +end + +unittests = [] + +i=1 + +utps.each do |u| + puts "Parsing file " + i.to_s + " of " + utps.length.to_s + " (" + u.ut.path + ") ..." + i += 1 + u.parseFile + u.mergeTestsAndResults + unittests << u.ut +end + +#if(options.outfile HERE MATCHES DAT) then + Marshal.dump(unittests, outfile) +#elseif(optione.outfile. HERE MATCHES XML then +# doc = Document.new() +# root = Element.new("Report") +# root.add_attribute 'date', Time.now.to_s +# root.add_attribute 'version', options.version +# unittests.each do |u| +# testEl = Element.new(" +# end +#end +outfile.close diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/display_utp_results.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/display_utp_results.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,12 @@ +% DISPLAY_UTP_RESULTS displays the results structure to the terminal. +% +% M Hewitson 07-08-08 +% +% $Id: display_utp_results.m,v 1.7 2010/07/14 10:18:40 hewitson Exp $ +% + +function display_utp_results(results) + + disp(print_utp_results(results)); + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/document_utp_results.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/document_utp_results.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,145 @@ +% Given a set of results from utp_run, this function attaches additional +% documentation for each unit test. +function newResults = document_utp_results(results) + + + for kk=1:numel(results) + fprintf(1, '+ %d documenting %s/%s/%s\n', kk, results(kk).class, results(kk).method, results(kk).num); + newResults(kk) = readUTP(results(kk)); + end + +end + + +function result = readUTP(result) + + filename = result.file; + utpFcn = result.utp; + + + % parse the utp fcn + parts = regexp(utpFcn, filesep, 'split'); + utp = parts{end}; + + if strcmp(utp, 'xx') + % the utp failed to run + result.doc.desc = ''; + result.doc.syntax = ''; + result.doc.syntaxCode = ''; + result.doc.algo = ''; + result.doc.algoCode = ''; + return; + end + + + fd = fopen(filename); + if fd < 0 + warning('Failed to open %s', filename); + + end + + fulltxt = {}; + while ~feof(fd) + fulltxt = [fulltxt {fgetl(fd)}]; + end + + fclose(fd); + + % parse the txt for this test only + + % 1) find the utp_XX + % 2) backtrack to find + % 3) read forward to get the end of the fcn (count even closing end's) + + res = regexp(fulltxt, ['result\s*=\s*' utp]); + fcnLine = find(~cellfun('isempty', res)); + + % backtrack to look for the test description start + line = findLine(fulltxt, '', fcnLine, true); + + % parse out the test description + result.doc.desc = parseSection(fulltxt(line:end), utp, '', '', result.class, result.method, true, true); + + % parse out the syntax test + result.doc.syntax = parseSection(fulltxt(line:end), utp, '', '', result.class, result.method, true, true); + + % parse out syntax code + result.doc.syntaxCode = parseSection(fulltxt(line:end), utp, '', '', result.class, result.method, false, false); + + % parse out the algorithm test + result.doc.algo = parseSection(fulltxt(line:end), utp, '', '', result.class, result.method, true, true); + + % parse out algorithm code + result.doc.algoCode = parseSection(fulltxt(line:end), utp, '', '', result.class, result.method, false, false); + + + +end + +function line = findLine(lines, tag, startLine, backwards) + + + % backtrack to look for the test description start + line = startLine; + if backwards + while line > 0 + try + if strfind(lines{line}, tag) + break; + end + catch + lines + line + tag + end + line = line - 1; + end + else + while line <= numel(lines) + if strfind(lines{line}, tag) + break; + end + line = line + 1; + end + end + +end + +function desc = parseSection(lines, utp, startTag, endTag, class, method, stripComments, trimLines) + + % go forward capturing the description until we hit end of the + % description + line = 1; + desc = ''; + foundStart = false; + while line < numel(lines) + if strfind(lines{line}, startTag) + foundStart = true; + end + if foundStart + lineTxt = lines{line}; + if stripComments + lineTxt = strrep(lineTxt, '%', ''); + end + lineTxt = regexprep(lineTxt, ['%*\s*' startTag], ''); + lineTxt = regexprep(lineTxt, ['%*\s*' endTag], ''); + lineTxt = strrep(lineTxt, '', ['[' class '/' method ']']); + if trimLines + lineTxt = strtrim(lineTxt); + end + desc = [desc sprintf('%s\n', lineTxt)]; + end + if strfind(lines{line}, endTag) + break; + end + line = line + 1; + end + + desc = strtrim(desc); + + +end + + + + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generate_report.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generate_report.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,256 @@ +% GERERATE_REPORT reads all unit test and generates a report. + +% TODO +% +% + Format UTP table by hand - not using \utp +% + move code block to tables in appendix with same numbering as UTP tables +% + add pdf link in UTP table to code block +% + keep code indentation from m-file +% + wrap strings using utils.prog.wrapstring (or similar) - add ... +% + +function report = generate_report() + + setappdata(0, 'ltpda_verbose_level', -1); + + pdfFilename = 'report/report.pdf'; + texFilename = 'report/ltpda_report_template.html'; + repFilename = 'report/report.html'; + + load resultsave.mat results + % results = utp_run('utp_ao_log10'); + disp(results(1).a); + disp(results(1).s); + disp(results(1).fcn); + disp(results(1).num); + disp(results(1).date); + + inFile = fopen(texFilename, 'r'); + + methodDescription = ''; + testDescription = ''; + syntaxDescription = ''; + algoDescription = ''; + syntaxCode = ''; + algoCode = ''; + + writeDirectly = true; + outputTex = ''; + + % Get the rest: + while ~feof(inFile) + line = fgetl(inFile); + + if strfind(line, '') + writeDirectly = false; + preTests = outputTex; + outputTex = ''; + end + + if strfind(line, '') + writeDirectly = true; + end + + if strfind(line, '') + methodDescription = ''; + while isempty(strfind(line, '')) + methodDescription = sprintf('%s%s\n', methodDescription, line); + line = fgetl(inFile); + end + methodDescription = sprintf('%s%s\n', methodDescription, line); + end + + if strfind(line, '') + testDescription = ''; + while isempty(strfind(line, '')) + testDescription = sprintf('%s%s\n', testDescription, line); + line = fgetl(inFile); + end + testDescription = sprintf('%s%s\n', testDescription, line); + end + + if strfind(line, '') + syntaxDescription = ''; + while isempty(strfind(line, '')) + syntaxDescription = sprintf('%s%s\n', syntaxDescription, line); + line = fgetl(inFile); + end + syntaxDescription = sprintf('%s%s\n', syntaxDescription, line); + end + + if strfind(line, '') + algoDescription = ''; + while isempty(strfind(line, '')) + algoDescription = sprintf('%s%s\n', algoDescription, line); + line = fgetl(inFile); + end + algoDescription = sprintf('%s%s\n', algoDescription, line); + end + + if strfind(line, '') + syntaxCode = ''; + while isempty(strfind(line, '')) + syntaxCode = sprintf('%s%s\n', syntaxCode, line); + line = fgetl(inFile); + end + syntaxCode = sprintf('%s%s\n', syntaxCode, line); + end + + if strfind(line, '') + algoCode = ''; + while isempty(strfind(line, '')) + algoCode = sprintf('%s%s\n', algoCode, line); + line = fgetl(inFile); + end + algoCode = sprintf('%s%s\n', algoCode, line); + end + + if writeDirectly + outputTex = sprintf('%s%s\n', outputTex, line); + end + end + postTests = outputTex; + + fclose(inFile); + + % All vars are ready, now read test files: + + outFile = fopen(repFilename, 'wt'); + filenames = {}; + filenames{end+1} = 's'; + for i=1:length(results) + positions = strfind(results(i).fcn, '_'); + lastUnderscore = positions(length(positions)) -1; + if ~strcmp(filenames{end}, sscanf(results(i).fcn, '%c', lastUnderscore)) + filenames{end+1} = sscanf(results(i).fcn, '%c', lastUnderscore); + end + end + + % Print the intro + fprintf(outFile, '%s', preTests); + temp = ''; + + for i=2:length(filenames) + filename = ['utps/ao/' filenames{i} '.m']; + if exist(filename, 'file') + utpRead = fopen(filename); + + headerNumber = 1; + + % Get header: + if ~feof(utpRead), header = fgetl(utpRead); end + header = remComment(header); + header = escTex(header); + + % Get rest: + while ~feof(utpRead) + line = fgetl(utpRead); + line = strtrim(line); + + % if strfind(line, 'function result') + + if strfind(line, '') + line = fgetl(utpRead); + utpMethodDescription = ''; + while isempty(strfind(line, '')) + utpMethodDescription = sprintf('%s%s\n', utpMethodDescription, line); + line = remComment(fgetl(utpRead)); + end + temp = strrep(methodDescription, '%%%CONTENT%%%', utpMethodDescription); + temp = strrep(temp, '%%%HEADER%%%', strrep(filenames{i}, '_', ' ')); + fprintf(outFile, '%s', temp); + end + + if strfind(line, '') + line = fgetl(utpRead); + utpTestDescription = ''; + while isempty(strfind(line, '')) + utpTestDescription = sprintf('%s%s\n', utpTestDescription, line); + line = remComment(fgetl(utpRead)); + end + temp = strrep(testDescription, '%%%CONTENT%%%', utpTestDescription); + temp = strrep(temp, '%%%HEADER%%%', sprintf('%s %2g', strrep(filenames{i}, '_', ' '), headerNumber)); + fprintf(outFile, '%s', temp); + end + + if strfind(line, '') + line = remComment(fgetl(utpRead)); + utpSyntaxDescription = ''; + while isempty(strfind(line, '')) + if ~strcmp(strtrim(line), '') + utpSyntaxDescription = sprintf('%s%s
    \n', utpSyntaxDescription, line); + end + line = remComment(fgetl(utpRead)); + end + fprintf(outFile, '%s', strrep(syntaxDescription, '%%%CONTENT%%%', utpSyntaxDescription)); + end + + if strfind(line, '') + line = remComment(fgetl(utpRead)); + utpAlgoDescription = ''; + while isempty(strfind(line, '')) + if ~strcmp(strtrim(line), '') + utpAlgoDescription = sprintf('%s%s
    \n', utpAlgoDescription, line); + end + line = remComment(fgetl(utpRead)); + end + fprintf(outFile, '%s', strrep(algoDescription, '%%%CONTENT%%%', utpAlgoDescription)); + end + + if strfind(line, '') + line = escComment(fgetl(utpRead)); + % Get number of spaces before string + + utpSyntaxCode = ''; + while isempty(strfind(line, '')) + utpSyntaxCode = sprintf('%s%s\n', utpSyntaxCode, line); + line = escComment(fgetl(utpRead)); + end + fprintf(outFile, '%s', strrep(syntaxCode, '%%%CONTENT%%%', utpSyntaxCode)); + end + + if strfind(line, '') + line = escComment(fgetl(utpRead)); + utpAlgoCode = ''; + while isempty(strfind(line, '')) + utpAlgoCode = sprintf('%s%s\n', utpAlgoCode, line); + line = escComment(fgetl(utpRead)); + end + fprintf(outFile, '%s', strrep(algoCode, '%%%CONTENT%%%', utpAlgoCode)); + headerNumber = headerNumber + 1; + end + + end + fclose(utpRead); + end + + end + + % Print the outro + fprintf(outFile, '%s', postTests); + + fclose(outFile); + + report = ''; + +end + + +function newString = remComment(string) + pos = strfind(string, '%'); + newString = strtrim(string(pos+1:length(string))); +end + +function newString = escComment(string) + string = strrep(string, '%', '\%'); + % string = strtrim(string); + newString = sprintf('%s
    ', string); +end + +function newString = escTex(string) + string = strrep(string, '\', '\\'); + string = strrep(string, '%', '\%'); + string = strrep(string, '_', '\_'); + string = strrep(string, '^', '\^'); + newString = string; +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/check_aop_data_object.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/check_aop_data_object.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,34 @@ +% +% DESCRIPTION: Generic check for a arithmetic operator unit test which +% checks the datatype for a single inputs. +% +% CALL: atest = check_aop_data_object(fcn, in1, in2, out); +% +% VERSION: $Id: check_aop_data_object.m,v 1.2 2010/09/23 18:17:54 ingo Exp $ +% + +function atest = check_aop_data_object(fcn, in1, in2, out) + d1 = in1.data; + d2 = in2.data; + + if any(strcmpi(func2str(fcn), {'or', 'and', 'xor'})) + atest = isa(out.data, 'cdata'); + else + if isa(d1, 'data2D') && isa(d2, 'data2D') + if numel(d1.y) > 1 + dout = d1; + elseif numel(d2.y) > 1 + dout = d2; + else + dout = d1; + end + elseif isa(d1, 'data2D') && isa(d2, 'cdata') + dout = d1; + elseif isa(d1, 'cdata') && isa(d2, 'data2D') + dout = d2; + else + dout = d1; + end + atest = isa(out.data, class(dout)); + end +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/check_aop_errors.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/check_aop_errors.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,40 @@ +% +% DESCRIPTION: Generic check for a arithmetic operator unit test which +% checks the y-errors for a single inputs. +% +% CALL: atest = check_aop_errors(fcn, in1, in2, out); +% +% VERSION: $Id: check_aop_errors.m,v 1.2 2010/09/21 16:50:14 ingo Exp $ +% + +function atest = check_aop_errors(fcn, in1, in2, out) + if ~isempty(in1.dy) || ~isempty(in2.dy) + + din1 = in1.dy; + din2 = in2.dy; + + if isempty(din1) + din1 = zeros(size(in1.y)); + end + if isempty(din2) + din2 = zeros(size(in2.y)); + end + + switch func2str(fcn) + case {'plus', 'minus'} + dy = sqrt(din1.^2 + din2.^2); + case {'times', 'mtimes'} + dy = sqrt( (din1./in1.y).^2 + (din2./in2.y).^2 ) .* abs(in1.y.*in2.y); + case {'rdivide', 'mrdivide'} + dy = sqrt( (din1./in1.y).^2 + (din2./in2.y).^2 ) .* abs(in1.y./in2.y); + otherwise + dy = []; + end + + else + dy = []; + end + + atest = isequal(out.dy, dy); + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/check_aop_history.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/check_aop_history.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,43 @@ +% +% DESCRIPTION: Generic check for a arithmetic operator unit test which +% checks the history for a single inputs. +% +% CALL: atest = check_aop_history(fcn, in1, in2, out); +% +% VERSION: $Id: check_aop_history.m,v 1.4 2010/09/24 16:18:16 ingo Exp $ +% + +function atest = check_aop_history(fcn, in1, in2, out) + + atest = true; + % Check the last history step + for ii = 1:numel(out) + if ~strcmp(out(ii).hist.methodInfo.mname, func2str(fcn)), atest = false; end + end + + doCheck = round(rand(1,1)*10); + doCheck = 1; + + % Check the rebuild only in 10 percent of the unit test. I do this to + % speedup the tests. + if doCheck == 1 + try + ple = plist('Exceptions', {'created', 'proctime', 'UUID', 'param/desc', 'name', 'methodInvars', 'version'}); + + % Rebuild the output object + mout = rebuild(copy(out,1)); + + % The rebuilt object must be the same as 'out' + for ii=1:numel(mout) + if ~eq(mout(ii), out(ii), ple), atest = false; end + if atest == 0 + break; + end + end + + catch + atest = false; + end + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/check_aop_units.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/check_aop_units.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,28 @@ +% +% DESCRIPTION: Generic check for a arithmetic operator unit test which +% checks the y-units for a single inputs. +% +% CALL: atest = check_aop_units(fcn, in1, in2, out); +% +% VERSION: $Id: check_aop_units.m,v 1.3 2010/09/23 18:19:21 ingo Exp $ +% + +function atest = check_aop_units(fcn, in1, in2, out) + if utils.helper.ismember(func2str(fcn), {'plus', 'minus'}) + % return the first non-empty + if ~isempty(in1.data.yunits.strs) + uo = in1.data.yunits; + else + uo = in2.data.yunits; + end + elseif utils.helper.ismember(func2str(fcn), {'or', 'and', 'xor'}) + uo = unit(); + else + % For other operators we need to apply the operator + uo = fcn(in1.data.yunits, in2.data.yunits); + end + + atest = eq(uo, out.yunits); + +end + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/check_axis_sets.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/check_axis_sets.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,51 @@ +function atest = check_axis_sets(io) + atest = true; + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, '1D')), atest = false; end + if ~any(strcmpi(io(2).sets, '2D')), atest = false; end + if ~any(strcmpi(io(2).sets, '3D')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET '1D' + % Check key + if ~io(3).plists.isparam('axis'), atest = false; end + if ~io(3).plists.isparam('dim'), atest = false; end + if ~io(3).plists.isparam('option'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('axis'), 'y'), atest = false; end + if ~isEmptyDouble(io(3).plists.find('dim')), atest = false; end + if ~isEmptyChar(io(3).plists.find('option')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('axis'), {'y'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('dim'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('option'), {''}), atest = false; end + % SET '2D' + % Check key + if ~io(4).plists.isparam('axis'), atest = false; end + if ~io(4).plists.isparam('dim'), atest = false; end + if ~io(4).plists.isparam('option'), atest = false; end + % Check default value + if ~isequal(io(4).plists.find('axis'), 'y'), atest = false; end + if ~isEmptyDouble(io(4).plists.find('dim')), atest = false; end + if ~isEmptyChar(io(4).plists.find('option')), atest = false; end + % Check options + if ~isequal(io(4).plists.getOptionsForParam('axis'), {'x', 'y', 'xy'}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('dim'), {[]}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('option'), {''}), atest = false; end + % SET '3D' + % Check key + if ~io(5).plists.isparam('axis'), atest = false; end + if ~io(5).plists.isparam('dim'), atest = false; end + if ~io(5).plists.isparam('option'), atest = false; end + % Check default value + if ~isequal(io(5).plists.find('axis'), 'z'), atest = false; end + if ~isEmptyDouble(io(5).plists.find('dim')), atest = false; end + if ~isEmptyChar(io(5).plists.find('option')), atest = false; end + % Check options + if ~isequal(io(5).plists.getOptionsForParam('axis'), {'x', 'y', 'z', 'xyz'}), atest = false; end + if ~isequal(io(5).plists.getOptionsForParam('dim'), {[]}), atest = false; end + if ~isequal(io(5).plists.getOptionsForParam('option'), {''}), atest = false; end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_02.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_02.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,76 @@ +% +% +% Tests that the method works with a vector of objects as input. +% +% +% +% $Id: utp_02.m,v 1.3 2010/07/27 07:13:59 hewitson Exp $ +% + +function result = utp_02(method, vec, algo, pli, ple3) + + % + % + % Test that the method works for a vector of objects as input. + % + % + + try + % + if isempty(pli) + out = feval(method, vec); + else + out = feval(method, vec, pli); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'vec' + % 2) Check that each output object contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(vec)), atest = false; end + % Check each output against the correct value + for kk=1:numel(out) + + % extra tests for constructors + if utils.helper.ismember(method, utils.helper.ltpda_userclasses) + + % Check that the output is the same except the history + if ~eq(vec(kk), out(kk), ple3), atest = false; end + % Check the history + if ~eq(vec(kk).hist, out(kk).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(kk).setDescription('my desc'); + if eq(vec(kk), out(kk), ple3), atest = false; end + + else + atest = algo(vec(kk), out(kk), pli); + if ~atest + break; + end + + end + end + + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_02 \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_03.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_03.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,70 @@ +% +% +% Tests that the method works with a matrix of objects as input. +% +% +function result = utp_03(method, mat, algo, pli, ple3) + + % + % + % Test that the method works for a matrix of objects as input. + % + % + + try + % + if isempty(pli) + out = feval(method, mat); + else + out = feval(method, mat, pli); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'mat' + % 2) Check that each output object contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(mat)), atest = false; end + % Check each output against the correct value + for kk=1:numel(out) + + % extra tests for constructors + if utils.helper.ismember(method, utils.helper.ltpda_userclasses) + + % Check that the output is the same except the history + if ~eq(mat(kk), out(kk), ple3), atest = false; end + % Check the history + if ~eq(mat(kk).hist, out(kk).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(kk).setDescription('my desc'); + if eq(mat(kk), out(kk), ple3), atest = false; end + + else + atest = algo(mat(kk), out(kk), pli); + if ~atest + break; + end + end + end + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_02 \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_04.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_04.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,71 @@ +% +% +% Tests that the method works with a list of objects as input. +% +% +function result = utp_04(method, obj1, obj2, obj3, algo, pli, ple3) + + % + % + % Test that the method works for a list of objects as input. + % + % + + try + % + if isempty(pli) + out = feval(method, obj1, obj2, obj3); + else + out = feval(method, obj1, obj2, obj3, pli); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'mat' + % 2) Check that each output object contains the correct data. + % + % + + atest = true; + if stest + obj_in = [obj1 obj2 obj3]; + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(obj_in)), atest = false; end + % Check each output against the correct value + for kk=1:numel(obj_in) + + % extra tests for constructors + if utils.helper.ismember(method, utils.helper.ltpda_userclasses) + + % Check that the output is the same except the history + if ~eq(obj_in(kk), out(kk), ple3), atest = false; end + % Check the history + if ~eq(obj_in(kk).hist, out(kk).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(kk).setDescription('my desc'); + if eq(obj_in(kk), out(kk), ple3), atest = false; end + + else + atest = algo(obj_in(kk), out(kk), pli); + if ~atest + break; + end + end + end + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_02 \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_05.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_05.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,72 @@ +% +% +% Tests that the method works with a mix of different arrays of objects as input. +% +% +function result = utp_05(method, obj1, obj2, obj3, algo, pli, ple3) + + % + % + % Tests that the method works with a mix of different arrays of + % objects as input. + % + % + + try + % + if isempty(pli) + out = feval(method, obj1, obj2, obj3); + else + out = feval(method, obj1, obj2, obj3, pli); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'mat' + % 2) Check that each output object contains the correct data. + % + % + + atest = true; + if stest + obj_in = [reshape(obj1, 1, []) reshape(obj2, 1, []) reshape(obj3, 1, [])]; + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(obj_in)), atest = false; end + % Check each output against the correct value + for kk=1:numel(obj_in) + + % extra tests for constructors + if utils.helper.ismember(method, utils.helper.ltpda_userclasses) + + % Check that the output is the same except the history + if ~eq(obj_in(kk), out(kk), ple3), atest = false; end + % Check the history + if ~eq(obj_in(kk).hist, out(kk).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(kk).setDescription('my desc'); + if eq(obj_in(kk), out(kk), ple3), atest = false; end + + else + atest = algo(obj_in(kk), out(kk), pli); + if ~atest + break; + end + end + end + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_02 \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_06.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_06.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,53 @@ +% +% +% Tests that the method properly applies history. +% +% +function result = utp_06(method, obj1, pli, epl) + + % + % + % Test that the result of applying the method can be processed back. + % + % + + try + % + if isempty(pli) + out = feval(method, obj1); + else + out = feval(method, obj1, pli); + end + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % ''. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, method), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, epl), atest = false; end + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_06 \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_07.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_07.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,69 @@ +% +% +% Tests that the method can modify the input AO. +% +% +function result = utp_07(method, obj1, ipl, ple1) + + % + % + % Test that the method can modify the input object by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + obj_modi = copy(obj1,1); + obj_eq = copy(obj1,1); + cmd = sprintf('out = obj_eq.%s(ipl);', method); + eval(cmd); + cmd = sprintf('obj_modi.%s(ipl);', method); + eval(cmd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'out' and 'aeq' are now different. + % 2) Check that 'aeq' is not changed + % 3) Check that the modified input is the value of the copy + % 4) Check that out and amodi are the same + % + % + + atest = true; + if stest + % + % Check that 'out' and 'obj_eq' are now different. + if eq(out, obj_eq, ple1), atest = false; end + % Check that 'obj_eq' is not changed + if ~eq(obj_eq, obj1, ple1), atest = false; end + + switch class(obj1) + case 'ao' + if isempty(ipl) || isempty(find(ipl, 'neval')) + % Check that the modified input is correct + if ~isequal(feval(method, obj1.data.getY), obj_modi.data.getY), atest = false; end + end + % Check that out and obj_modi are the same + if ~eq(out, obj_modi, ple1), atest = false; end + otherwise + warning('!!! test is undefined for class %s', class(obj_modi)); + atest = false; + end + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_07 \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_08.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_08.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,65 @@ + +% +% +% Test that the method uses the plist to get the axis. +% +% +function result = utp_08(method, obj1, ple1) + + % + % + % Test that the method uses the plist to get the axis. + % + % + + try + % + plx = plist('axis', 'X'); + ply = plist('axis', 'Y'); + plxy = plist('axis', 'XY'); + out1 = feval(method, obj1, plx); + out2 = feval(method, obj1, ply); + out3 = feval(method, obj1, plxy); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the method applies to the x-axis + % 2) Check that the method applies to the y-axis + % 3) Check that the method applies to both axes + % 4) Check that the re-built object is the same as in 'out[1..3]'. + % + % + + atest = true; + if stest + % + % Check each output against the correct values + if ~isequal(feval(method, obj1.data.getX), out1.data.getX), atest = false; end + if ~isequal(obj1.data.getY, out1.data.getY), atest = false; end + if ~isequal(obj1.data.getX, out2.data.getX), atest = false; end + if ~isequal(feval(method,obj1.data.getY), out2.data.getY), atest = false; end + if ~isequal(feval(method,obj1.data.getX), out3.data.getX), atest = false; end + if ~isequal(feval(method,obj1.data.getY), out3.data.getY), atest = false; end + % Check the re-built objects + if ~eq(mout1, out1, ple1), atest = false; end + if ~eq(mout2, out2, ple1), atest = false; end + if ~eq(mout3, out3, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_08 \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_09.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_09.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,85 @@ +% +% +% Test the shape of the data in AOs. +% +% +function result = utp_09(method, obj1, obj2) + + % + % + % Test that the method keeps the data shape of the input object. The + % input AO data must be an array with row data and/or column data. + % + % + + try + % + + if iscolumnvector(obj1) == iscolumnvector(obj2) + warning('!!! Incorrect inputs. Give a column and a row vector.'); + stest = false; + else + out1 = feval(method, obj1); + out2 = feval(method, obj2); + % + stest = true; + end + + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + + atest = false; + + if iscolumnvector(out1) && iscolumnvector(obj1) + atest = true; + end + + if isrowvector(out1) && isrowvector(obj1) + atest = true; + end + + + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_09 + +function res = iscolumnvector(obj) + + if size(obj.data.y, 1)>=1 && size(obj.data.y,2)==1 + res = true; + else + res = false; + end + +end + + +function res = isrowvector(obj) + + if size(obj.data.y, 2)>=1 && size(obj.data.y,1)==1 + res = true; + else + res = false; + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_10.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_10.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,57 @@ +% +% +% Check that the method pass back the output objects to a list of +% output variables or to a single variable. +% +% +function result = utp_10(method, obj1, obj2, ple2) + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = feval(method, obj1, obj2); + o3 = feval(method, obj1, obj2); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_10 diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_108.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_108.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,64 @@ + +% +% +% Test that the method uses the plist to get the axis. This is +% intended to test methods like ao/mean and ao/std which return different +% data types depending on which axis is selected. +% +% +function result = utp_108(method, obj1, ple1) + + % + % + % Test that the method uses the plist to get the axis. + % + % + + try + % + plx = plist('axis', 'X'); + ply = plist('axis', 'Y'); + plxy = plist('axis', 'XY'); + out1 = feval(method, obj1, plx); + out2 = feval(method, obj1, ply); + out3 = feval(method, obj1, plxy); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the method applies to the x-axis + % 2) Check that the method applies to the y-axis + % 3) Check that the method applies to both axes + % 4) Check that the re-built object is the same as in 'out[1..3]'. + % + % + + atest = true; + if stest + % + % Check each output against the correct values + if ~isequal(feval(method,obj1.data.getX), out1.data.getY), atest = false; end + if ~isequal(feval(method,obj1.data.getY), out2.data.getY), atest = false; end + if ~isequal(feval(method,obj1.data.getY), out3.data.getY), atest = false; end + % Check the re-built objects + if ~eq(mout1, out1, ple1), atest = false; end + if ~eq(mout2, out2, ple1), atest = false; end + if ~eq(mout3, out3, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_108 \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_11.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_11.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,56 @@ +% +% +% Check that the method pass back the output objects to a list of +% output variables or to a single variable. +% +% +function result = utp_11(method, obj1, ple1, varargin) + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + if ~isempty(varargin) + pli = varargin{1}; + else + pli = []; + end + + try + % + obj1 = obj1.setPlotinfo(plist('color', 'r')); + if isempty(pli) + o1 = feval(method, obj1); + else + o1 = feval(method, obj1, pli); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the same plotinfo plist + % + % + + atest = true; + if stest + % + if ~eq(obj1(1).plotinfo, o1(1).plotinfo, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_30 \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_12.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_12.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,61 @@ +% +% +% Check that the errors are cleared for this method. +% +% +function result = utp_12(method, obj1, ple1, varargin) + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + if ~isempty(varargin) + pli = varargin{1}; + else + pli = []; + end + + try + % + if isa(obj1.data, 'data2D') + obj1 = obj1.setDx(obj1.x); + end + obj1 = obj1.setDy(obj1.y); + if isempty(pli) + o1 = feval(method, obj1); + else + o1 = feval(method, obj1, pli); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output has no error fields + % + % + + atest = true; + if stest + % check which axis the method was applied to, if any + ax = o1.hist.plistUsed.find('axis'); + % + if any('X'==upper(ax)) && ~isempty(o1.dx), atest = false; end + if any('Y'==upper(ax)) && ~isempty(o1.dy), atest = false; end + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_12 \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_208.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_208.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,59 @@ + +% +% +% Test that the method uses the plist to get the axis. This is +% intended to test methods like ao/max and ao/min which only allow 'x' and +% 'y' choices. +% +% +function result = utp_208(method, obj1, ple1) + + % + % + % Test that the method uses the plist to get the axis. + % + % + + try + % + plx = plist('axis', 'X'); + ply = plist('axis', 'Y'); + out1 = feval(method, obj1, plx); + out2 = feval(method, obj1, ply); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the method applies to the x-axis + % 2) Check that the method applies to the y-axis + % 3) Check that the method applies to both axes + % 4) Check that the re-built object is the same as in 'out[1..3]'. + % + % + + atest = true; + if stest + % + % Check each output against the correct values + if ~isequal(feval(method,obj1.data.getX), out1.data.getX), atest = false; end + if ~isequal(feval(method,obj1.data.getY), out2.data.getY), atest = false; end + % Check the re-built objects + if ~eq(mout1, out1, ple1), atest = false; end + if ~eq(mout2, out2, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_208 \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_60.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_60.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,67 @@ + +% +% +% Tests that the constructor method doesn't apply history to the read +% MAT-file constructor. +% +% +function result = utp_60(cl, obj1, ple1) + + % + % + % Tests that the constructor method doesn't apply history to the read + % MAT-file constructor. + % + % + + msg = ''; + try + % + filename = 'obj.mat'; + ss = feval(cl, obj1); + save(ss, filename); + + out = feval(cl, filename); + mout = rebuild(out); + % + stest = true; + catch err + msg = err.message; + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history is the same as the history of the saved + % object. Because save and load shouldn't add a history step. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check that the saved and loaded objects are the same + if ~eq(out, ss) + msg = ['The saved and loaded objects are not equal: ' lastwarn]; + atest = false; + end + % Check the rebuilt object + if ~eq(mout, out, ple1) + msg = ['The original and rebuilt objects are not equal: ' lastwarn]; + atest = false; + end + % + delete(filename); + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename, msg); +end % END UTP_08 + + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_61.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_61.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,67 @@ +% +% +% Tests that the constructor properly applies history to the read +% XML-file constructor. +% +% +function result = utp_61(cl, obj1, ple2) + + % + % + % Tests that the constructor properly applies history to the read + % XML-file constructor. + % + % + + msg = ''; + try + % + filename = 'obj.xml'; + amat = feval(cl, obj1); + save(amat, filename); + + out = feval(cl, filename); + mout = rebuild(out); + % + stest = true; + catch err + msg = err.message; + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history is the same as the history of the saved + % object. Because save and load shouldn't add a history step. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~eq(out, amat) + msg = ['The original and rebuilt objects are not equal: ' lastwarn]; + atest = false; + end + + % Check the rebuilt object + for kk = 1:numel(out) + if ~eq(mout(kk), out(kk), ple2) + msg = ['The original and rebuilt objects are not equal: ' lastwarn]; + atest = false; + end + end + % + delete(filename); + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename, msg); +end % END UTP_09 diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_62.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_62.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,73 @@ +% +% +% Tests that the constructor properly applies history in the struct constructor. +% +% +function result = utp_62(cl, obj1, obj2, ple2) + + % + % + % Tests that the constructor properly applies history in the struct constructor. + % + % + + msg = ''; + try + % + ssys1 = utils.prog.rstruct(obj1); + ssys1.hist = utils.prog.rstruct(obj1.hist); + + out1 = feval(cl, utils.prog.rstruct(obj2)); + out2 = feval(cl, ssys1); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + msg = err.message; + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' + % corresponds to the class name. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check that the output is a ssm object + if ~isa(out1,cl), atest = false; end + if ~isa(out2,cl), atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'setName') + msg = 'The last step in the history is not ''setName'''; + atest = false; + end + if ~strcmp(out2.hist.methodInfo.mname, 'setName') + msg = 'The last step in the history is not ''setName'''; + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple2) + msg = ['The original and rebuilt objects are not equal: ' lastwarn]; + atest = false; + end + if ~eq(mout2, out2, ple2) + msg = ['The original and rebuilt objects are not equal: ' lastwarn]; + atest = false; + end + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename, msg); +end % END UTP_62 \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_63.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_63.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,55 @@ +% +% +% Tests that the constructor properly applies history to the pzmodel constructor. +% +% +function result = utp_63(cl, ple1) + + % + % + % Tests that the constructor properly applies history to the pzmodel constructor. + % + % + + try + % + ps = [pz(1) pz(200)]; + zs = pz(50); + pzm = pzmodel(1, ps, zs, unit('Hz^2'), unit('V^2')); + out = feval(cl, pzm); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' + % corresponds to the class name. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check that the output is the correct class of object + if ~isa(out,cl), atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, cl), atest = false; end + if ~strcmp(out.hist.inhists.methodInfo.mname, 'pzmodel'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_63 \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_64.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_64.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,82 @@ +% +% +% Tests that the contructor properly applies history to the +% plist(filename) constructor. +% +% +function result = utp_64(cl, obj1, ple1, ple2) + + % + % + % Tests that the contructor properly applies history to the + % plist(filename) constructor. + % + % + + msg = ''; + try + % + filename1 = 'obj.xml'; + filename2 = 'obj.mat'; + + f1 = feval(cl, obj1); + + save(f1, filename1); + save(f1, filename2); + + out1 = feval(cl, plist('filename', filename1)); + out2 = feval(cl, plist('filename', filename2)); + + rout1 = out1.rebuild; + rout2 = out2.rebuild; + + % + stest = true; + catch err + msg = err.message; + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the save method doesn't change the input object + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % The load doesn't have two additionally history steps (save + load) + if ~eq(out1, f1, ple1) + msg = ['The history of the objects are not equal: ' lastwarn]; + atest = false; + end + if ~eq(out2, f1, ple1) + msg = ['The history of the objects are not equal: ' lastwarn]; + atest = false; + end + % Rebuild object and check the result + if ~eq(rout1, out1, ple2) + msg = ['The original and rebuilt objects are not equal: ' lastwarn]; + atest = false; + end + if ~eq(rout2, out2, ple2) + msg = ['The original and rebuilt objects are not equal: ' lastwarn]; + atest = false; + end + % + % delete test file + delete(filename1) + delete(filename2) + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename, msg); +end % END UTP_64 + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_65.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_65.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,85 @@ + +% +% +% Tests that the contructed object can be submitted and retrieved. +% +% +function result = utp_65(cl, obj1, ple3) + + % + % + % Tests that the contructed object can be submitted and retrieved. + % + % + + msg = ''; + try + % + pl = plist('hostname', utpGetHostname, ... + 'database', utpGetDatabase, ... + 'username', utpGetUsername, ... + 'password', utpGetPassword, ... + 'experiment title', 'utp_65: submit objects', ... + 'experiment description', 'utp_65: test submission', ... + 'analysis description', 'no analysis', ... + 'no dialog', true, ... + 'use selector', false); + + ids = submit(obj1, pl); + + out = feval(cl, plist('hostname', utpGetHostname, ... + 'database', utpGetDatabase, ... + 'username', utpGetUsername, ... + 'password', utpGetPassword, ... + 'id', ids)); + % + stest = true; + catch err + msg = err.message; + disp(err.message) + % Close connection + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % the class name. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + for kk = 1:numel(out) + if ~strcmp(out(kk).hist.methodInfo.mname, cl) + msg = ['The last step in the history is not ''' cl '''']; + atest = false; + end + end + % Check data values + if ~eq(out, obj1, ple3) + msg = ['The values in the objects are not equal: ' lastwarn]; + atest = false; + end + % Check the history + if ~eq(out.hist.inhists, obj1.hist) + msg = ['The history of the objects are not equal: ' lastwarn]; + atest = false; + end + + % Rebuild the retrieved object +% rout = rebuild(out); +% if ~eq(rout, out, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename, msg); +end % END UTP_65 diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_66.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_66.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,59 @@ +% +% +% Tests that the construuctor properly works with the plist(pzmodel) +% constructor. +% +% +function result = utp_66(cl, ple1) + + % + % + % Tests that the constructor properly works with the plist(pzmodel) + % constructor. + % + % + + try + % + ps = [pz(1) pz(200)]; + zs = pz(50); + pzm = pzmodel(1, ps, zs, unit('Hz'), unit('V')); + pl = plist('pzmodel', pzm, 'fs', 10, 'nsecs', 10); + out = feval(cl, pl); + + rout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ssm'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, cl), atest = false; end + % Check the next to the last step in the history. + % It must be the history of the pole/zero model (here 'pzmodel') + if ~strcmp(out.hist.inhists.methodInfo.mname, 'pzmodel'), atest = false; end + % Rebuild object and check the result + if ~eq(rout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_66 \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_67.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_67.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,56 @@ +% +% +% Tests that the constructor properly applies history to the +% pole/zero model + plist object constructor. +% +% +function result = utp_67(cl, ple1) + + % + % + % Tests that the constructor properly applies history to the + % pole/zero model + plist object constructor. + % + % + + try + % + ps = [pz(1) pz(200)]; + zs = pz(50); + pzm = pzmodel(1, ps, zs, unit('Hz'), unit('V')); + out = feval(cl, pzm, plist('fs', 10, 'nsecs', 10)); + + rout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % class name. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, cl), atest = false; end + % Check values + % Rebuild object and check the result + if ~eq(rout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_67 \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_68.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_68.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,79 @@ +% +% +% Tests that the constructor properly applies history to the conn+Id constructor. +% +% +function result = utp_68(cl, obj1, ple3) + + % + % + % Tests that the constructor properly applies history to the conn+Id + % constructor. + % + % + + msg = ''; + try + % + pl = plist('hostname', utpGetHostname, ... + 'database', utpGetDatabase, ... + 'username', utpGetUsername, ... + 'password', utpGetPassword, ... + 'experiment title', 'utp_68: submit objects', ... + 'experiment description', 'utp_68: test submission', ... + 'analysis description', 'no analysis', ... + 'no dialog', true, ... + 'use selector', false); + + [ids] = submit(obj1, pl); + + out = feval(cl, plist('hostname', utpGetHostname, ... + 'database', utpGetDatabase, ... + 'username', utpGetUsername, ... + 'password', utpGetPassword, ... + 'id', ids)); + % + stest = true; + catch err + msg = err.message; + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % class name. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, cl) + msg = ['The last step in the history is not ''' cl '''']; + atest = false; + end + % Check data values + if ~eq(out,obj1, ple3) + msg = ['The values in the objects are not equal: ' lastwarn]; + atest = false; + end + % Check the history except the additional 'submit' + 'retrieve' steps + if ~eq(out.hist.inhists, obj1.hist) + msg = ['The history of the objects are not equal: ' lastwarn]; + atest = false; + end + + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename, msg); +end % END UTP_68 \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_69.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_69.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,59 @@ +% +% +% Tests that the copy method works with a single object as an input. +% +% +function result = utp_69(cl, n, m, ple) + + % + % + % Test the positive (copy-case) and the negative (non copy-case) case. + % + % + + try + % + tt1 = eval(sprintf('%s.initObjectWithSize(%d,%d)', cl, n, m)); + % non copy-case + out1 = copy(tt1, 0); + out1.setName('new name'); + + % copy-case + tt2 = eval(sprintf('%s.initObjectWithSize(%d,%d)', cl, n, m)); + out2 = copy(tt2, 1); + out2.setName('new name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a 'real' copy or only a copy of the handle + % + % + + atest = true; + if stest + % + % It must be a copy of the handle -> The changes to the output appears to + % the input + if ~eq(out1, tt1), atest = false; end + % This is a 'real' copy -> The changes to the output doesn't appear to + % the input + if eq(out2, tt2), atest = false; end + % The output must be the same as the other output except the changed + % property + if ~eq(out1, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_69 diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_70.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_70.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,59 @@ +% +% +% Tests that the constructor properly applies history to the +% plist() constructor. +% +% +function result = utp_70(cl, obj1, ple2) + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + % Store the object + filename = sprintf('%s.xml', cl); + save(obj1, filename); + + pl = plist('filename', filename); + out1 = feval(cl, plist('plist', pl)); + out2 = feval(cl, plist('plist', plist())); % empty plist + + rout1 = rebuild(out1); + rout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check that the constructor pass the inner plist to the same constructor + if ~eq(out1, obj1), atest = false; end + % The second output must be an empty object. + if ~eq(out2, feval(cl), ple2), atest = false; end + % Rebuild object and check the result + if ~eq(rout1, out1, ple2), atest = false; end + if ~eq(rout2, out2, ple2), atest = false; end + % + delete(filename); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_70 + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_901.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_901.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,66 @@ +% +% +% Tests that the model has a meaningful name. +% +% +% +% $Id: utp_901.m,v 1.3 2010/07/27 07:37:28 hewitson Exp $ +% + +function result = utp_901(cl, model_name, pl) + + % + % + % Test that the model has a meaningful name. + % + % + + try + + % + pl = combine(pl, plist('built-in', model_name)); + mdl = feval(cl, pl); + % + stest = true; + catch err + disp(err.message) + msg = [err.message ' - ' err.stack(1).name ' - line ' num2str(err.stack(1).line)]; + stest = false; + end + + % + % + % 1) Check that the name of the object is not empty and not equal to 'none' + % + % + + atest = true; + if stest + msg = ''; + % + % check the model produces an object of the correct class + if ~isa(mdl, cl) + atest = false; + msg = sprintf('The model produced by %s is not a %s model', model_name, cl); + end + % check the name + if strcmpi(mdl.name, 'none') + atest = false; + msg = sprintf('The model %s gives an object with the name ''none''', model_name); + end + % check empty + if isempty(mdl.name) + atest = false; + msg = sprintf('The model %s gives an object with an empty name', model_name); + end + + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename, msg); +end % END UTP_901 \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_902.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_902.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,57 @@ +% +% +% Tests that the model has a meaningful description. +% +% +% +% $Id: utp_902.m,v 1.3 2010/07/27 07:37:28 hewitson Exp $ +% + +function result = utp_902(cl, model_name, pl) + + % + % + % Test that the model has a meaningful description. + % + % + + try + + % + pl = combine(pl, plist('built-in', model_name)); + mdl = feval(cl, pl); + % + stest = true; + catch err + disp(err.message) + msg = [err.message ' - ' err.stack(1).name ' - line ' num2str(err.stack(1).line)]; + stest = false; + end + + % + % + % 1) Check that the description of the object is not empty and not equal to 'none' + % + % + + atest = true; + if stest + msg = ''; + % + % check we have an ssm model + if ~isa(mdl, 'ssm'), atest = false; end + % check description is not empty + if isempty(mdl.description) + atest = false; + end + + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename, msg); +end % END UTP_901 \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_903.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_903.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,123 @@ +% +% +% Tests that the model responds to 'DIM' configuration key. +% +% +% +% $Id: utp_903.m,v 1.4 2010/07/27 07:37:28 hewitson Exp $ +% + +function result = utp_903(cl, model_name, pl) + + % + % + % Test that the model responds to 'DIM' configuration key. + % + % + + try + + % + pl = combine(pl, plist('built-in', model_name, 'DIM', 1)); + mdl1 = feval(cl, pl); + pl.pset('DIM', 2) + mdl2 = feval(cl, pl); + pl.pset('DIM', 3) + mdl3 = feval(cl, pl); + % + stest = true; + catch err + disp(err.message) + msg = [err.message ' - ' err.stack(1).name ' - line ' num2str(err.stack(1).line)]; + stest = false; + end + + % + % + % 1) Check that the model builds with DIM==1 + % 2) Check that the model builds with DIM==2 + % 3) Check that the model builds with DIM==3 + % 4) Check that the 3 models are different + % + % + + atest = true; + if stest + msg = ''; + % + % check we have a model of the correct class + if ~isa(mdl1, cl) + atest = false; + msg = sprintf('The model produced by %s is not a %s model', model_name, cl); + end + if ~isa(mdl2, cl) + atest = false; + msg = sprintf('The model produced by %s is not a %s model', model_name, cl); + end + if ~isa(mdl3, cl) + atest = false; + msg = sprintf('The model produced by %s is not a %s model', model_name, cl); + end + + % check models are different by looking at the states + if ~isempty(mdl1.states) && ~isempty(mdl2.states) + if isequal(size(mdl1.states.ports), size(mdl2.states.ports)) + atest = false; + msg = sprintf('The model %s with DIM=1 and DIM=2 has the same number of states.', model_name); + end + end + if ~isempty(mdl1.states) && ~isempty(mdl3.states) + if isequal(size(mdl1.states.ports), size(mdl3.states.ports)) + atest = false; + msg = sprintf('The model %s with DIM=1 and DIM=3 has the same number of states.', model_name); + end + end + if ~isempty(mdl2.states) && ~isempty(mdl3.states) + if isequal(size(mdl2.states.ports), size(mdl3.states.ports)) + atest = false; + msg = sprintf('The model %s with DIM=2 and DIM=3 has the same number of states.', model_name); + end + end + + % check models are different by looking at the input sizes + if ~isempty(mdl1.inputsizes) && ~isempty(mdl2.inputsizes) + if isequal(mdl1.inputsizes, mdl2.inputsizes) + atest = false; + msg = sprintf('The model %s with DIM=1 and DIM=2 has the same input sizes.', model_name); + end + end + if ~isempty(mdl1.inputsizes) && ~isempty(mdl3.inputsizes) + if isequal(mdl1.inputsizes, mdl3.inputsizes) + atest = false; + msg = sprintf('The model %s with DIM=1 and DIM=3 has the same input sizes.', model_name); + end + end + if ~isempty(mdl2.inputsizes) && ~isempty(mdl3.inputsizes) + if isequal(mdl2.inputsizes, mdl3.inputsizes) + atest = false; + msg = sprintf('The model %s with DIM=2 and DIM=3 has the same input sizes.', model_name); + end + end + % check the history plist contains the correct value for 'DIM' + if mdl1.hist.plistUsed.find('DIM') ~= 1 + atest = false; + msg = sprintf('The model %s with DIM=1 has the wrong DIM value in the history.', model_name); + end + if mdl2.hist.plistUsed.find('DIM') ~= 2 + atest = false; + msg = sprintf('The model %s with DIM=2 has the wrong DIM value in the history.', model_name); + end + if mdl3.hist.plistUsed.find('DIM') ~= 3 + atest = false; + msg = sprintf('The model %s with DIM=3 has the wrong DIM value in the history.', model_name); + end + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename, msg); +end % END UTP_901 \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_920.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_920.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,68 @@ +% +% +% Test that bode works on this model. +% +% +% +% $Id: utp_920.m,v 1.2 2010/07/27 07:37:28 hewitson Exp $ +% + +function result = utp_920(cl, model_name, pl) + + % + % + % Test that bode works on this model. + % + % + + try + % + pl = combine(pl, plist('built-in', model_name)); + mdl = feval(cl, pl); + outs = bode(mdl); + % + stest = true; + catch err + disp(err.message) + msg = [err.message ' - ' err.stack(1).name ' - line ' num2str(err.stack(1).line)]; + stest = false; + end + + % + % + % 1) Test that bode produces the correct number of AOs. + % 2) Compare each output AO against validated outputs. + % + % + + atest = true; + if stest + msg = ''; + % + % Check the correct number of outputs + if numel(outs) ~= (sum(mdl.inputsizes) * sum(mdl.outputsizes)) + atest = false; + msg = sprintf('bode produced the wrong number of outputs for model %s', model_name); + end + + % Load references + refs = ao(sprintf('utps/%s/reference_files/ref_bode_%s.mat', cl, model_name)); + + for kk=1:numel(refs) + ref = refs(kk); + out = outs(kk); + if ~isequal(ref.y, out.y) + atest = false; + msg = sprintf('bode resp for %s element %d [%s] doesn''t match the reference', model_name, kk, out.name); + end + end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename, msg); + +end % END UTP_920 diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_genericAnyShape.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_genericAnyShape.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,71 @@ +% +% +% Tests that the method works with any shape of objects as input. +% +% +function result = utp_genericAnyShape(method, objs, args, algo) + + % + % + % Test that the method works for any shape of objects as input. + % + % + + try + % + if isempty(args) + out = feval(method, objs); + else + if iscell(args) + out = feval(method, objs, args{:}); + else + out = feval(method, objs, args); + end + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'objs' + % 2) Check that each output object contains the correct data. + % 3) Rebuild the object + % + % + + atest = true; + if stest + % + % 1. Check we have the correct number of outputs + if ~isequal(size(out), size(objs)), atest = false; end + + % 2. Check each output against the correct value + for kk=1:numel(out) + atest = algo(objs, out, kk, args); + if ~atest + break; + end + end + + % 3. Check that we can rebuild the data + r = out.rebuild(); + for ii = 1:numel(out) + if ~eq(r(ii),out(ii), 'UUID', 'proctime', 'methodInvars'), atest = false; end + end + + % + else + atest = false; + end + + % Return a result structure + stack = dbstack; + if numel(objs) > 1 + stack(1).name = sprintf('%s %dx%d', stack(1).name, size(objs)); + end + result = utp_prepare_result(atest, stest, stack, ['utp_' class(objs) '_' method]); +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_genericAnyShapeInternal.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_genericAnyShapeInternal.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,57 @@ +% +% +% Tests that the internal call of general setter method works with any +% shape of objects as input. +% +% +function result = utp_genericAnyShapeInternal(method, objs, values, algo) + + % + % + % Test that the internal call of a general setter method works with any + % shape of objects as input. + % + % + + try + % + out = testCallerIsMethod(str2func(method), objs, values); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'objs' + % 2) Check that each output object contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(objs)), atest = false; end + % Check each output against the correct value + for kk=1:numel(out) + atest = algo(objs, out, kk, values); + if ~atest + break; + end + end + + % + else + atest = false; + end + + % Return a result structure + stack = dbstack; + if numel(objs) > 1 + stack(1).name = sprintf('%s %dx%d', stack(1).name, size(objs)); + end + result = utp_prepare_result(atest, stest, stack, ['utp_' class(objs) '_' method]); +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_genericHistory.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_genericHistory.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,60 @@ +% +% +% Tests that the method properly applies history. +% +% +function result = utp_genericHistory(method, obj, args, ple) + + % + % + % Test that the result of applying the method can be processed + % back. + % + % + + try + % + if isempty(args) + out = feval(method, obj); + else + if iscell(args) + out = feval(method, obj, args{:}); + else + out = feval(method, obj, args); + end + end + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % ''. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, method), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, ['utp_' class(obj) '_' method]); +end + + + + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_genericList.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_genericList.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,63 @@ +% +% +% Tests that the method works for a list of objects as input. +% +% +function result = utp_genericList(method, obj1, obj2, obj3, args, algo) + + % + % + % Tests that the method works for a list of objects as input. + % + % + + try + % + if isempty(args) + out = feval(method, obj1, obj2, obj3); + else + if iscell(args) + out = feval(method, obj1, obj2, obj3, args{:}); + else + out = feval(method, obj1, obj2, obj3, args); + end + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'objs' + % 2) Check that each output object contains the correct data. + % + % + + atest = true; + objIn = [reshape(obj1, 1, []) reshape(obj2, 1, []) reshape(obj3, 1, [])]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(objIn)), atest = false; end + % Check each output against the correct value + for kk=1:numel(out) + + atest = algo(objIn, out, kk, args); + if ~atest + break; + end + + end + + % + else + atest = false; + end + + % Return a result structure + stack = dbstack; + result = utp_prepare_result(atest, stest, stack, ['utp_' class(obj1) '_' method]); +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_genericModify.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_genericModify.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,67 @@ +% +% +% Tests that the method can modify the input AO. +% +% +function result = utp_genericModify(method, obj, args, algo, ple) + + % + % + % Test that the method can modify the input object by calling + % with no output and that the method doesn't change the input of the + % function notation (with a equal sign). + % + % + + try + % + obj_modi = copy(obj,1); + obj_eq = copy(obj,1); + if iscell(args) + out = feval(method, obj_eq, args{:}); + feval(method, obj_modi, args{:}); + else + out = feval(method, obj_eq, args); + feval(method, obj_modi, args); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the modified input is changed by the method + % 2) Check that 'out' and 'obj_eq' are now different. + % 3) Check that 'obj_eq' is not changed + % 4) Check that out and amodi are the same + % + % + + atest = true; + if stest + % + % Check that obj_modi is changed + atest = algo(obj, obj_modi, 1, args); + % Check that 'out' and 'obj_eq' are now different. + if eq(out, obj_eq, ple), atest = false; end + % Check that 'obj_eq' is not changed + if ~eq(obj_eq, obj, ple), atest = false; end + % Check that out and obj_modi are the same + if ~eq(out, obj_modi, ple), atest = false; end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, ['utp_' class(obj) '_' method]); +end + + + + + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_genericOutput.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_genericOutput.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,66 @@ +% +% +% Check that the method pass back the output objects to a list of +% output variables or to a single variable. +% +% +function result = utp_genericOutput(method, obj1, obj2, args, algo, ple) + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + if iscell(args) + [o1, o2] = feval(method, obj1, obj2, args{:}); + o3 = feval(method, obj1, obj2, args{:}); + else + [o1, o2] = feval(method, obj1, obj2, args); + o3 = feval(method, obj1, obj2, args); + end + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the outputs + t1 = algo(obj1, o1, 1, args); + t2 = algo(obj2, o2, 1, args); + t3 = algo(obj1, o3(1), 1, args); + t4 = algo(obj2, o3(2), 1, args); + atest = t1 && t2 && t3 && t4; + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple), atest = false; end + if ~eq(o2, mout2, ple), atest = false; end + if ~eq(o3, mout3, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, ['utp_' class(obj1) '_' method]); +end % END UTP_10 diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_genericSet_minfo.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_genericSet_minfo.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,74 @@ +% UTP_GENERICSET_MINFO a set of UTPs for a general setter method +% +% M Hewitson 06-08-08 +% +% $Id: utp_genericSet_minfo.m,v 1.1 2010/02/08 19:26:41 ingo Exp $ +% + +% +% +% Tests that the getInfo call works for this a general setter method. +% +% + +function result = utp_genericSet_minfo(method, objs, prop, algoTests) + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class(objs) '.getInfo(''' method ''', ''None'')']); + % Call for all sets + io(2) = eval([class(objs) '.getInfo(''' method ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class(objs) '.getInfo(''' method ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams < 1, atest = false; end + % Check key + if ~io(3).plists.isparam(prop), atest = false; end + % Check default value + if ~algoTests(io(3).plists.find(prop)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, ['utp_' class(objs) '_' method]); +end + + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_generic_aop_core.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_generic_aop_core.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,68 @@ +% +% +% Tests that the arithmetic operator method works with two inputs. +% +% +% +% $Id: utp_generic_aop_core.m,v 1.4 2011/04/27 08:55:35 hewitson Exp $ +% + +function result = utp_generic_aop_core(fcn, ruleName, dataDescription, a, b, checkFcns) + + % + % + % Tests that the arithmetic operator method works with two inputs. + % + % + + try + % + o = fcn(a,b); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that all input function handles pass + % + % + + atest = true; + msg = ''; + if stest + try + % + for ii=1:numel(checkFcns) + checkFcn = checkFcns{ii}; + atest = checkFcn(fcn, a, b, o); + if atest == 0 + msg = func2str(checkFcn); + break; + end + end + % + catch err + disp(err.message) + msg = func2str(checkFcn); + atest = false; + end + else + atest = false; + end + + % Return a result structure + dbs = dbstack; + aCl = class(a(1).data); + bCl = class(b(1).data); + % drop this core function from the stack - it's not useful + dbs(1) = []; + + % Add the data description so we can parse it out later + dbs(1).name = [dbs(1).name sprintf('(%s)', dataDescription)]; + result = utp_prepare_result(atest, stest, dbs, mfilename, msg); +end + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_generic_aop_negative_core.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_generic_aop_negative_core.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,51 @@ +% +% +% Tests that the arithmetic operator method doesn't work with this two +% inputs. The test pass if the function throw an error. +% +% +% +% $Id: utp_generic_aop_negative_core.m,v 1.2 2011/04/27 13:38:07 hewitson Exp $ +% + +function result = utp_generic_aop_negative_core(fcn, ruleName, dataDescription, a, b) + + % + % + % tests that the arithmetic operator method doesn't work with this two + % inputs. the test pass if the function throw an error. + % + % + + try + % + o = fcn(a,b); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Not necessary + % + % + + atest = true; + if ~stest + atest = false; + end + + % Return a result structure + dbs = dbstack; + aCl = class(a(1).data); + bCl = class(b(1).data); + % drop this core function from the stack - it's not useful + dbs(1) = []; + + % Add the data description so we can parse it out later + dbs(1).name = [dbs(1).name sprintf('(%s)', dataDescription)]; + result = utp_prepare_result(atest, stest, dbs, mfilename); +end + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_generic_aop_negative_tests.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_generic_aop_negative_tests.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,132 @@ + +% +% +% Tests all arithmetic operations which are not allowed. +% +% +function result = utp_generic_aop_negative_tests(fcn) + + % + % + % Tests all arithmetic operations which are not allowed. + % + % + + % Test AOs + % tsdata + n = 12; + fs = 12.1; + x = 0:(1/fs):(n/fs)-1/fs; + a_ts = ao(x,randn(n,1), fs); + a_ts.setDx(ones(n,1)*1.1); + a_ts.setDy((1:n)*2.2); + a_ts.setYunits('Hz^(-1/2) V^2'); + a_ts.setName(); + + b_ts = ao(x,randn(n,1), fs); + b_ts.setDx(7); + b_ts.setDy(9); + b_ts.setYunits('Hz^(-1/2) V^2'); + b_ts.setName(); + + % fsdata + a_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + a_fs.setDx(ones(n,1)*1.1); + a_fs.setDy((1:n)*2.2); + a_fs.setName(); + + b_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + b_fs.setDx(7); + b_fs.setDy(9); + b_fs.setName(); + + % xydata + a_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + a_xy.setDx(ones(n,1)*1.1); + a_xy.setDy((1:n)*2.2); + a_xy.setYunits('Hz^(-1/2) V^2'); + a_xy.setName(); + + b_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + b_xy.setDx(7); + b_xy.setDy(9); + b_xy.setName(); + + % cdata + a_c = ao(8); + a_c.setDy(2); + a_c.setName(); + + b_c = ao(111:122); + b_c.setDy((111:122)/100); + b_c.setName(); + + % Define check functions + + result = []; + + % + % + % Here we test some negative cases. + % + % + + + % + % tsdata <-> fsdata + result = [result utp_generic_aop_negative_core(fcn, 'negative test', 'fsdata and tsdata', a_fs, b_ts)]; + result = [result utp_generic_aop_negative_core(fcn, 'negative test', 'tsdata and fsdata', a_ts, b_fs)]; + + % AO with no data field + result = [result utp_generic_aop_negative_core(fcn, 'negative test', 'AO no data and tsdata', [a_ts, ao(), b_ts], b_ts)]; + result = [result utp_generic_aop_negative_core(fcn, 'negative test', 'tsdata and AO no data', b_ts, [a_ts, ao(), b_ts])]; + +% % fsdata wrong fs +% a = a_fs.setFs(8); +% b = b_fs.setFs(9); +% result = [result utp_generic_aop_negative_core(fcn, 'negative test', a, b)]; + + % tsdata wrong fs + a = a_ts.setFs(8); + b = b_ts.setFs(9); + result = [result utp_generic_aop_negative_core(fcn, 'negative test', 'different fs in tsdata', a, b)]; + + % plus, minus wrong x-units + if any(strcmpi(func2str(fcn), {'plus', 'minus'})) + a = a_ts.setXunits('m'); + b = b_ts.setXunits('Hz'); + result = [result utp_generic_aop_negative_core(fcn, 'negative test', 'different x units in tsdata', a, b)]; + end + + % fsdata wrong x-base + a = a_fs.setX(1:12); + b = b_fs.setX(2:13); + result = [result utp_generic_aop_negative_core(fcn, 'negative test', 'different x values in fsdata', a, b)]; + % + + % only one input + try + o = fcn(a_ts); + stest = false; + catch + stest = true; + end + dbs = dbstack; + dbs(1).name = sprintf('%s(negative test)', mfilename); + result = [result utp_prepare_result(stest, stest, dbs, mfilename)]; + + % modifier call + try + fcn(a_ts); + stest = false; + catch + stest = true; + end + dbs = dbstack; + dbs(1).name = sprintf('%s(negative test)', mfilename); + result = [result utp_prepare_result(stest, stest, dbs, mfilename)]; + +end % END UTP_negative_tests + + + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_generic_aop_rule1.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_generic_aop_rule1.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,144 @@ + +% +% +% Tests the arithmetic operators rule 1. +% +% +function result = utp_generic_aop_rule1(fcn) + + % + % + % Tests the arithmetic operators rule 1 for each data type: xydata, + % fsdata, tsdata, cdata and useful combinations. + % + % + + % Test AOs + % tsdata + n = 12; + fs = 12.1; + x = 0:(1/fs):(n/fs)-1/fs; + a_ts = ao(x, randn(n,1), fs); + a_ts.setDx(ones(n,1)*1.1); + a_ts.setDy((1:n)*2.2); + a_ts.setYunits('Hz^(-1/2) V^2'); + a_ts.setName(); + + b_ts = ao(x,randn(n,1), fs); + b_ts.setDx(7); + b_ts.setDy(9); + b_ts.setYunits('Hz^(-1/2) V^2'); + b_ts.setName(); + + % fsdata + a_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + a_fs.setDx(ones(n,1)*1.1); + a_fs.setDy((1:n)*2.2); + a_fs.setName(); + + b_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + b_fs.setDx(7); + b_fs.setDy(9); + b_fs.setName(); + + % xydata + a_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + a_xy.setDx(ones(n,1)*1.1); + a_xy.setDy((1:n)*2.2); + a_xy.setYunits('Hz^(-1/2) V^2'); + a_xy.setName(); + + b_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + b_xy.setDx(7); + b_xy.setDy(9); + b_xy.setName(); + + % cdata + a_c = ao(8); + a_c.setDy(2); + a_c.setName(); + + b_c = ao(111:122); + b_c.setDy((111:122)/100); + b_c.setName(); + + % Define check functions + checkFcns = {... + @checkDataObjectRule1, ... + @checkValuesRule1, ... + @checkErrorsRule1, ... + @checkUnitsRule1, ... + @check_aop_history}; + + % + % + % Here we test element-wise operator rule1 as in S2-AEI-TN-3059. + % + % 1) Check the data type of the resulting object. + % 2) Check the resulting object contains the correct values. + % 3) Check the error propagation. + % 4) Check the units of the output object. + % 5) Check the resulting object can be rebuilt. + % + % + + + % + result = []; + result = [result utp_generic_aop_core(fcn, 'rule1', 'tsdata and tsdata', a_ts, b_ts, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule1', 'fsdata and fsdata', a_fs, b_fs, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule1', 'xydata and xydata', a_xy, b_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule1', 'cdata and cdata', a_c, b_c, checkFcns)]; + + % tsdata + (xydata or cdata) + result = [result utp_generic_aop_core(fcn, 'rule1', 'tsdata and cdata', b_ts, b_c, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule1', 'tsdata and xydata', b_ts, a_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule1', 'cdata and tsdata', a_c, b_ts, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule1', 'xydata and tsdata', b_xy, a_ts, checkFcns)]; + + % fsdata + (xydata or cdata) + result = [result utp_generic_aop_core(fcn, 'rule1', 'fsdata and cdata', b_fs, b_c, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule1', 'fsdata and xydata', b_fs, a_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule1', 'cdata and fsdata', a_c, b_fs, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule1', 'xydata and fsdata', b_xy, a_fs, checkFcns)]; + + % xydata + cdata + result = [result utp_generic_aop_core(fcn, 'rule1', 'xydata and cdata', b_xy, a_c, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule1', 'cdata and xydata', b_c, a_xy, checkFcns)]; + % + +end % END UTP_rule1 + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Define here the checking functions % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%% Data object test %%%%%%%%%% +function atest = checkDataObjectRule1(fcn, in1, in2, out) + atest = check_aop_data_object(fcn, in1, in2, out); +end + +%%%%%%%%%% Value test %%%%%%%%%% +function atest = checkValuesRule1(fcn, in1, in2, out) + atest = true; + if ~isequal(fcn(in1.data.getY, in2.data.getY), out.data.getY) + atest = false; + end +end + +%%%%%%%%%% Errors test %%%%%%%%%% +function atest = checkErrorsRule1(fcn, in1, in2, out) + atest = check_aop_errors(fcn, in1, in2, out); +end + +%%%%%%%%%% Units test %%%%%%%%%% +function atest = checkUnitsRule1(fcn, in1, in2, out) + atest = check_aop_units(fcn, in1, in2, out); +end + + + + + + + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_generic_aop_rule10.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_generic_aop_rule10.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,181 @@ + +% +% +% Tests the arithmetic operators rule 10. +% +% +function result = utp_generic_aop_rule10(fcn) + + % + % + % Tests the arithmetic operators rule 10 for each data type: xydata, + % fsdata, tsdata, cdata and useful combinations. + % + % + + % Test AOs + % tsdata + n = 12; + fs = 12.1; + x = 0:(1/fs):(n/fs)-1/fs; + a_ts = ao(x,randn(n,1), fs); + a_ts.setDx(ones(n,1)*1.1); + a_ts.setDy((1:n)*2.2); + a_ts.setYunits('Hz^(-1/2) V^2'); + a_ts.setName(); + + b_ts = ao(x,randn(n,1), fs); + b_ts.setDx(7); + b_ts.setDy(9); + b_ts.setYunits('Hz^(-1/2) V^2'); + b_ts.setName(); + + M_NP_ts = [copy(a_ts, 1), copy(a_ts, 1), copy(b_ts, 1); copy(b_ts, 1), copy(a_ts, 1), copy(a_ts, 1)]; + H_NP_ts = [copy(b_ts, 1), copy(a_ts, 1), copy(a_ts, 1); copy(b_ts, 1), copy(b_ts, 1), copy(a_ts, 1)]; + + % fsdata + a_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + a_fs.setDx(ones(n,1)*1.1); + a_fs.setDy((1:n)*2.2); + a_fs.setName(); + + b_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + b_fs.setDx(7); + b_fs.setDy(9); + b_fs.setName(); + + M_NP_fs = [copy(a_fs, 1), copy(a_fs, 1), copy(b_fs, 1); copy(b_fs, 1), copy(a_fs, 1), copy(a_fs, 1)]; + H_NP_fs = [copy(b_fs, 1), copy(a_fs, 1), copy(a_fs, 1); copy(b_fs, 1), copy(b_fs, 1), copy(a_fs, 1)]; + + % xydata + a_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + a_xy.setDx(ones(n,1)*1.1); + a_xy.setDy((1:n)*2.2); + a_xy.setYunits('Hz^(-1/2) V^2'); + a_xy.setName(); + + b_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + b_xy.setDx(7); + b_xy.setDy(9); + b_xy.setName(); + + M_NP_xy = [copy(a_xy, 1), copy(a_xy, 1), copy(b_xy, 1); copy(b_xy, 1), copy(a_xy, 1), copy(a_xy, 1)]; + H_NP_xy = [copy(b_xy, 1), copy(a_xy, 1), copy(a_xy, 1); copy(b_xy, 1), copy(b_xy, 1), copy(a_xy, 1)]; + + % cdata + a_c = ao(8); + a_c.setDy(2); + a_c.setName(); + + b_c = ao(111:122); + b_c.setDy((111:122)/100); + b_c.setName(); + + M_NP_c = [copy(a_c, 1), copy(a_c, 1), copy(b_c, 1); copy(b_c, 1), copy(a_c, 1), copy(a_c, 1)]; + H_NP_c = [copy(b_c, 1), copy(a_c, 1), copy(a_c, 1); copy(b_c, 1), copy(b_c, 1), copy(a_c, 1)]; + + % Define check functions + checkFcns = {... + @checkDataObjectRule10, ... + @checkValuesRule10, ... + @checkErrorsRule10, ... + @checkUnitsRule10, ... + @check_aop_history}; + + result = []; + + % + % + % Here we test element-wise operator rule10 as in S2-AEI-TN-3059. + % + % 1) Check the data type of the resulting object. + % 2) Check the resulting object contains the correct values. + % 3) Check the error propagation. + % 4) Check the units of the output object. + % 5) Check the resulting object can be rebuilt. + % + % + + + % + % tsdata + result = [result utp_generic_aop_core(fcn, 'rule10', 'NxP tsdata and NxP tsdata', M_NP_ts, H_NP_ts, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule10', 'NxP tsdata and NxP tsdata', H_NP_ts, M_NP_ts, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule10', 'NxP tsdata and NxP xydata', M_NP_ts, H_NP_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule10', 'NxP xydata and NxP tsdata', H_NP_xy, M_NP_ts, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule10', 'NxP tsdata and NxP cdata', M_NP_ts, H_NP_c, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule10', 'NxP cdata and NxP tsdata', H_NP_c, M_NP_ts, checkFcns)]; + + % fsdata + result = [result utp_generic_aop_core(fcn, 'rule10', 'NxP fsdata and NxP fsdata', M_NP_fs, H_NP_fs, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule10', 'NxP fsdata and NxP fsdata', H_NP_fs, M_NP_fs, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule10', 'NxP fsdata and NxP xydata', M_NP_fs, H_NP_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule10', 'NxP xydata and NxP fsdata', H_NP_xy, M_NP_fs, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule10', 'NxP fsdata and NxP cdata', M_NP_fs, H_NP_c, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule10', 'NxP cdata and NxP fsdata', H_NP_c, M_NP_fs, checkFcns)]; + + % xydata + result = [result utp_generic_aop_core(fcn, 'rule10', 'NxP xydata and NxP xydata', M_NP_xy, H_NP_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule10', 'NxP xydata and NxP xydata', H_NP_xy, M_NP_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule10', 'NxP xydata and NxP cdata', M_NP_xy, H_NP_c, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule10', 'NxP cdata and NxP xydata', H_NP_c, M_NP_xy, checkFcns)]; + + % cdata + result = [result utp_generic_aop_core(fcn, 'rule10', 'NxP cdata and NxP cdata', M_NP_c, H_NP_c, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule10', 'NxP cdata and NxP cdata', H_NP_c, M_NP_c, checkFcns)]; + % + +end % END UTP_rule10 + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Define here the checking functions % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%% Data object test %%%%%%%%%% +function atest = checkDataObjectRule10(fcn, in1, in2, out) + + for ii = 1:size(in1,1) + atest = check_aop_data_object(fcn, in1(ii), in2(ii), out(ii)); + if atest == 0 + break; + end + end +end + +%%%%%%%%%% Value test %%%%%%%%%% +function atest = checkValuesRule10(fcn, in1, in2, out) + + atest = true; + for ii = 1:size(in1,1) + if ~isequal(fcn(in1(ii).data.getY, in2(ii).data.getY), out(ii).data.getY) + atest = false; + break; + end + end +end + +%%%%%%%%%% Errors test %%%%%%%%%% +function atest = checkErrorsRule10(fcn, in1, in2, out) + + atest = true; + for ii = 1:size(in1,1) + atest = check_aop_errors(fcn, in1(ii), in2(ii), out(ii)); + if atest == 0 + break; + end + end +end + +%%%%%%%%%% Units test %%%%%%%%%% +function atest = checkUnitsRule10(fcn, in1, in2, out) + + atest = true; + for ii = 1:size(in1,1) + atest = check_aop_units(fcn, in1(ii), in2(ii), out(ii)); + if atest == 0 + break; + end + end +end + + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_generic_aop_rule11.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_generic_aop_rule11.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,170 @@ + +% +% +% Tests the arithmetic operators rule 11. +% +% +function result = utp_generic_aop_rule11(fcn) + + % + % + % Tests the arithmetic operators rule 11 for each data type: xydata, + % fsdata, tsdata, cdata and useful combinations. + % + % + + % Test AOs + % tsdata + n = 12; + fs = 12.1; + x = 0:(1/fs):(n/fs)-1/fs; + a_ts = ao(x,randn(n,1), fs); + a_ts.setDx(ones(n,1)*1.1); + a_ts.setDy((1:n)*2.2); + a_ts.setYunits('Hz^(-1/2) V^2'); + a_ts.setName(); + + b_ts = ao(x,randn(n,1), fs); + b_ts.setDx(7); + b_ts.setDy(9); + b_ts.setYunits('Hz^(-1/2) V^2'); + b_ts.setName(); + + c_ts = ao(x,randn(n,1), fs); + c_ts.setDx(7); + c_ts.setDy(9); + c_ts.setYunits('Hz^(-1/2) V^2'); + c_ts.setName(); + + V_N_ts = [copy(a_ts, 1), copy(b_ts, 1), copy(c_ts, 1)]; + + % fsdata + a_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + a_fs.setDx(ones(n,1)*1.1); + a_fs.setDy((1:n)*2.2); + a_fs.setName(); + + b_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + b_fs.setDx(7); + b_fs.setDy(9); + b_fs.setName(); + + c_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + c_fs.setDx(ones(n,1)*1.1); + c_fs.setDy((1:n)*2.2); + c_fs.setName(); + + V_N_fs = [copy(a_fs, 1), copy(b_fs, 1), copy(c_fs, 1)]; + + % xydata + a_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + a_xy.setDx(ones(n,1)*1.1); + a_xy.setDy((1:n)*2.2); + a_xy.setYunits('Hz^(-1/2) V^2'); + a_xy.setName(); + + b_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + b_xy.setDx(7); + b_xy.setDy(9); + b_xy.setName(); + + c_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + c_xy.setDx(ones(n,1)*1.1); + c_xy.setDy((1:n)*2.2); + c_xy.setYunits('Hz^(-1/2) V^2'); + c_xy.setName(); + + V_N_xy = [copy(a_xy, 1), copy(b_xy, 1), copy(c_xy, 1)]; + + % cdata + a_c = ao(8); + a_c.setDy(2); + a_c.setName(); + + b_c = ao(111:122); + b_c.setDy((111:122)/100); + b_c.setName(); + + c_c = ao(111:122); + c_c.setDy((111:122)/100); + c_c.setName(); + + V_N_c = [copy(a_c, 1), copy(b_c, 1), copy(c_c, 1)]; + + % + % + % Tests that for more than two inputs the result will be as if the + % commands are nested. For example: plus(a, b, c) == plus(plus(a, b), c) + % + % + + try + % + %tsdata + o_ts1 = fcn(a_ts, b_ts, c_ts); + o_ts2 = fcn(fcn(a_ts, b_ts), c_ts); + o_ts3 = fcn(a_ts, V_N_ts, c_ts); + o_ts4 = fcn(fcn(a_ts, V_N_ts), c_ts); + + %fsdata + o_fs1 = fcn(a_fs, b_fs, c_fs); + o_fs2 = fcn(fcn(a_fs, b_fs), c_fs); + o_fs3 = fcn(a_fs, V_N_fs, c_fs); + o_fs4 = fcn(fcn(a_fs, V_N_fs), c_fs); + + %xydata + o_xy1 = fcn(a_xy, b_xy, c_xy); + o_xy2 = fcn(fcn(a_xy, b_xy), c_xy); + o_xy3 = fcn(a_xy, V_N_xy, c_xy); + o_xy4 = fcn(fcn(a_xy, V_N_xy), c_xy); + + %cdata + o_c1 = fcn(a_c, b_c, c_c); + o_c2 = fcn(fcn(a_c, b_c), c_c); + o_c3 = fcn(a_c, V_N_c, c_c); + o_c4 = fcn(fcn(a_c, V_N_c), c_c); + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that for more than two inputs the result will be as if the + % commands are nested. + % + % + + atest = true; + if stest + try + ple = plist('Exceptions', {'created', 'proctime', 'UUID'}); + % + if ~eq(o_ts1, o_ts2, ple), atest = false; end + if ~eq(o_ts3, o_ts4, ple), atest = false; end + if ~eq(o_fs1, o_fs2, ple), atest = false; end + if ~eq(o_fs3, o_fs4, ple), atest = false; end + if ~eq(o_xy1, o_xy2, ple), atest = false; end + if ~eq(o_xy3, o_xy4, ple), atest = false; end + if ~eq(o_c1, o_c2, ple), atest = false; end + if ~eq(o_c3, o_c4, ple), atest = false; end + % + catch err + disp(err.message) + atest = false; + end + else + atest = false; + end + + % Return a result structure + dbs = dbstack; + % dbs(1).name = sprintf('%s/%s (%s/%s)', func2str(fcn), ruleName, aCl(1:end-4), bCl(1:end-4)); + dbs(1).name = sprintf('%s/rule11', func2str(fcn)); + result = utp_prepare_result(atest, stest, dbs, mfilename); + +end % END UTP_rule11 + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_generic_aop_rule2.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_generic_aop_rule2.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,203 @@ + +% +% +% Tests the arithmetic operators rule 2. +% +% +function result = utp_generic_aop_rule2(fcn) + + % + % + % Tests the arithmetic operators rule 2 for each data type: xydata, + % fsdata, tsdata, cdata and useful combinations. + % + % + + % Test AOs + % tsdata +% a_ts = ao(1:12,randn(12,1), 12.1); +% a_ts.setDx(ones(12,1)*1.1); +% a_ts.setDy((1:12)*2.2); +% a_ts.setYunits('Hz^(-1/2) V^2'); +% a_ts.setName(); +% +% b_ts = ao(1:12,randn(12,1), 12.1); +% b_ts.setDx(7); +% b_ts.setDy(9); +% b_ts.setYunits('Hz^(-1/2) V^2'); +% b_ts.setName(); + + n = 12; + fs = 12.1; + x = 0:(1/fs):(n/fs)-1/fs; + a_ts = ao(x, ones(n,1), fs); + a_ts.setName(); + + b_ts = ao(x, ones(n,1)*5, fs); + b_ts.setName(); + + c_ts = ao(x, ones(n,1)*13, fs); + c_ts.setName(); + + V_N_ts = [copy(a_ts, 1), copy(b_ts, 1), copy(c_ts, 1)]; + V_M_ts = [copy(a_ts, 1), copy(b_ts, 1), copy(a_ts, 1), copy(b_ts, 1)]; + + % fsdata + a_fs = ao(plist('xvals', 1:12, 'yvals', abs(randn(12,1)), 'type', 'fsdata')); + a_fs.setDx(ones(12,1)*1.1); + a_fs.setDy((1:12)*2.2); + a_fs.setName(); + + b_fs = ao(plist('xvals', 1:12, 'yvals', abs(randn(12,1)), 'type', 'fsdata')); + b_fs.setDx(7); + b_fs.setDy(9); + b_fs.setName(); + + V_N_fs = [copy(a_fs, 1), copy(a_fs, 1), copy(b_fs, 1)]; + V_M_fs = [copy(a_fs, 1), copy(b_fs, 1), copy(a_fs, 1), copy(b_fs, 1)]; + + % xydata + a_xy = ao(plist('xvals', 1:12, 'yvals', abs(randn(12,1)), 'type', 'xydata')); + a_xy.setDx(ones(12,1)*1.1); + a_xy.setDy((1:12)*2.2); + a_xy.setYunits('Hz^(-1/2) V^2'); + a_xy.setName(); + + b_xy = ao(plist('xvals', 1:12, 'yvals', abs(randn(12,1)), 'type', 'xydata')); + b_xy.setDx(7); + b_xy.setDy(9); + b_xy.setName(); + + V_N_xy = [copy(a_xy, 1), copy(a_xy, 1), copy(b_xy, 1)]; + V_M_xy = [copy(a_xy, 1), copy(b_xy, 1), copy(a_xy, 1), copy(b_xy, 1)]; + + % cdata + a_c = ao(8); + a_c.setDy(2); + a_c.setName(); + + b_c = ao(111:122); + b_c.setDy((111:122)/100); + b_c.setName(); + + V_M_c = [copy(a_c, 1), copy(b_c, 1), copy(a_c, 1), copy(b_c, 1)]; + + % Define check functions + checkFcns = {... + @checkDataObjectRule2, ... + @checkValuesRule2, ... + @checkErrorsRule2, ... + @checkUnitsRule2, ... + @check_aop_history}; + + result = []; + + % + % + % Here we test element-wise operator rule2 as in S2-AEI-TN-3059. + % + % 1) Check the data type of the resulting object. + % 2) Check the resulting object contains the correct values. + % 3) Check the error propagation. + % 4) Check the units of the output object. + % 5) Check the resulting object can be rebuilt. + % + % + + + % + % tsdata + result = [result utp_generic_aop_core(fcn, 'rule2', 'single tsdata and vector tsdata', b_ts, V_N_ts, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule2', 'vector tsdata and single tsdata', V_M_ts, a_ts, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule2', 'single xydata and vector tsdata', b_xy, V_N_ts, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule2', 'vector tsdata and single xydata', V_M_ts, a_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule2', 'single cdata and vector tsdata', b_c, V_N_ts, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule2', 'vector tsdata and single cdata', V_M_ts, a_c, checkFcns)]; + + % fsdata + result = [result utp_generic_aop_core(fcn, 'rule2', 'single fsdata and vector fsdata', b_fs, V_N_fs, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule2', 'vector fsdata and single fsdata', V_M_fs, a_fs, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule2', 'single xydata and vector fsdata', b_xy, V_N_fs, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule2', 'vector fsdata and single xydata', V_M_fs, a_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule2', 'single cdata and vector fsdata', b_c, V_N_fs, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule2', 'vector fsdata and single cdata', V_M_fs, a_c, checkFcns)]; + + % xydata + result = [result utp_generic_aop_core(fcn, 'rule2', 'single xydata and vector xydata', b_xy, V_N_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule2', 'vector xydata and single xydata', V_M_xy, a_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule2', 'single cdata and vector xydata', b_c, V_N_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule2', 'vector xydata and single cdata', V_M_xy, a_c, checkFcns)]; + + % cdata + result = [result utp_generic_aop_core(fcn, 'rule2', 'vector cdata and single cdata', V_M_c, a_c, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule2', 'single cdata and vector cdata', b_c, V_M_c, checkFcns)]; + % + +end % END UTP_rule2 + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Define here the checking functions % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%% Data object test %%%%%%%%%% +function atest = checkDataObjectRule2(fcn, in1, in2, out) + + for ii = 1:max(numel(in1), numel(in2)) + if numel(in1) > numel(in2) + atest = check_aop_data_object(fcn, in1(ii), in2, out(ii)); + else + atest = check_aop_data_object(fcn, in1, in2(ii), out(ii)); + end + if atest == 0 + break; + end + end +end + +%%%%%%%%%% Value test %%%%%%%%%% +function atest = checkValuesRule2(fcn, in1, in2, out) + + atest = true; + for ii = 1:max(numel(in1), numel(in2)) + if numel(in1) > numel(in2) + if ~isequal(fcn(in1(ii).data.getY, in2.data.getY), out(ii).data.getY), atest = false; end + else + if ~isequal(fcn(in1.data.getY, in2(ii).data.getY), out(ii).data.getY), atest = false; end + end + if atest == 0 + break; + end + end +end + +%%%%%%%%%% Errors test %%%%%%%%%% +function atest = checkErrorsRule2(fcn, in1, in2, out) + + atest = true; + for ii = 1:max(numel(in1), numel(in2)) + if numel(in1) > numel(in2) + atest = check_aop_errors(fcn, in1(ii), in2, out(ii)); + else + atest = check_aop_errors(fcn, in1, in2(ii), out(ii)); + end + if atest == 0 + break; + end + end +end + +%%%%%%%%%% Units test %%%%%%%%%% +function atest = checkUnitsRule2(fcn, in1, in2, out) + + atest = true; + for ii = 1:max(numel(in1), numel(in2)) + if numel(in1) > numel(in2) + atest = check_aop_units(fcn, in1(ii), in2, out(ii)); + else + atest = check_aop_units(fcn, in1, in2(ii), out(ii)); + end + if atest == 0 + break; + end + end +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_generic_aop_rule3.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_generic_aop_rule3.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,125 @@ + +% +% +% Tests the arithmetic operators rule 3. +% +% +function result = utp_generic_aop_rule3(fcn) + + % + % + % Tests the arithmetic operators rule 3 for each data type: xydata, + % fsdata, tsdata, cdata and useful combinations. + % + % + + % Test AOs + % tsdata + n = 12; + fs = 12.1; + x = 0:(1/fs):(n/fs)-1/fs; + a_ts = ao(x,randn(n,1), fs); + a_ts.setDx(ones(n,1)*1.1); + a_ts.setDy((1:n)*2.2); + a_ts.setYunits('Hz^(-1/2) V^2'); + a_ts.setName(); + + b_ts = ao(x,randn(n,1), fs); + b_ts.setDx(7); + b_ts.setDy(9); + b_ts.setYunits('Hz^(-1/2) V^2'); + b_ts.setName(); + + V_N_ts = [copy(a_ts, 1), copy(a_ts, 1), copy(b_ts, 1)]; + V_M_ts = [copy(a_ts, 1), copy(b_ts, 1), copy(a_ts, 1), copy(b_ts, 1)]; + + % fsdata + a_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + a_fs.setDx(ones(n,1)*1.1); + a_fs.setDy((1:n)*2.2); + a_fs.setName(); + + b_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + b_fs.setDx(7); + b_fs.setDy(9); + b_fs.setName(); + + V_N_fs = [copy(a_fs, 1), copy(a_fs, 1), copy(b_fs, 1)]; + V_M_fs = [copy(a_fs, 1), copy(b_fs, 1), copy(a_fs, 1), copy(b_fs, 1)]; + + % xydata + a_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + a_xy.setDx(ones(n,1)*1.1); + a_xy.setDy((1:n)*2.2); + a_xy.setYunits('Hz^(-1/2) V^2'); + a_xy.setName(); + + b_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + b_xy.setDx(7); + b_xy.setDy(9); + b_xy.setName(); + + V_N_xy = [copy(a_xy, 1), copy(a_xy, 1), copy(b_xy, 1)]; + V_M_xy = [copy(a_xy, 1), copy(b_xy, 1), copy(a_xy, 1), copy(b_xy, 1)]; + + % cdata + a_c = ao(8); + a_c.setDy(2); + a_c.setName(); + + b_c = ao(111:122); + b_c.setDy((111:122)/100); + b_c.setName(); + + V_N_c = [copy(a_c, 1), copy(a_c, 1), copy(b_c, 1)]; + V_M_c = [copy(a_c, 1), copy(b_c, 1), copy(a_c, 1), copy(b_c, 1)]; + + % Define check functions + + result = []; + + % + % + % Here we test element-wise operator rule3 as in S2-AEI-TN-3059. + % + % 1) Check the data type of the resulting object. + % 2) Check the resulting object contains the correct values. + % 3) Check the error propagation. + % 4) Check the units of the output object. + % 5) Check the resulting object can be rebuilt. + % + % + + + % + % tsdata + result = [result utp_generic_aop_negative_core(fcn, 'rule3', 'vector tsdata and vector tsdata', V_M_ts, V_N_ts)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule3', 'vector tsdata and vector tsdata', V_N_ts, V_M_ts)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule3', 'vector tsdata and vector xydata', V_N_ts, V_M_xy)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule3', 'vector xydata and vector tsdata', V_N_xy, V_M_ts)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule3', 'vector tsdata and vector cdata', V_N_ts, V_M_c)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule3', 'vector cdata and vector tsdata', V_N_c, V_M_ts)]; + + % fsdata + result = [result utp_generic_aop_negative_core(fcn, 'rule3', 'vector fsdata and vector fsdata', V_M_fs, V_N_fs)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule3', 'vector fsdata and vector fsdata', V_N_fs, V_M_fs)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule3', 'vector fsdata and vector xydata', V_N_fs, V_M_xy)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule3', 'vector xydata and vector fsdata', V_N_xy, V_M_fs)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule3', 'vector fsdata and vector cdata', V_N_fs, V_M_c)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule3', 'vector cdata and vector fsdata', V_N_c, V_M_fs)]; + + % xydata + result = [result utp_generic_aop_negative_core(fcn, 'rule3', 'vector xydata and vector xydata', V_M_xy, V_N_xy)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule3', 'vector xydata and vector xydata', V_N_xy, V_M_xy)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule3', 'vector xydata and vector cdata', V_N_xy, V_M_c)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule3', 'vector cdata and vector xydata', V_N_c, V_M_xy)]; + + % cdata + result = [result utp_generic_aop_negative_core(fcn, 'rule3', 'vector cdata and vector cdata', V_M_c, V_N_c)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule3', 'vector cdata and vector cdata', V_N_c, V_M_c)]; + % + +end % END UTP_rule3 + + + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_generic_aop_rule4.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_generic_aop_rule4.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,189 @@ + +% +% +% Tests the arithmetic operators rule 4. +% +% +function result = utp_generic_aop_rule4(fcn) + + % + % + % Tests the arithmetic operators rule 4 for each data type: xydata, + % fsdata, tsdata, cdata and useful combinations. + % + % + + % Test AOs + % tsdata + n = 12; + fs = 12.1; + x = 0:(1/fs):(n/fs)-1/fs; + a_ts = ao(x,randn(n,1), fs); + a_ts.setDx(ones(n,1)*1.1); + a_ts.setDy((1:n)*2.2); + a_ts.setYunits('Hz^(-1/2) V^2'); + a_ts.setName(); + + b_ts = ao(x,randn(n,1), fs); + b_ts.setDx(7); + b_ts.setDy(9); + b_ts.setYunits('Hz^(-1/2) V^2'); + b_ts.setName(); + + V_N_ts = [copy(a_ts, 1), copy(a_ts, 1), copy(b_ts, 1)]; + U_N_ts = [copy(b_ts, 1); copy(b_ts, 1); copy(a_ts, 1)]; + + V_M_ts = [copy(a_ts, 1); copy(b_ts, 1); copy(a_ts, 1); copy(b_ts, 1)]; + U_M_ts = [copy(b_ts, 1), copy(b_ts, 1), copy(a_ts, 1), copy(a_ts, 1)]; + + % fsdata + a_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + a_fs.setDx(ones(n,1)*1.1); + a_fs.setDy((1:n)*2.2); + a_fs.setName(); + + b_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + b_fs.setDx(7); + b_fs.setDy(9); + b_fs.setName(); + + V_N_fs = [copy(a_fs, 1), copy(a_fs, 1), copy(b_fs, 1)]; + U_N_fs = [copy(b_fs, 1); copy(b_fs, 1); copy(a_fs, 1)]; + + V_M_fs = [copy(a_fs, 1); copy(b_fs, 1); copy(a_fs, 1); copy(b_fs, 1)]; + U_M_fs = [copy(b_fs, 1), copy(b_fs, 1), copy(a_fs, 1), copy(a_fs, 1)]; + + % xydata + a_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + a_xy.setDx(ones(n,1)*1.1); + a_xy.setDy((1:n)*2.2); + a_xy.setYunits('Hz^(-1/2) V^2'); + a_xy.setName(); + + b_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + b_xy.setDx(7); + b_xy.setDy(9); + b_xy.setName(); + + V_N_xy = [copy(a_xy, 1), copy(a_xy, 1), copy(b_xy, 1)]; + U_N_xy = [copy(b_xy, 1); copy(b_xy, 1); copy(a_xy, 1)]; + + V_M_xy = [copy(a_xy, 1); copy(b_xy, 1); copy(a_xy, 1); copy(b_xy, 1)]; + U_M_xy = [copy(b_xy, 1), copy(b_xy, 1), copy(a_xy, 1), copy(a_xy, 1)]; + + % cdata + a_c = ao(8); + a_c.setDy(2); + a_c.setName(); + + b_c = ao(111:122); + b_c.setDy((111:122)/100); + b_c.setName(); + + V_N_c = [copy(a_c, 1), copy(a_c, 1), copy(b_c, 1)]; + U_N_c = [copy(b_c, 1); copy(b_c, 1); copy(a_c, 1)]; + + V_M_c = [copy(a_c, 1); copy(b_c, 1); copy(a_c, 1); copy(b_c, 1)]; + U_M_c = [copy(b_c, 1), copy(b_c, 1), copy(a_c, 1), copy(a_c, 1)]; + + % Define check functions + checkFcns = {... + @checkDataObjectRule4, ... + @checkValuesRule4, ... + @checkErrorsRule4, ... + @checkUnitsRule4, ... + @check_aop_history}; + + result = []; + + % + % + % Here we test element-wise operator rule4 as in S2-AEI-TN-3059. + % + % 1) Check the data type of the resulting object. + % 2) Check the resulting object contains the correct values. + % 3) Check the error propagation. + % 4) Check the units of the output object. + % 5) Check the resulting object can be rebuilt. + % + % + + + % + % tsdata + result = [result utp_generic_aop_core(fcn, 'rule4', 'vector tsdata and vector tsdata', U_N_ts, V_N_ts, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule4', 'vector tsdata and vector tsdata', V_M_ts, U_M_ts, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule4', 'vector tsdata and vector xydata', V_M_ts, U_M_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule4', 'vector cdata and vector tsdata', U_M_c, V_M_ts, checkFcns)]; + + % fsdata + result = [result utp_generic_aop_core(fcn, 'rule4', 'vector fsdata and vector fsdata', U_N_fs, V_N_fs, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule4', 'vector fsdata and vector fsdata', V_M_fs, U_M_fs, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule4', 'vector fsdata and vector xydata', V_M_fs, U_M_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule4', 'vector cdata and vector fsdata', U_M_c, V_M_fs, checkFcns)]; + + % xydata + result = [result utp_generic_aop_core(fcn, 'rule4', 'vector xydata and vector xydata', U_N_xy, V_N_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule4', 'vector xydata and vector xydata', V_M_xy, U_M_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule4', 'vector cdata and vector xydata', V_M_c, U_M_xy, checkFcns)]; + + % cdata + result = [result utp_generic_aop_core(fcn, 'rule4', 'vector cdata and vector cdata', V_N_c, U_N_c, checkFcns)]; + % + +end % END UTP_rule4 + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Define here the checking functions % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%% Data object test %%%%%%%%%% +function atest = checkDataObjectRule4(fcn, in1, in2, out) + + for ii = 1:numel(in1) + atest = check_aop_data_object(fcn, in1(ii), in2(ii), out(ii)); + if atest == 0 + break; + end + end +end + +%%%%%%%%%% Value test %%%%%%%%%% +function atest = checkValuesRule4(fcn, in1, in2, out) + + atest = true; + for ii = 1:numel(in1) + if ~isequal(fcn(in1(ii).data.getY, in2(ii).data.getY), out(ii).data.getY) + atest = false; + break; + end + end +end + +%%%%%%%%%% Errors test %%%%%%%%%% +function atest = checkErrorsRule4(fcn, in1, in2, out) + + atest = true; + for ii = 1:numel(in1) + atest = check_aop_errors(fcn, in1(ii), in2(ii), out(ii)); + if atest == 0 + break; + end + end +end + +%%%%%%%%%% Units test %%%%%%%%%% +function atest = checkUnitsRule4(fcn, in1, in2, out) + + atest = true; + for ii = 1:numel(in1) + atest = check_aop_units(fcn, in1(ii), in2(ii), out(ii)); + if atest == 0 + break; + end + end +end + + + + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_generic_aop_rule5.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_generic_aop_rule5.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,191 @@ + +% +% +% Tests the arithmetic operators rule 5. +% +% +function result = utp_generic_aop_rule5(fcn) + + % + % + % Tests the arithmetic operators rule 5 for each data type: xydata, + % fsdata, tsdata, cdata and useful combinations. + % + % + + % Test AOs + % tsdata + n = 12; + fs = 12.1; + x = 0:(1/fs):(n/fs)-1/fs; + a_ts = ao(x,randn(n,1), fs); + a_ts.setDx(ones(n,1)*1.1); + a_ts.setDy((1:n)*2.2); + a_ts.setYunits('Hz^(-1/2) V^2'); + a_ts.setName(); + + b_ts = ao(x,randn(n,1), fs); + b_ts.setDx(7); + b_ts.setDy(9); + b_ts.setYunits('Hz^(-1/2) V^2'); + b_ts.setName(); + + M_NP_ts = [copy(a_ts, 1), copy(a_ts, 1), copy(b_ts, 1); copy(b_ts, 1), copy(a_ts, 1), copy(a_ts, 1)]; + + % fsdata + a_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + a_fs.setDx(ones(n,1)*1.1); + a_fs.setDy((1:n)*2.2); + a_fs.setName(); + + b_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + b_fs.setDx(7); + b_fs.setDy(9); + b_fs.setName(); + + M_NP_fs = [copy(a_fs, 1), copy(a_fs, 1), copy(b_fs, 1); copy(b_fs, 1), copy(a_fs, 1), copy(a_fs, 1)]; + + % xydata + a_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + a_xy.setDx(ones(n,1)*1.1); + a_xy.setDy((1:n)*2.2); + a_xy.setYunits('Hz^(-1/2) V^2'); + a_xy.setName(); + + b_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + b_xy.setDx(7); + b_xy.setDy(9); + b_xy.setName(); + + M_NP_xy = [copy(a_xy, 1), copy(a_xy, 1), copy(b_xy, 1); copy(b_xy, 1), copy(a_xy, 1), copy(a_xy, 1)]; + + % cdata + a_c = ao(8); + a_c.setDy(2); + a_c.setName(); + + b_c = ao(111:122); + b_c.setDy((111:122)/100); + b_c.setName(); + + M_NP_c = [copy(a_c, 1), copy(a_c, 1), copy(b_c, 1); copy(b_c, 1), copy(a_c, 1), copy(a_c, 1)]; + + % Define check functions + checkFcns = {... + @checkDataObjectRule5, ... + @checkValuesRule5, ... + @checkErrorsRule5, ... + @checkUnitsRule5, ... + @check_aop_history}; + + result = []; + + % + % + % Here we test element-wise operator rule5 as in S2-AEI-TN-3059. + % + % 1) Check the data type of the resulting object. + % 2) Check the resulting object contains the correct values. + % 3) Check the error propagation. + % 4) Check the units of the output object. + % 5) Check the resulting object can be rebuilt. + % + % + + + % + % tsdata + result = [result utp_generic_aop_core(fcn, 'rule5', 'NxP tsdata and single tsdata', M_NP_ts, a_ts, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule5', 'single tsdata and NxP tsdata', b_ts, M_NP_ts, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule5', 'NxP tsdata and single xydata', M_NP_ts, a_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule5', 'single xydata and NxP tsdata', b_xy, M_NP_ts, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule5', 'NxP tsdata and single cdata', M_NP_ts, a_c, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule5', 'single cdata and NxP tsdata', b_c, M_NP_ts, checkFcns)]; + + % fsdata + result = [result utp_generic_aop_core(fcn, 'rule5', 'NxP fsdata and single fsdata', M_NP_fs, a_fs, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule5', 'single fsdata and NxP fsdata', b_fs, M_NP_fs, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule5', 'NxP fsdata and single xydata', M_NP_fs, a_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule5', 'single xydata and NxP fsdata', b_xy, M_NP_fs, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule5', 'NxP fsdata and single cdata', M_NP_fs, a_c, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule5', 'single cdata and NxP fsdata', b_c, M_NP_fs, checkFcns)]; + + % xydata + result = [result utp_generic_aop_core(fcn, 'rule5', 'NxP xydata and single xydata', M_NP_xy, a_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule5', 'single xydata and NxP xydata', b_xy, M_NP_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule5', 'NxP xydata and single cdata', M_NP_xy, a_c, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule5', 'single cdata and NxP xydata', b_c, M_NP_xy, checkFcns)]; + + % cdata + result = [result utp_generic_aop_core(fcn, 'rule5', 'NxP cdata and single cdata', M_NP_c, a_c, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule5', 'single cdata and NxP cdata', b_c, M_NP_c, checkFcns)]; + % + +end % END UTP_rule2 + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Define here the checking functions % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%% Data object test %%%%%%%%%% +function atest = checkDataObjectRule5(fcn, in1, in2, out) + + for ii = 1:max(numel(in1), numel(in2)) + if numel(in1) > numel(in2) + atest = check_aop_data_object(fcn, in1(ii), in2, out(ii)); + else + atest = check_aop_data_object(fcn, in1, in2(ii), out(ii)); + end + if atest == 0 + break; + end + end +end + +%%%%%%%%%% Value test %%%%%%%%%% +function atest = checkValuesRule5(fcn, in1, in2, out) + + atest = true; + for ii = 1:max(numel(in1), numel(in2)) + if numel(in1) > numel(in2) + if ~isequal(fcn(in1(ii).data.getY, in2.data.getY), out(ii).data.getY), atest = false; end + else + if ~isequal(fcn(in1.data.getY, in2(ii).data.getY), out(ii).data.getY), atest = false; end + end + if atest == 0 + break; + end + end +end + +%%%%%%%%%% Errors test %%%%%%%%%% +function atest = checkErrorsRule5(fcn, in1, in2, out) + + atest = true; + for ii = 1:max(numel(in1), numel(in2)) + if numel(in1) > numel(in2) + atest = check_aop_errors(fcn, in1(ii), in2, out(ii)); + else + atest = check_aop_errors(fcn, in1, in2(ii), out(ii)); + end + if atest == 0 + break; + end + end +end + +%%%%%%%%%% Units test %%%%%%%%%% +function atest = checkUnitsRule5(fcn, in1, in2, out) + + atest = true; + for ii = 1:max(numel(in1), numel(in2)) + if numel(in1) > numel(in2) + atest = check_aop_units(fcn, in1(ii), in2, out(ii)); + else + atest = check_aop_units(fcn, in1, in2(ii), out(ii)); + end + if atest == 0 + break; + end + end +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_generic_aop_rule6.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_generic_aop_rule6.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,222 @@ + +% +% +% Tests the arithmetic operators rule 6. +% +% +function result = utp_generic_aop_rule6(fcn) + + % + % + % Tests the arithmetic operators rule 6 for each data type: xydata, + % fsdata, tsdata, cdata and useful combinations. + % + % + + % Test AOs + % tsdata + n = 12; + fs = 12.1; + x = 0:(1/fs):(n/fs)-1/fs; + a_ts = ao(x,randn(n,1), fs); + a_ts.setDx(ones(n,1)*1.1); + a_ts.setDy((1:n)*2.2); + a_ts.setYunits('Hz^(-1/2) V^2'); + a_ts.setName(); + + b_ts = ao(x,randn(n,1), fs); + b_ts.setDx(7); + b_ts.setDy(9); + b_ts.setYunits('Hz^(-1/2) V^2'); + b_ts.setName(); + + V_N_ts = [copy(a_ts, 1); copy(b_ts, 1)]; + M_NP_ts = [copy(a_ts, 1), copy(a_ts, 1), copy(b_ts, 1); copy(b_ts, 1), copy(a_ts, 1), copy(a_ts, 1)]; + + % fsdata + a_fs = ao(plist('xvals', 1:12, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + a_fs.setDx(ones(n,1)*1.1); + a_fs.setDy((1:n)*2.2); + a_fs.setName(); + + b_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + b_fs.setDx(7); + b_fs.setDy(9); + b_fs.setName(); + + V_N_fs = [copy(a_fs, 1); copy(b_fs, 1)]; + M_NP_fs = [copy(a_fs, 1), copy(a_fs, 1), copy(b_fs, 1); copy(b_fs, 1), copy(a_fs, 1), copy(a_fs, 1)]; + + % xydata + a_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + a_xy.setDx(ones(n,1)*1.1); + a_xy.setDy((1:n)*2.2); + a_xy.setYunits('Hz^(-1/2) V^2'); + a_xy.setName(); + + b_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + b_xy.setDx(7); + b_xy.setDy(9); + b_xy.setName(); + + V_N_xy = [copy(a_xy, 1); copy(b_xy, 1)]; + M_NP_xy = [copy(a_xy, 1), copy(a_xy, 1), copy(b_xy, 1); copy(b_xy, 1), copy(a_xy, 1), copy(a_xy, 1)]; + + % cdata + a_c = ao(8); + a_c.setDy(2); + a_c.setName(); + + b_c = ao(111:122); + b_c.setDy((111:122)/100); + b_c.setName(); + + V_N_c = [copy(a_c, 1); copy(b_c, 1)]; + M_NP_c = [copy(a_c, 1), copy(a_c, 1), copy(b_c, 1); copy(b_c, 1), copy(a_c, 1), copy(a_c, 1)]; + + % Define check functions + checkFcns = {... + @checkDataObjectRule6, ... + @checkValuesRule6, ... + @checkErrorsRule6, ... + @checkUnitsRule6, ... + @check_aop_history}; + + result = []; + + % + % + % Here we test element-wise operator rule6 as in S2-AEI-TN-3059. + % + % 1) Check the data type of the resulting object. + % 2) Check the resulting object contains the correct values. + % 3) Check the error propagation. + % 4) Check the units of the output object. + % 5) Check the resulting object can be rebuilt. + % + % + + + % + % tsdata + result = [result utp_generic_aop_core(fcn, 'rule6', 'NxP tsdata and vector tsdata', M_NP_ts, V_N_ts, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule6', 'vector tsdata and NxP tsdata', V_N_ts, M_NP_ts, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule6', 'NxP tsdata and vector xydata', M_NP_ts, V_N_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule6', 'vector xydata and NxP tsdata', V_N_xy, M_NP_ts, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule6', 'NxP tsdata and vector cdata', M_NP_ts, V_N_c, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule6', 'vector cdata and NxP tsdata', V_N_c, M_NP_ts, checkFcns)]; + + % fsdata + result = [result utp_generic_aop_core(fcn, 'rule6', 'NxP fsdata and vector fsdata', M_NP_fs, V_N_fs, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule6', 'vector fsdata and NxP fsdata', V_N_fs, M_NP_fs, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule6', 'NxP fsdata and vector xydata', M_NP_fs, V_N_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule6', 'vector xydata and NxP fsdata', V_N_xy, M_NP_fs, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule6', 'NxP fsdata and vector cdata', M_NP_fs, V_N_c, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule6', 'vector cdata and NxP fsdata', V_N_c, M_NP_fs, checkFcns)]; + + % xydata + result = [result utp_generic_aop_core(fcn, 'rule6', 'NxP xydata and vector xydata', M_NP_xy, V_N_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule6', 'vector xydata and NxP xydata', V_N_xy, M_NP_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule6', 'NxP xydata and vector cdata', M_NP_xy, V_N_c, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule6', 'vector cdata and NxP xydata', V_N_c, M_NP_xy, checkFcns)]; + + % cdata + result = [result utp_generic_aop_core(fcn, 'rule6', 'NxP cdata and vector cdata', M_NP_c, V_N_c, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule6', 'vector cdata and NxP cdata', V_N_c, M_NP_c, checkFcns)]; + % + +end % END UTP_rule6 + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Define here the checking functions % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%% Data object test %%%%%%%%%% +function atest = checkDataObjectRule6(fcn, in1, in2, out) + + for nn = 1:size(in1,1) + for pp = 1:size(in1,2) + if numel(in1) > numel(in2) + atest = check_aop_data_object(fcn, in1(nn,pp), in2(nn), out(nn,pp)); + else + atest = check_aop_data_object(fcn, in1(nn), in2(nn,pp), out(nn,pp)); + end + if atest == 0 + break; + end + end + end +end + +%%%%%%%%%% Value test %%%%%%%%%% +function atest = checkValuesRule6(fcn, in1, in2, out) + + atest = true; + for nn = 1:size(in1,1) + for pp = 1:size(in1,2) + if isMatrix(in1) && isVector(in2) + if ~isequal(fcn(in1(nn,pp).data.getY, in2(nn).data.getY), out(nn,pp).data.getY), atest = false; end + else + if ~isequal(fcn(in1(nn).data.getY, in2(nn,pp).data.getY), out(nn,pp).data.getY), atest = false; end + end + if atest == 0 + break; + end + end + end +end + +%%%%%%%%%% Errors test %%%%%%%%%% +function atest = checkErrorsRule6(fcn, in1, in2, out) + + atest = true; + for nn = 1:size(in1,1) + for pp = 1:size(in1,2) + if isMatrix(in1) && isVector(in2) + atest = check_aop_errors(fcn, in1(nn,pp), in2(nn), out(nn,pp)); + else + atest = check_aop_errors(fcn, in1(nn), in2(nn,pp), out(nn,pp)); + end + if atest == 0 + break; + end + end + end +end + +%%%%%%%%%% Units test %%%%%%%%%% +function atest = checkUnitsRule6(fcn, in1, in2, out) + + atest = true; + for nn = 1:size(in1,1) + for pp = 1:size(in1,2) + if isMatrix(in1) && isVector(in2) + atest = check_aop_units(fcn, in1(nn,pp), in2(nn), out(nn,pp)); + else + atest = check_aop_units(fcn, in1(nn), in2(nn,pp), out(nn,pp)); + end + if atest == 0 + break; + end + end + end +end + +function [a1, a2] = findMatrix(in1, in2) + if numel(in1) > numel(in2) + a1 = in1; + a2 = in2; + else + a1 = in2; + a2 = in1; + end +end + +function res = isMatrix(a) + res = all(size(a) > 1); +end + +function res = isVector(a) + res = any(size(a) > 1) && any(size(a) == 1); +end + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_generic_aop_rule7.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_generic_aop_rule7.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,214 @@ + +% +% +% Tests the arithmetic operators rule 7. +% +% +function result = utp_generic_aop_rule7(fcn) + + % + % + % Tests the arithmetic operators rule 7 for each data type: xydata, + % fsdata, tsdata, cdata and useful combinations. + % + % + + % Test AOs + % tsdata + n = 12; + fs = 12.1; + x = 0:(1/fs):(n/fs)-1/fs; + a_ts = ao(x,randn(n,1), fs); + a_ts.setDx(ones(n,1)*1.1); + a_ts.setDy((1:n)*2.2); + a_ts.setYunits('Hz^(-1/2) V^2'); + a_ts.setName(); + + b_ts = ao(x,randn(n,1), fs); + b_ts.setDx(7); + b_ts.setDy(9); + b_ts.setYunits('Hz^(-1/2) V^2'); + b_ts.setName(); + + V_P_ts = [copy(a_ts, 1), copy(b_ts, 1), copy(b_ts, 1)]; + M_NP_ts = [copy(a_ts, 1), copy(a_ts, 1), copy(b_ts, 1); copy(b_ts, 1), copy(a_ts, 1), copy(a_ts, 1)]; + + % fsdata + a_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + a_fs.setDx(ones(n,1)*1.1); + a_fs.setDy((1:n)*2.2); + a_fs.setName(); + + b_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + b_fs.setDx(7); + b_fs.setDy(9); + b_fs.setName(); + + V_P_fs = [copy(a_fs, 1), copy(b_fs, 1), copy(b_fs, 1)]; + M_NP_fs = [copy(a_fs, 1), copy(a_fs, 1), copy(b_fs, 1); copy(b_fs, 1), copy(a_fs, 1), copy(a_fs, 1)]; + + % xydata + a_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + a_xy.setDx(ones(n,1)*1.1); + a_xy.setDy((1:n)*2.2); + a_xy.setYunits('Hz^(-1/2) V^2'); + a_xy.setName(); + + b_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + b_xy.setDx(7); + b_xy.setDy(9); + b_xy.setName(); + + V_P_xy = [copy(a_xy, 1), copy(b_xy, 1), copy(b_xy, 1)]; + M_NP_xy = [copy(a_xy, 1), copy(a_xy, 1), copy(b_xy, 1); copy(b_xy, 1), copy(a_xy, 1), copy(a_xy, 1)]; + + % cdata + a_c = ao(8); + a_c.setDy(2); + a_c.setName(); + + b_c = ao(111:122); + b_c.setDy((111:122)/100); + b_c.setName(); + + V_P_c = [copy(a_c, 1), copy(b_c, 1), copy(b_c, 1)]; + M_NP_c = [copy(a_c, 1), copy(a_c, 1), copy(b_c, 1); copy(b_c, 1), copy(a_c, 1), copy(a_c, 1)]; + + % Define check functions + checkFcns = {... + @checkDataObjectRule7, ... + @checkValuesRule7, ... + @checkErrorsRule7, ... + @checkUnitsRule7, ... + @check_aop_history}; + + result = []; + + % + % + % Here we test element-wise operator rule7 as in S2-AEI-TN-3059. + % + % 1) Check the data type of the resulting object. + % 2) Check the resulting object contains the correct values. + % 3) Check the error propagation. + % 4) Check the units of the output object. + % 5) Check the resulting object can be rebuilt. + % + % + + + % + % tsdata + result = [result utp_generic_aop_core(fcn, 'rule7', 'NxP tsdata and vector tsdata', M_NP_ts, V_P_ts, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule7', 'vector tsdata and NxP tsdata', V_P_ts, M_NP_ts, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule7', 'NxP tsdata and vector xydata', M_NP_ts, V_P_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule7', 'vector xydata and NxP tsdata', V_P_xy, M_NP_ts, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule7', 'NxP tsdata and vector cdata', M_NP_ts, V_P_c, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule7', 'vector cdata and NxP tsdata', V_P_c, M_NP_ts, checkFcns)]; + + % fsdata + result = [result utp_generic_aop_core(fcn, 'rule7', 'NxP fsdata and vector fsdata', M_NP_fs, V_P_fs, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule7', 'vector fsdata and NxP fsdata', V_P_fs, M_NP_fs, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule7', 'NxP fsdata and vector xydata', M_NP_fs, V_P_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule7', 'vector xydata and NxP fsdata', V_P_xy, M_NP_fs, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule7', 'NxP fsdata and vector cdata', M_NP_fs, V_P_c, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule7', 'vector cdata and NxP fsdata', V_P_c, M_NP_fs, checkFcns)]; + + % xydata + result = [result utp_generic_aop_core(fcn, 'rule7', 'NxP xydata and vector xydata', M_NP_xy, V_P_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule7', 'vector xydata and NxP xydata', V_P_xy, M_NP_xy, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule7', 'NxP xydata and vector cdata', M_NP_xy, V_P_c, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule7', 'vector cdata and NxP xydata', V_P_c, M_NP_xy, checkFcns)]; + + % cdata + result = [result utp_generic_aop_core(fcn, 'rule7', 'NxP cdata and vector cdata', M_NP_c, V_P_c, checkFcns)]; + result = [result utp_generic_aop_core(fcn, 'rule7', 'vector cdata and NxP cdata', V_P_c, M_NP_c, checkFcns)]; + % + +end % END UTP_rule7 + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Define here the checking functions % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%% Data object test %%%%%%%%%% +function atest = checkDataObjectRule7(fcn, in1, in2, out) + + for nn = 1:size(in1,1) + for pp = 1:size(in1,2) + if isMatrix(in1) && isVector(in2) + atest = check_aop_data_object(fcn, in1(nn,pp), in2(pp), out(nn,pp)); + else + atest = check_aop_data_object(fcn, in1(pp), in2(nn,pp), out(nn,pp)); + end + if atest == 0 + break; + end + end + end +end + +%%%%%%%%%% Value test %%%%%%%%%% +function atest = checkValuesRule7(fcn, in1, in2, out) + + atest = true; + for nn = 1:size(in1,1) + for pp = 1:size(in1,2) + if isMatrix(in1) && isVector(in2) + if ~isequal(fcn(in1(nn,pp).data.getY, in2(pp).data.getY), out(nn,pp).data.getY), atest = false; end + else + if ~isequal(fcn(in1(pp).data.getY, in2(nn,pp).data.getY), out(nn,pp).data.getY), atest = false; end + end + if atest == 0 + break; + end + end + end +end + +%%%%%%%%%% Errors test %%%%%%%%%% +function atest = checkErrorsRule7(fcn, in1, in2, out) + + atest = true; + for nn = 1:size(in1,1) + for pp = 1:size(in1,2) + if isMatrix(in1) && isVector(in2) + atest = check_aop_errors(fcn, in1(nn,pp), in2(pp), out(nn,pp)); + else + atest = check_aop_errors(fcn, in1(pp), in2(nn,pp), out(nn,pp)); + end + if atest == 0 + break; + end + end + end +end + +%%%%%%%%%% Units test %%%%%%%%%% +function atest = checkUnitsRule7(fcn, in1, in2, out) + + atest = true; + for nn = 1:size(in1,1) + for pp = 1:size(in1,2) + if isMatrix(in1) && isVector(in2) + atest = check_aop_units(fcn, in1(nn,pp), in2(pp), out(nn,pp)); + else + atest = check_aop_units(fcn, in1(pp), in2(nn,pp), out(nn,pp)); + end + if atest == 0 + break; + end + end + end +end + +function res = isMatrix(a) + res = all(size(a) > 1); +end + +function res = isVector(a) + res = any(size(a) > 1) && any(size(a) == 1); +end + + + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_generic_aop_rule8.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_generic_aop_rule8.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,125 @@ + +% +% +% Tests the arithmetic operators rule 8. +% +% +function result = utp_generic_aop_rule8(fcn) + + % + % + % Tests the arithmetic operators rule 8 for each data type: xydata, + % fsdata, tsdata, cdata and useful combinations. + % + % + + % Test AOs + % tsdata + n = 12; + fs = 12.1; + x = 0:(1/fs):(n/fs)-1/fs; + a_ts = ao(x,randn(n,1), fs); + a_ts.setDx(ones(n,1)*1.1); + a_ts.setDy((1:n)*2.2); + a_ts.setYunits('Hz^(-1/2) V^2'); + a_ts.setName(); + + b_ts = ao(x,randn(n,1), fs); + b_ts.setDx(7); + b_ts.setDy(9); + b_ts.setYunits('Hz^(-1/2) V^2'); + b_ts.setName(); + + V_Q_ts = [copy(a_ts, 1), copy(a_ts, 1), copy(b_ts, 1), copy(b_ts, 1)]; + M_NP_ts = [copy(a_ts, 1), copy(a_ts, 1), copy(b_ts, 1); copy(b_ts, 1), copy(a_ts, 1), copy(a_ts, 1)]; + + % fsdata + a_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + a_fs.setDx(ones(n,1)*1.1); + a_fs.setDy((1:n)*2.2); + a_fs.setName(); + + b_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + b_fs.setDx(7); + b_fs.setDy(9); + b_fs.setName(); + + V_Q_fs = [copy(a_fs, 1), copy(a_fs, 1), copy(b_fs, 1), copy(b_fs, 1)]; + M_NP_fs = [copy(a_fs, 1), copy(a_fs, 1), copy(b_fs, 1); copy(b_fs, 1), copy(a_fs, 1), copy(a_fs, 1)]; + + % xydata + a_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + a_xy.setDx(ones(n,1)*1.1); + a_xy.setDy((1:n)*2.2); + a_xy.setYunits('Hz^(-1/2) V^2'); + a_xy.setName(); + + b_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + b_xy.setDx(7); + b_xy.setDy(9); + b_xy.setName(); + + V_Q_xy = [copy(a_xy, 1), copy(a_xy, 1), copy(b_xy, 1), copy(b_xy, 1)]; + M_NP_xy = [copy(a_xy, 1), copy(a_xy, 1), copy(b_xy, 1); copy(b_xy, 1), copy(a_xy, 1), copy(a_xy, 1)]; + + % cdata + a_c = ao(8); + a_c.setDy(2); + a_c.setName(); + + b_c = ao(111:122); + b_c.setDy((111:122)/100); + b_c.setName(); + + V_Q_c = [copy(a_c, 1), copy(a_c, 1), copy(b_c, 1), copy(b_c, 1)]; + M_NP_c = [copy(a_c, 1), copy(a_c, 1), copy(b_c, 1); copy(b_c, 1), copy(a_c, 1), copy(a_c, 1)]; + + % Define check functions + + result = []; + + % + % + % Here we test element-wise operator rule8 as in S2-AEI-TN-3059. + % + % 1) Check the data type of the resulting object. + % 2) Check the resulting object contains the correct values. + % 3) Check the error propagation. + % 4) Check the units of the output object. + % 5) Check the resulting object can be rebuilt. + % + % + + + % + % tsdata + result = [result utp_generic_aop_negative_core(fcn, 'rule8', 'NxP tsdata and vector tsdata', M_NP_ts, V_Q_ts)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule8', 'vector tsdata and NxP tsdata', V_Q_ts, M_NP_ts)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule8', 'NxP tsdata and vector xydata', M_NP_ts, V_Q_xy)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule8', 'vector xydata and NxP tsdata', V_Q_xy, M_NP_ts)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule8', 'NxP tsdata and vector cdata', M_NP_ts, V_Q_c)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule8', 'vector cdata and NxP tsdata', V_Q_c, M_NP_ts)]; + + % fsdata + result = [result utp_generic_aop_negative_core(fcn, 'rule8', 'NxP fsdata and vector fsdata', M_NP_fs, V_Q_fs)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule8', 'vector fsdata and NxP fsdata', V_Q_fs, M_NP_fs)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule8', 'NxP fsdata and vector xydata', M_NP_fs, V_Q_xy)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule8', 'vector xydata and NxP fsdata', V_Q_xy, M_NP_fs)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule8', 'NxP fsdata and vector cdata', M_NP_fs, V_Q_c)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule8', 'vector cdata and NxP fsdata', V_Q_c, M_NP_fs)]; + + % xydata + result = [result utp_generic_aop_negative_core(fcn, 'rule8', 'NxP xydata and vector xydata', M_NP_xy, V_Q_xy)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule8', 'vector xydata and NxP xydata', V_Q_xy, M_NP_xy)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule8', 'NxP xydata and vector cdata', M_NP_xy, V_Q_c)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule8', 'vector cdata and NxP xydata', V_Q_c, M_NP_xy)]; + + % cdata + result = [result utp_generic_aop_negative_core(fcn, 'rule8', 'NxP cdata and vector cdata', M_NP_c, V_Q_c)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule8', 'vector cdata and NxP cdata', V_Q_c, M_NP_c)]; + % + +end % END UTP_rule8 + + + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/generic_utps/utp_generic_aop_rule9.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/generic_utps/utp_generic_aop_rule9.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,125 @@ + +% +% +% Tests the arithmetic operators rule 9. +% +% +function result = utp_generic_aop_rule9(fcn) + + % + % + % Tests the arithmetic operators rule 9 for each data type: xydata, + % fsdata, tsdata, cdata and useful combinations. + % + % + + % Test AOs + % tsdata + n = 12; + fs = 12.1; + x = 0:(1/fs):(n/fs)-1/fs; + a_ts = ao(x,randn(n,1), fs); + a_ts.setDx(ones(n,1)*1.1); + a_ts.setDy((1:n)*2.2); + a_ts.setYunits('Hz^(-1/2) V^2'); + a_ts.setName(); + + b_ts = ao(x,randn(n,1), fs); + b_ts.setDx(7); + b_ts.setDy(9); + b_ts.setYunits('Hz^(-1/2) V^2'); + b_ts.setName(); + + H_NQ_ts = [copy(a_ts, 1), copy(a_ts, 1); copy(b_ts, 1), copy(a_ts, 1)]; + M_NP_ts = [copy(a_ts, 1), copy(a_ts, 1), copy(b_ts, 1); copy(b_ts, 1), copy(a_ts, 1), copy(a_ts, 1)]; + + % fsdata + a_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + a_fs.setDx(ones(n,1)*1.1); + a_fs.setDy((1:n)*2.2); + a_fs.setName(); + + b_fs = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'fsdata')); + b_fs.setDx(7); + b_fs.setDy(9); + b_fs.setName(); + + H_NQ_fs = [copy(a_fs, 1), copy(a_fs, 1); copy(b_fs, 1), copy(a_fs, 1)]; + M_NP_fs = [copy(a_fs, 1), copy(a_fs, 1), copy(b_fs, 1); copy(b_fs, 1), copy(a_fs, 1), copy(a_fs, 1)]; + + % xydata + a_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + a_xy.setDx(ones(n,1)*1.1); + a_xy.setDy((1:n)*2.2); + a_xy.setYunits('Hz^(-1/2) V^2'); + a_xy.setName(); + + b_xy = ao(plist('xvals', 1:n, 'yvals', abs(randn(n,1)), 'type', 'xydata')); + b_xy.setDx(7); + b_xy.setDy(9); + b_xy.setName(); + + H_NQ_xy = [copy(a_xy, 1), copy(a_xy, 1); copy(b_xy, 1), copy(a_xy, 1)]; + M_NP_xy = [copy(a_xy, 1), copy(a_xy, 1), copy(b_xy, 1); copy(b_xy, 1), copy(a_xy, 1), copy(a_xy, 1)]; + + % cdata + a_c = ao(8); + a_c.setDy(2); + a_c.setName(); + + b_c = ao(111:122); + b_c.setDy((111:122)/100); + b_c.setName(); + + H_NQ_c = [copy(a_c, 1), copy(a_c, 1); copy(b_c, 1), copy(a_c, 1)]; + M_NP_c = [copy(a_c, 1), copy(a_c, 1), copy(b_c, 1); copy(b_c, 1), copy(a_c, 1), copy(a_c, 1)]; + + % Define check functions + + result = []; + + % + % + % Here we test element-wise operator rule9 as in S2-AEI-TN-3059. + % + % 1) Check the data type of the resulting object. + % 2) Check the resulting object contains the correct values. + % 3) Check the error propagation. + % 4) Check the units of the output object. + % 5) Check the resulting object can be rebuilt. + % + % + + + % + % tsdata + result = [result utp_generic_aop_negative_core(fcn, 'rule9', 'NxP tsdata and NxQ tsdata', M_NP_ts, H_NQ_ts)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule9', 'NxQ tsdata and NxP tsdata', H_NQ_ts, M_NP_ts)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule9', 'NxP tsdata and NxQ xydata', M_NP_ts, H_NQ_xy)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule9', 'NxQ xydata and NxP tsdata', H_NQ_xy, M_NP_ts)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule9', 'NxP tsdata and NxQ cdata', M_NP_ts, H_NQ_c)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule9', 'NxQ cdata and NxP tsdata', H_NQ_c, M_NP_ts)]; + + % fsdata + result = [result utp_generic_aop_negative_core(fcn, 'rule9', 'NxP fsdata and NxQ fsdata', M_NP_fs, H_NQ_fs)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule9', 'NxQ fsdata and NxP fsdata', H_NQ_fs, M_NP_fs)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule9', 'NxP fsdata and NxQ xydata', M_NP_fs, H_NQ_xy)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule9', 'NxQ xydata and NxP fsdata', H_NQ_xy, M_NP_fs)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule9', 'NxP fsdata and NxQ cdata', M_NP_fs, H_NQ_c)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule9', 'NxQ cdata and NxP fsdata', H_NQ_c, M_NP_fs)]; + + % xydata + result = [result utp_generic_aop_negative_core(fcn, 'rule9', 'NxP xydata and NxQ xydata', M_NP_xy, H_NQ_xy)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule9', 'NxQ xydata and NxP xydata', H_NQ_xy, M_NP_xy)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule9', 'NxP xydata and NxQ cdata', M_NP_xy, H_NQ_c)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule9', 'NxQ cdata and NxP xydata', H_NQ_c, M_NP_xy)]; + + % cdata + result = [result utp_generic_aop_negative_core(fcn, 'rule9', 'NxP cdata and NxQ cdata', M_NP_c, H_NQ_c)]; + result = [result utp_generic_aop_negative_core(fcn, 'rule9', 'NxQ cdata and NxP cdata', H_NQ_c, M_NP_c)]; + % + +end % END UTP_rule3 + + + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/ltpda_report_template.tex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/ltpda_report_template.tex Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,91 @@ +\documentclass[a4paper, 10pt, pdftex]{book} + +\usepackage{mcode} +\usepackage{graphicx, color} +\usepackage{times, calc,fancyhdr} +\usepackage[pdftex]{geometry} +\usepackage[english]{babel} +\usepackage{colortbl} +\usepackage{lastpage} +\usepackage{calc} +\pagestyle{fancy} +% with this we ensure that the chapter and section +% headings are in lowercase. +\renewcommand{\chaptermark}[1]{\markboth{#1}{}} +\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}} +\fancyhf{} +% delete current setting for header and footer +\fancyhead[LE,RO]{\bfseries\thepage} +\fancyhead[LO]{\bfseries\rightmark} +\fancyhead[RE]{\bfseries\leftmark} +\renewcommand{\headrulewidth}{0.5pt} +\renewcommand{\footrulewidth}{0pt} +\addtolength{\headheight}{0.5pt} +% make space for the rule +\fancypagestyle{plain}{% + \fancyhead{} % get rid of headers on plain pages + \renewcommand{\headrulewidth}{0pt} % and the line +} + +\usepackage[pdftex,colorlinks=true, pdfstartview=FitV, % + , linkcolor=blue, citecolor=magenta, urlcolor=cyan,]{hyperref} + + +% \setlength{\oddsidemargin}{2cm} +% \setlength{\textwidth}{15.8cm} +% \setlength{\hoffset}{-1in} + +%\headsep = 22pt +\parskip = 5mm +\parindent = 0.0mm + +\begin{document} +\pdfinfo{ + /Title (LTPDA User Manual) + /Author (Martin R Hewitson) + /Keywords (LTPDA,LTP,LISA) +} + +%\layout + + +\title{LTPDA User Manual} +\author{M Hewitson} +\maketitle +\newpage +\tableofcontents +\begin{verbatim} + $Id: ltpda_report_template.tex,v 1.1 2008/08/13 14:05:21 gerrit Exp $ +\end{verbatim} + +% + +% +\subsection{<
    >} +<> +% + +% +\subsubsection{<
    >} +<> +% + +% +\begin{tabular}[ll] +<> & +% + +% +<> \\ +% + +% +<> & +% + +% +<> +\end{tabular} +% + +% \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/print_utp_results.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/print_utp_results.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,99 @@ +% PRINT_UTP_RESULTS prints the results structure to a string. +% +% M Hewitson 07-08-08 +% +% $Id: print_utp_results.m,v 1.5 2011/04/17 05:42:54 hewitson Exp $ +% + +function res = print_utp_results(results) + + DISP_ALL = false; + DISP_RUNTIME = true; + DISP_RUNTIME_NUM = 30; + + ntests = numel(results); + apassed = sum([results(:).a]); + spassed = sum([results(:).s]); + + res = ''; + + if DISP_ALL + res = [res sprintf('\n\n')]; + res = [res sprintf('-------------------------------------------------------\n')]; + res = [res sprintf('------------- SUMMARY -------------\n')]; + res = [res sprintf('-------------------------------------------------------\n')]; + res = [res sprintf('-------------------------------------------------------\n')]; + res = [res sprintf('UTP name | Syntax | Algorithm\n')]; + res = [res sprintf('-------------------------------------------------------\n')]; + for aa=1:ntests + str = dispRes(results(aa).fcn, results(aa).s, results(aa).a, results(aa).msg); + res = [res str]; + end + res = [res sprintf('\n\n')]; + end + + if DISP_RUNTIME + + runtime = [0 results(:).runtime]; + d = diff(runtime); + [sorted, idx] = sort(d); + + res = [res sprintf('-------------------------------------------------------\n')]; + res = [res sprintf('------------- RUNTIME -------------\n')]; + res = [res sprintf('-------------------------------------------------------\n')]; + res = [res sprintf('-------------------------------------------------------\n')]; + res = [res sprintf('UTP name | Runtime \n')]; + res = [res sprintf('-------------------------------------------------------\n')]; + for ll = 0:min(DISP_RUNTIME_NUM, length(idx)-1); + currentIdx = idx(end-ll); + str = dispRes(results(currentIdx).fcn, sorted(end-ll), '', ''); + res = [res str]; + end + res = [res sprintf('\n\n')]; + end + + res = [res sprintf('-------------------------------------------------------\n')]; + res = [res sprintf('------------- FAILURES ------------\n')]; + res = [res sprintf('-------------------------------------------------------\n')]; + res = [res sprintf('-------------------------------------------------------\n')]; + res = [res sprintf('UTP name | Syntax | Algorithm\n')]; + res = [res sprintf('-------------------------------------------------------\n')]; + for jj=1:ntests + if results(jj).a==0 || results(jj).s==0 + str = dispRes(results(jj).fcn, results(jj).s, results(jj).a, results(jj).msg); + res = [res str]; + end + end + res = [res sprintf('-------------------------------------------------------\n')]; + res = [res sprintf('\n\n')]; + + % Summary + res = [res sprintf('------------------------------------\n')]; + res = [res sprintf('Total # tests: %d\n', ntests)]; + res = [res sprintf('S tests failed: %d\n', ntests - spassed)]; + res = [res sprintf('A tests failed: %d\n', ntests - apassed)]; + res = [res sprintf('------------------------------------\n')]; +end + +function str = dispRes(fcn, s, a, msg) + if numel(fcn) > 35 + fcn = [fcn(1:31), ' ...']; + end + str = sprintf('%-36s%s %s %s\n', fcn, res2str(s), res2str(a), msg); +end + +function str = res2str(a) + if islogical(a) + if (a) + str = ' pass '; + else + str = '--fail--'; + end + elseif isnumeric(a) + str = sprintf('%8.2f seconds', a); + elseif ischar(a) + str = a; + else + str = ''; + end +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/report/AEI_small.png Binary file testing/utp_1.1/report/AEI_small.png has changed diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/report/LisaPF-logo.jpg Binary file testing/utp_1.1/report/LisaPF-logo.jpg has changed diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/report/LisaPF-logo_klein.jpg Binary file testing/utp_1.1/report/LisaPF-logo_klein.jpg has changed diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/report/include/macros.tex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/report/include/macros.tex Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,69 @@ +\newcommand{\martin}[1]{\textcolor{blue}{\textit{Martin: #1}}} +\newcommand{\anneke}[1]{\textcolor{red}{\textit{Anneke: #1}}} + +\newcommand{\etc}{\textit{etc}} +\newcommand{\ie}{\textit{i.e.}} +\newcommand{\da}{\textsc{LTPDA}} +\newcommand{\code}[1]{\texttt{#1}} +\newcommand{\tbd}[0]{\textcolor{red}{TBD}} +\newcommand{\ltpda}[0]{\textsc{LTPDA}} + +\newcommand{\q}[1]{\lq #1'} + +\newenvironment{Ventry}[1]% +{\begin{list}{}% + {\renewcommand{\makelabel}[1]{\textbf{##1:}\hfil}% + \settowidth{\labelwidth}{\textbf{#1:}}% + \setlength{\leftmargin}{\labelwidth+\labelsep}% + }% +} +{\end{list}} + +\newenvironment{flist}[1]% +{\begin{list}{}% + {\renewcommand{\makelabel}[1]{\texttt{##1:}\hfil}% + \settowidth{\labelwidth}{\texttt{#1:}}% + \setlength{\leftmargin}{\labelwidth+\labelsep}% + }% +} +{\end{list}} + +% UTP +\newcounter{utpscount} +\setcounter{utpscount}{1} +\newcommand{\utps}[2]{\noindent\textbf{\\UTP\_S\hspace{-0.13cm}\padzeroes[3]\decimal{utpscount}}\hspace{0.3cm}\stepcounter{utpscount}% +\parbox[t]{12cm}{#1}\\\medskip\parbox[t]{12cm}{#2}} + +% Algorithmic UTP +\newcounter{utpacount} +\setcounter{utpacount}{1} +\newcommand{\utpa}[1]{\noindent\textbf{\\UTP\_A\hspace{-0.13cm}\padzeroes[3]\decimal{utpacount}}\hspace{0.3cm}\stepcounter{utpacount}% +\parbox[t]{12cm}{#1}\\\medskip} + + +\newcounter{utpcount}% +\setcounter{utpcount}{1}% +\newcommand{\utpfcn}{default\_name} + +\newcommand{\utp}[5]{\noindent\vspace{0.3cm}% +\begin{tabularx}{\textwidth}{@{}|c|X|p{#1cm}@{}|@{}}% + \multicolumn{3}{@{}p{\textwidth}@{}}{\textbf{\utpfcn\_\padzeroes[3]\decimal{utpcount}} \stepcounter{utpcount}} \\ + \hline + \textbf{S} & \textbf{Call} \newline #2 & #3 \\ + \hline + \textbf{A} & \textbf{Check} \newline #4 & #5 \\ + \hline +\end{tabularx}\vspace{0.3cm}} + + + + +\newcounter{stpcount} +\setcounter{stpcount}{1} +\newcommand{\stp}[1]{\noindent\\\vspace{0.3cm}% +\begin{tabular}{|l|p{12cm}|}% + \hline + \textbf{ST\_\hspace{-0.13cm}\padzeroes[3]\decimal{stpcount}}\stepcounter{stpcount} & #1 \\ \hline +\end{tabular}\vspace{0.3cm}} + + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/report/ltpda_report.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/report/ltpda_report.css Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,21 @@ +.maxplanck { + text-transform: uppercase; +}; + +.methoddesc { + background-color: #EEEEEE; +} +.testdesc { + background-color: #EFEFEF; +} + +.utptable { + min-width: 700px; + max-width: 100%; + width: 70%; +} +.desc { + border-width: 1px; + border-style: solid; + border-color: #000000; +} \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/report/ltpda_report_template.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/report/ltpda_report_template.html Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,55 @@ + + + + + + +LTPDA UTP report + + +LISA logo +
    MPI logoMax Planck Institute for
    Graviational Physics
    (Albert Einstein Institute)
    +
    +

    LTPDA UTP report

    + + + + +
    Prepared by:Martin Hewitson & Ingo Diepholz
    Checked by:
    Date: %%%DATE%%%
    +

    This document and all parts of it are confidential. Any distribution is prohibited without +written authorisation from AEI.

    + + + + +

    %%%HEADER%%%

    +

    %%%CONTENT%%%

    + + + +

    %%%CONTENT%%%

    + + + + + + + + + + + + + + + + + +
    Method description:%%%CONTENT%%%
    %%%CONTENT%%%
    Algorithm description:%%%CONTENT%%%
    %%%CONTENT%%%
    + + + + + + \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/report/ltpda_report_template.tex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/report/ltpda_report_template.tex Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,292 @@ +% +% do not indent paragraphs +% +% +% switch off extra space after punctuation marks +% +\frenchspacing + +\newcommand{\documentname}{S2-AEI-TN-3002} +\newcommand{\documentdate}{\today} + +%Schriftgroesse, Layout, Papierformat, Art des Dokumentes +\documentclass[fleqn,10pt,twoside,a4paper,DIV11]{scrartcl} + +\setlength{\parindent}{0pt} +\setlength{\parskip}{0.5cm} + +\usepackage{changebar} +\usepackage{color} +%\usepackage{fmtcount} +\usepackage{upgreek} +\usepackage{multirow} + + +% Wird gebraucht. +\usepackage[english]{babel} + +% +% make document useable for latex and pdflatex +% +\newif\ifpdf +\ifx\pdfoutput\undefined +\pdffalse % we are not running PDFLaTeX +\else +\pdfoutput=1 % we are running PDFLaTeX +\pdftrue +\fi +\ifpdf +\usepackage[pdftex]{graphicx} % to include graphics +\pdfcompresslevel=9 +% +% use package hyperref to create a pdf file with hyperlinks +% the package wants to be loaded as last packages, since it overrides settings +% +\usepackage[pdftex, % sets up hyperref to use pdftex driver +plainpages=false, % allows page i and 1 to exist in the same document +breaklinks=true, % link texts can be broken at the end of line +colorlinks=true, +% pdftitle=, % keine Umlaute oder Sonderzeichen +pdfauthor= Martin Hewitson +]{hyperref} % should be the last package that is loaded according to docsumentation +% +% to create thumbnails in pdf files +% +%\usepackage{thumbpdf} +\else +\usepackage{graphicx} % to include graphics +\usepackage{hyperref} % to simplify the use of \href +\fi + +%Umlaute ermoeglichen +%\usepackage [applemac]{inputenc} %ggf. \usepackage[latin9]{inputenc} + +%weitere Pakete +\usepackage[T1]{fontenc} +\usepackage{ae} % beachte: durch dieses Paket kann im Acrobat nicht mehr nach Woertern mit Umlauten gesucht werden. +%\pdfcompresslevel=9 %(1-9) +%\pdfinfo{info keys for example: Title, Creator, Author} + + +%\raggedbottom +%Packages aus alten Dokumenten%%%%%%%%%%%%%%% +\usepackage[intlimits]{amsmath} +\usepackage{amssymb} +\usepackage[headinclude,footinclude]{scrpage2} +%\usepackage[pdftex]{graphicx} +\usepackage{verbatim} +\usepackage{rotating} +\usepackage{colortbl} +\usepackage{lastpage} +\usepackage{calc} +\usepackage{mcode} +\usepackage{tabularx} +% \usepackage[numbered,framed]{mcode} + +%\usepackage{hyperref} +\DeclareGraphicsExtensions{.pdf} + +\pagestyle{scrheadings} +\renewcommand{\headheight}{2.5cm} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%Kopfzeile +%Kopfzeile links bzw. innen +\ihead{ + \begin{minipage}[b]{3cm} + \small{\documentname}\\\small{\documentdate\\Issue: Draft\\ Rev. 1} + \end{minipage} +} +%Kopfzeile rechts bzw. aussen +\ohead{ + \begin{minipage}[b]{1.6cm} + \includegraphics[width=1.6cm]{AEI_small.png} + \end{minipage} + \begin{minipage}[b]{5,5cm} + \textsc{Max Planck Institute for\\Gravitational Physics\\ + (Albert-Einstein-Institute)}\\ + \end{minipage}\\\vspace{-0.5cm} +} +%Kopfzeile mittig +\chead{} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%Fusszeile +%Fusszeile rechts bzw. aussen +\ofoot{\pagemark} +%Fusszeile links bzw. innen +\ifoot{} +%Fusszeile mittig +\cfoot{} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\setheadtopline{1pt} +\setheadsepline{1pt} + +%Gummimaße erhöhen +\tolerance 1414 +\hbadness 1414 +\setlength{\emergencystretch}{1.5em} +\hfuzz 0.3pt +\widowpenalty=10000 +\vfuzz \hfuzz +\raggedbottom + +%Satz von Floats verbessern (nach FAQ): +\renewcommand{\floatpagefraction}{.7} +\renewcommand{\textfraction}{.15} +\renewcommand{\topfraction}{.8} +\renewcommand{\bottomfraction}{.5} + + +\newcommand{\utpsmall}[3]{\noindent\vspace{0.3cm} +\begin{tabularx}{\textwidth}{@{}|X|p{#1cm}@{}|@{}} +\hline +#1 & #2 \\ +\hline +\multicolumn{2}{@{}p{\textwidth}@{}}{#3} +\hline +\end{tabularx}\vspace{0.3cm}} + +\newcommand{\utp}[4]{\noindent\vspace{0.3cm} +\begin{tabularx}{\textwidth}{@{}|X|p{1cm}@{}|@{}} +\hline +#1 & #2 \\ +\hline +\multicolumn{2}{@{}p{\textwidth}@{}}{#3} \\ +\hline +\multicolumn{2}{@{}p{\textwidth}@{}}{#4} \\ +\hline +\end{tabularx}\vspace{0.3cm}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{document} + +% Macros +%\input{include/macros} + +%Titelseite +\titlehead{ + + % \begin{figure} + % \begin{minipage}[b]{7cm} + % \includegraphics[width=4cm]{LisaPF-logo.jpg} + % \end{minipage} + % \hspace{0.5cm} + % \begin{minipage}[b]{7cm} + % \includegraphics[width=1.6cm]{AEI_small.png} + % \end{minipage} + % \end{figure} + % \begin{flushright} + + + \begin{flushright} + \begin{minipage}[b]{2.6cm} + \includegraphics[width=2.6cm]{LisaPF-logo.jpg} + \end{minipage} + \begin{minipage}[b]{1.6cm} + \includegraphics[width=1.6cm]{AEI_small.png} + \end{minipage} + \begin{minipage}[b]{5.5cm} + \textsc{Max-Planck-Institute for\\ Gravitational Physics\\ + (Albert-Einstein-Institute)}\\ + \end{minipage} + \end{flushright} +} + + +\title{ + LTPDA Unit Test Plan \\ + \vspace{1cm} + {\large \documentname} \\ \vspace{2cm} + \author{ + \begin{tabular}{p{4cm}p{9.5cm}} + \hline + prepared by & Martin Hewitson \& Ingo Diepholz \\ + checked by & \\ + Issue & 1 \\ + Revision & 1 \\ + Status & draft \\ + Number of pages & \pageref{LastPage} \\ + date of issue & \documentdate \\ + approved by & \\ + \hline + \end{tabular} + } +} + + + +\date{} +\maketitle + +\textbf{This document and all parts of it are confidential. Any distribution is prohibited without written authorisation from AEI.} + +\newpage + +%---------------------------------------------------------------------------------- + +\section{Distribution List} +\begin{tabular}{p{4cm}p{9.5cm}} +\hline \rowcolor[gray]{0.9} Name & Company/ Institute\\ +\hline M. Hewitson & AEI Hannover\\ +\hline I. Diepholz & AEI Hannover\\ +\hline +\end{tabular} + +\newpage + +\tableofcontents + +\newpage + +% + +% +\subsection{<
    >} +<> + +% + +% +\subsubsection{<
    >} +<> +% + +% +\noindent\framebox{\begin{minipage}{\textwidth} +Syntax test \hfill n/a +\end{minipage}} +\noindent\framebox{\begin{minipage}{\textwidth} +<> +\end{minipage}} +% + +% +\bigskip\nopagebreak\noindent\framebox{\begin{minipage}{\textwidth} +\small +<> +\normal +\end{minipage}} +\pagebreak[3] +% + +% +\noindent\framebox{\begin{minipage}{\textwidth} +Algorithm test \hfill n/a +\end{minipage}} +\noindent\framebox{\begin{minipage}{\textwidth} +<> +\end{minipage}} +% + +% +\nopagebreak\noindent\framebox{\begin{minipage}{\textwidth} +\small +<> +\normal +\end{minipage}} +\pagebreak[3] +% + +% + +\end{document} \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/report/mcode.sty --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/report/mcode.sty Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,185 @@ +%% +%% This is file `mcode.sty' +%% +%% It is supposed to help you easily include MATLAB source code +%% into LaTeX document, but have it nicely highlighted, unsing +%% the great listings package. +%% +%% Usage: Include your MATLAB source code by using +%% +%% \begin{lstlisting} +%% YOUR CODE HERE +%% \end{lstlisting} +%% +%% or as an inline object via \mcode{YOURCODE}. +%% +%% For your convenience, this package has the following options: +%% +%% - bw if you intend to print the document (highlighting done +%% via text formatting (bold, italic) and shades of gray) +%% +%% - numbered if you want line numbers +%% +%% - framed if you want a frame around the source code blocks +%% +%% - final if you have ``gloablly'' set the draft option, the +%% listings package will not output the code at all. to +%% force it to do so anyway, load this package with the +%% final option (passes the ``final'' on to listings). +%% +%% Example of use: \usepackage[numbered,framed]{mcode} +%% in your document preamble. +%% +%% Note: inside code blocks you can 'escape' to LaTeX math mode +%% by using § YOUR LATEX CODE §, which is especially useful in +%% comments... +%% +%% Another feature of the listings package is that you can re- +%% place certain strings by LaTeX strings; this is used for +%% some relation symbols, see below... +%% +%% Mat Odijk pointed this out, you may include entire m-files +%% using the command \lstinputlisting{YOUR-FILE.m}. Thanks for +%% the tip! +%% +%% Feel free to edit things, and refer to the listings package +%% documentation for more infos. +%% +%% If you have any questions, feel free to ask: floz@gmx.de +%% +%% Usolved problem: long lines of code that are wrapped with +%% '...', and things thereafter being comments..... +%% but i'm working on it ;-) +%% +%% Author: Florian Knorn, floz@gmx.de +%% +%% Version history: +%% 1.2 -- Added \lstset{showstringspaces=false} +%% 1.1 -- Added \mcode command and [final] option +%% 1.0 -- Release + +\def\fileversion{1.2} +\def\filedate{2005/11/17} + +\typeout{Package: `mcode' \fileversion\space <\filedate>} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{mcode}[\filedate\space\fileversion] + +% for bw-option +\newif\ifbw +\DeclareOption{bw}{\bwtrue} +\ifbw\typeout{mcode: settings optimized for printing!} +\else\typeout{mcode: settings optimized for display!}\fi + +% numbered option +\newif\ifnumbered +\DeclareOption{numbered}{\numberedtrue} + +% final option +\newif\iffinal +\DeclareOption{final}{\finaltrue} + +% for framed option +\newif\ifframed +\DeclareOption{framed}{\framedtrue} + +\DeclareOption*{% default + \PackageWarning{mcode}{Unknown option `\CurrentOption' !}% +} +\ProcessOptions + +% with this command, you can typeset syntax highlighted mcode ``inline'', +% for example when you talk about \mcode{for}--loops ... +\newcommand{\mcode}[1]{\lstinline[basicstyle=\lstbasicfont]|#1|} + +% check if color command exists +\ifx\color\undefined% + \RequirePackage{color}% +\fi + +% check if listings has been loaded +\ifx\lstset\undefined% + \iffinal + \RequirePackage[final]{listings} + \else + \RequirePackage{listings} + \fi +\fi + +% check if textcomp has been loaded (this package is needed +% for upright quotes '' (instead of typographic ones `´)... +\ifx\textasciigrave\undefined% + \RequirePackage{textcomp}% +\fi + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% C O N F I G S --- C U S T O M I Z E H E R E % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% define the wanted font for all highlightings here +\def\lstbasicfont{\fontfamily{pcr}\selectfont} + +% now let's define our own version of matlab highlighting +\lstdefinelanguage{matlabfloz}{% + alsoletter={...},% + morekeywords={% % keywords + break,case,catch,continue,elseif,else,end,for,function,global,% + if,otherwise,persistent,return,switch,try,while,...},% + comment=[l]\%,% % comments + morecomment=[l]...,% % comments + morestring=[m]',% % strings +}[keywords,comments,strings]% + + +\ifbw % use font formating and gray 'colors' + \lstset{language=matlabfloz, % use our version of highlighting + keywordstyle=\bfseries, % keywords in bold + commentstyle=\color[gray]{0.6}\itshape, % comments light gray and italic + stringstyle=\color[gray]{0.5} % strings darker gray + } +\else% notbw => use colors : ) + \lstset{language=matlabfloz, % use our version of highlighting + keywordstyle=\color[rgb]{0,0,1}, % keywords + commentstyle=\color[rgb]{0.133,0.545,0.133}, % comments + stringstyle=\color[rgb]{0.627,0.126,0.941} % strings + } +\fi%bw + +\lstset{% + basicstyle={\lstbasicfont\footnotesize}, % use font and smaller size + showstringspaces=false, % do not emphasize spaces in strings + tabsize=4, % number of spaces of a TAB + mathescape=true,escapechar=§, % escape to latex with §...§ + upquote=true, % upright quotes + aboveskip={1.5\baselineskip}, % a bit of space above + columns=fixed, % nice spacing + % + % the following is for replacing some matlab relations like >= or ~= + % by the corresponding LaTeX symbols, which are much easier to read ... + literate=% + {~}{{$\neg$}}1 % \neg + {<=}{{\tiny$\leq$}}1 % \leq + {>=}{{\tiny$\geq$}}1 % \geq + {~=}{{\tiny$\neq$}}1 % \neq + {delta}{{\tiny$\Delta$}}1% \Delta +} + +\ifnumbered% numbered option + \lstset{% + numbersep=3mm, numbers=left, numberstyle=\tiny, % number style + } +\fi + +\ifframed% framed option + \lstset{% + frame=single, % frame + } + \ifnumbered% + \lstset{% + framexleftmargin=6mm, xleftmargin=6mm % tweak margins + } + \fi +\fi + +\endinput +%% End of file `mcode.sty'. \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/save_report.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/save_report.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,37 @@ +% SAVE_REPORT runs all unit test and saves the result to a readable file + +% OLD TODO +% +% + Format UTP table by hand - not using \utp +% + move code block to tables in appendix with same numbering as UTP tables +% + add pdf link in UTP table to code block +% + keep code indentation from m-file +% + wrap strings using utils.prog.wrapstring (or similar) - add ... +% + +function save_report() + % config + csv_filename = 'report/report.csv'; % path to temporary csv file + end_filename = 'report/utp_%TIME%.xml'; %where the report goes to + ruby = '/usr/bin/ruby'; %path to ruby + rb_file = 'buildxml.rb'; %path to buildxml.rb + + % input data (loaded from file) + result = load('result.mat'); + result = result.s; + + % input data (test run) + % result = utp_run(); + + % output + outFile = fopen(csv_filename, 'w'); + + for i=1:length(result) + line = sprintf('%s, %.0f, %.0f, %.0f, %.0f\n', result(i).fcn, result(i).a, result(i).s, result(i).num, result(i).date.utc_epoch_milli); + fprintf(outFile, '%s', line); + end + + fclose(outFile); + + system(sprintf('%s %s "%s"', ruby, rb_file, end_filename)); +end \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/search_results.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/search_results.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,14 @@ +function out = search_results(results, utp_name) + + out = []; + + for kk=1:numel(results) + r = results(kk); + name = ['utp_' r.class '_' r.method '_' r.num]; + if strcmpi(name, utp_name) + kk + out = r; + end + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/unit_test_doc/AEI_small.png Binary file testing/utp_1.1/unit_test_doc/AEI_small.png has changed diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/unit_test_doc/UTN_complete_logo.jpg Binary file testing/utp_1.1/unit_test_doc/UTN_complete_logo.jpg has changed diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/unit_test_doc/introduction.tex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/unit_test_doc/introduction.tex Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,26 @@ +\section{Introduction} + +This document captures the results of the unit test run on LTPDA. The +development cycle of LTPDA uses an automated test-rig which runs every night +using a fresh build of the toolbox. The test-rig runs a series of different +tests, including the unit tests presented in this report. + +The LTPDA unit tests are gathered according to the object class and method within +that class. For each unit test, there is a syntax test (to check that the method +can be run) and an algorithm test (to check that the method does the correct thing). + +The test tables presented in this document are structured as follows: +\begin{itemize} + \item Column 1 contains the test name or number, together with any sub-name or +number + \item Column 2 contains the general description of the test. + \item Column 3, row 1 contains the description of the syntax test. + \item Column 3, row 2 contains the description of the algorithm test. + \item Column 4, row 1 contains the result of the syntax test (pass or fail). + \item Column 4, row 2 contains the result of the algorithm test (pass or fail). +\end{itemize} + +\subsection{Version} + +This report refers to version 2.4 of the LTPDA toolbox. + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/unit_test_doc/results.tex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/unit_test_doc/results.tex Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,27479 @@ +\section{Results} +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/abs} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/abs] method works with a vector of objects as input.} & Test that the [ao/abs] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/abs] method works with a matrix of objects as input.} & Test that the [ao/abs] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/abs] method works with a list of objects as input.} & Test that the [ao/abs] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/abs] method works with a mix of different arrays of objects as input.} & Tests that the [ao/abs] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/abs] method properly applies history.} & Test that the result of applying the [ao/abs] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/abs]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/abs] method can modify the input AO.} & Test that the [ao/abs] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/abs] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the [ao/abs] method uses the plist to get the axis.} & Test that the [ao/abs] method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the [ao/abs] method applies to the x-axis +2) Check that the [ao/abs] method applies to the y-axis +3) Check that the [ao/abs] method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/abs] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/abs] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/abs] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/abs.} +\label{tab:ao_abs} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/acos} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/acos] method works with a vector of objects as input.} & Test that the [ao/acos] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/acos] method works with a matrix of objects as input.} & Test that the [ao/acos] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/acos] method works with a list of objects as input.} & Test that the [ao/acos] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/acos] method works with a mix of different arrays of objects as input.} & Tests that the [ao/acos] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/acos] method properly applies history.} & Test that the result of applying the [ao/acos] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/acos]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/acos] method can modify the input AO.} & Test that the [ao/acos] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/acos] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the [ao/acos] method uses the plist to get the axis.} & Test that the [ao/acos] method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the [ao/acos] method applies to the x-axis +2) Check that the [ao/acos] method applies to the y-axis +3) Check that the [ao/acos] method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/acos] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/acos] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/acos] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/acos.} +\label{tab:ao_acos} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/and} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{rule1 (tsdata and tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (fsdata and fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (tsdata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (tsdata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (fsdata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (fsdata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector tsdata and single tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single xydata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector tsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector tsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector fsdata and single fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single xydata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector fsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector fsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector xydata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector xydata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector cdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP tsdata and single tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP tsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP tsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP fsdata and single fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP fsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP fsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP xydata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP xydata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP cdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP tsdata and NxQ tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP tsdata and NxQ xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP tsdata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP fsdata and NxQ fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP fsdata and NxQ xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP fsdata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP xydata and NxQ xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP xydata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP cdata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{and } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{tests (fsdata and tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (tsdata and fsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (AO no data and tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (tsdata and AO no data)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (different fs in tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (different x values in fsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (negative test)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (negative test)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline +\caption{Unit tests for ao/and.} +\label{tab:ao_and} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/angle} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/angle] method works with a vector of objects as input.} & Test that the [ao/angle] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/angle] method works with a matrix of objects as input.} & Test that the [ao/angle] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/angle] method works with a list of objects as input.} & Test that the [ao/angle] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/angle] method works with a mix of different arrays of objects as input.} & Tests that the [ao/angle] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/angle] method properly applies history.} & Test that the result of applying the [ao/angle] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/angle]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/angle] method can modify the input AO.} & Test that the [ao/angle] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/angle] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the [ao/angle] method uses the plist to get the axis.} & Test that the [ao/angle] method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the [ao/angle] method applies to the x-axis +2) Check that the [ao/angle] method applies to the y-axis +3) Check that the [ao/angle] method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/angle] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/angle] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/angle] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/angle.} +\label{tab:ao_angle} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/ao} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/ao] method works with a vector of objects as input.} & Test that the [ao/ao] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/ao] method works with a matrix of objects as input.} & Test that the [ao/ao] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/ao] method works with a list of objects as input.} & Test that the [ao/ao] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/ao] method works with a mix of different arrays of objects as input.} & Tests that the [ao/ao] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/ao] method properly applies history.} & Test that the result of applying the [ao/ao] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/ao]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the ao method properly applies history to the +ASCII-file constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'ao'. +2) Check that the rebuilt objects are the same as 'out1' and 'ouit2' & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests that the ao method properly applies history to the complex +ASCII-file constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'ao'. +2) Check that the read data are correct +3) Check that the rebuilt object is the same as in 'out1..5' & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Tests that the ao method properly applies history to the vals constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'ao'. +2) Check that the rebuilt object is the same as 'out'. & pass \\ \hline + \multirow{2}{3cm}{15 } & \multirow{2}{5cm}{Tests that the ao method properly applies history to the plist(fcn) constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'ao'. +2) Check that the rebuilt object is the same as 'out'. & pass \\ \hline + \multirow{2}{3cm}{16 } & \multirow{2}{5cm}{Tests that the ao method properly applies history to the plist(vals) constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'ao'. +2) Check that the rebuilt object is the same as 'out'. & pass \\ \hline + \multirow{2}{3cm}{17 } & \multirow{2}{5cm}{Tests that the ao method properly applies history to the plist(x/y-vals) constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'ao'. +2) Check that the rebuilt object is the same as 'out'. & pass \\ \hline + \multirow{2}{3cm}{18 } & \multirow{2}{5cm}{Tests that the ao method properly applies history to the plist(tsfcn) constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'ao'. +2) Check that the rebuilt object is the same as 'out'. & pass \\ \hline + \multirow{2}{3cm}{19 } & \multirow{2}{5cm}{Tests that the ao method properly applies history to the plist(fsfcn) constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'ao'. +2) Check that the rebuilt objects are the same as 'out1' and 'out2' & pass \\ \hline + \multirow{2}{3cm}{20 } & \multirow{2}{5cm}{Tests that the ao method properly applies history to the plist(win) constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to 'ao'. +2) Check that the rebuilt object is the same as 'out'. & pass \\ \hline + \multirow{2}{3cm}{21 } & \multirow{2}{5cm}{Tests that the ao method properly applies history to the plist(waveform) constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'ao'. +2) Check that the rebuilt objects are the same as 'out\_...'. & pass \\ \hline + \multirow{2}{3cm}{23 } & \multirow{2}{5cm}{Tests that the ao method properly applies history to the plist(polynomial) constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'ao'. +2) Check that the rebuilt object is the same as 'out'. & pass \\ \hline + \multirow{2}{3cm}{25 } & \multirow{2}{5cm}{Tests that the ao method properly applies history to the plist(pzmodel) constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'ao'. +2) Check that the rebuilt object is the same as 'out'. & pass \\ \hline + \multirow{2}{3cm}{26 } & \multirow{2}{5cm}{Tests that the ao method properly applies history to the data-object constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'ao'. & pass \\ \hline + \multirow{2}{3cm}{28 } & \multirow{2}{5cm}{Tests that the ao method properly applies history to the x-vector, y-vector constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'ao'. +2) Check that the rebuilt object is the same as 'out'. & pass \\ \hline + \multirow{2}{3cm}{29 } & \multirow{2}{5cm}{Tests that the ao method properly applies history to the filename + +plist constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'ao'. +2) Check that the rebuilt object is the same as 'out'. & pass \\ \hline + \multirow{2}{3cm}{30 } & \multirow{2}{5cm}{Tests that the ao method properly applies history to the filename + +plist constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'ao'. +2) Check the read data +3) Check that the rebuilt object is the same as 'out' & pass \\ \hline + \multirow{2}{3cm}{31 } & \multirow{2}{5cm}{Tests that the ao method properly applies history to the filename + plist constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'ao'. +2) Check that the rebuilt object is the same as 'out'. & pass \\ \hline + \multirow{2}{3cm}{60 } & \multirow{2}{5cm}{Tests that the constructor method doesn't apply history to the read +MAT-file constructor.} & Tests that the constructor method doesn't apply history to the read +MAT-file constructor. & pass \\ \cline{3-4} + & & 1) Check that the history is the same as the history of the saved +object. Because save and load shouldn't add a history step. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{61 } & \multirow{2}{5cm}{Tests that the constructor properly applies history to the read +XML-file constructor.} & Tests that the constructor properly applies history to the read +XML-file constructor. & pass \\ \cline{3-4} + & & 1) Check that the history is the same as the history of the saved +object. Because save and load shouldn't add a history step. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{62 } & \multirow{2}{5cm}{Tests that the constructor properly applies history in the struct constructor.} & Tests that the constructor properly applies history in the struct constructor. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to the class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{64 } & \multirow{2}{5cm}{Tests that the contructor properly applies history to the +plist(filename) constructor.} & Tests that the contructor properly applies history to the +plist(filename) constructor. & pass \\ \cline{3-4} + & & 1) Check that the save method doesn't change the input object +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{65 } & \multirow{2}{5cm}{Tests that the contructed object can be submitted and retrieved.} & Tests that the contructed object can be submitted and retrieved. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +the class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{66 } & \multirow{2}{5cm}{Tests that the construuctor properly works with the plist(pzmodel) +constructor.} & Tests that the constructor properly works with the plist(pzmodel) +constructor. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'ssm'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{67 } & \multirow{2}{5cm}{Tests that the constructor properly applies history to the +pole/zero model + plist object constructor.} & Tests that the constructor properly applies history to the +pole/zero model + plist object constructor. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{68 } & \multirow{2}{5cm}{Tests that the constructor properly applies history to the conn+Id constructor.} & Tests that the constructor properly applies history to the conn+Id +constructor. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for ao/ao.} +\label{tab:ao_ao} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/asin} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/asin] method works with a vector of objects as input.} & Test that the [ao/asin] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/asin] method works with a matrix of objects as input.} & Test that the [ao/asin] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/asin] method works with a list of objects as input.} & Test that the [ao/asin] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/asin] method works with a mix of different arrays of objects as input.} & Tests that the [ao/asin] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/asin] method properly applies history.} & Test that the result of applying the [ao/asin] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/asin]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/asin] method can modify the input AO.} & Test that the [ao/asin] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/asin] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the [ao/asin] method uses the plist to get the axis.} & Test that the [ao/asin] method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the [ao/asin] method applies to the x-axis +2) Check that the [ao/asin] method applies to the y-axis +3) Check that the [ao/asin] method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/asin] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/asin] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/asin] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/asin.} +\label{tab:ao_asin} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/atan} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/atan] method works with a vector of objects as input.} & Test that the [ao/atan] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/atan] method works with a matrix of objects as input.} & Test that the [ao/atan] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/atan] method works with a list of objects as input.} & Test that the [ao/atan] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/atan] method works with a mix of different arrays of objects as input.} & Tests that the [ao/atan] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/atan] method properly applies history.} & Test that the result of applying the [ao/atan] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/atan]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/atan] method can modify the input AO.} & Test that the [ao/atan] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/atan] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the [ao/atan] method uses the plist to get the axis.} & Test that the [ao/atan] method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the [ao/atan] method applies to the x-axis +2) Check that the [ao/atan] method applies to the y-axis +3) Check that the [ao/atan] method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/atan] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/atan] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/atan] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/atan.} +\label{tab:ao_atan} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/atan2} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the atan2 method works only with two AOs as input..} & Tests that the atan2 method works only with two AOs as input.. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the atan2 method properly applies history.} & Test that the result of applying the atan2 method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'atan2'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the atan2 method can not be used as a modifier method.} & Tests that the atan2 method can not be used as a modifier method. The +command should fail. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline +\caption{Unit tests for ao/atan2.} +\label{tab:ao_atan2} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/average} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the average method works with a vector of AOs as input.} & Tests that the average method works with a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the outputs have exactly one AO +2) Check that the outputs have the correct data. +3) Check the rebuilt objects & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the average method works with a matrix of AOs as input.} & Tests that the average method works with a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the outputs have exactly one AO +2) Check that the outputs have the correct data. +3) Check the rebuilt objects & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the average method works with a list of AOs as input.} & Tests that the average method works with a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the outputs have exactly one AO +2) Check that the outputs have the correct data. +3) Check the rebuilt objects & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the average method works with a mix of different shaped AOs as +input.} & Tests that the average method works with a mix of different shaped AOs as +input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one AO +2) Check that the output have the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/average] method properly applies history.} & Test that the result of applying the [ao/average] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/average]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the average method cannot modify the input AO. +The method must throw an error for the modifier call.} & Test that the average method cannot modify the input AO by calling with +no output & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the average method keeps the data shape of the input +object. The input AO must be an AO with row data and an AO with +column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{18 } & \multirow{2}{5cm}{Tests that the average method works with a single AO as input.} & Tests that the average method works with a single AO as input. & pass \\ \cline{3-4} + & & 1) Check that the outputs have exactly one AO +2) Check that the outputs have the correct data. +3) Check the rebuilt objects & pass \\ \hline +\caption{Unit tests for ao/average.} +\label{tab:ao_average} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf bin/data} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [bin/data] method works with a vector of objects as input.} & Test that the [bin/data] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [bin/data] method works with a matrix of objects as input.} & Test that the [bin/data] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [bin/data] method works with a list of objects as input.} & Test that the [bin/data] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [bin/data] method works with a mix of different arrays of objects as input.} & Tests that the [bin/data] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [bin/data] method properly applies history.} & Test that the result of applying the [bin/data] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[bin/data]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [bin/data] method can modify the input AO.} & Test that the [bin/data] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [bin/data] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [bin/data] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [bin/data] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{17 } & \multirow{2}{5cm}{Tests handling of units: +1) rebinning of the PSD data +2) rebinning of the LPSD data +3) compares the units of the input and output} & 1) Rebinning the data & pass \\ \cline{3-4} + & & 1) Check that (rebinned PSD yunits) equals (input PSD yunits) +2) Check that (rebinned PSD xunits) equals (input PSD xunits) +3) Check that (rebinned LPSD yunits) equals (input LPSD yunits) +4) Check that (rebinned LPSD xunits) equals (input LPSD xunits) & pass \\ \hline + \multirow{2}{3cm}{18 } & \multirow{2}{5cm}{Tests handling of units: +1) rebinning of the PSD data +2) rebinning of the LPSD data +3) compares the units of the input and output} & 1) Rebinning the data & pass \\ \cline{3-4} + & & 1) Check that (rebinned PSD yunits) equals (input PSD yunits) +2) Check that (rebinned PSD xunits) equals (input PSD xunits) +3) Check that (rebinned LPSD yunits) equals (input LPSD yunits) +4) Check that (rebinned LPSD xunits) equals (input LPSD xunits) & pass \\ \hline + \multirow{2}{3cm}{19 } & \multirow{2}{5cm}{Tests handling of units: +1) rebinning of the PSD data +2) rebinning of the LPSD data +3) compares the units of the input and output} & 1) Rebinning the data & pass \\ \cline{3-4} + & & 1) Check that (rebinned PSD yunits) equals (input PSD yunits) +2) Check that (rebinned PSD xunits) equals (input PSD xunits) +3) Check that (rebinned LPSD yunits) equals (input LPSD yunits) +4) Check that (rebinned LPSD xunits) equals (input LPSD xunits) & pass \\ \hline + \multirow{2}{3cm}{20 } & \multirow{2}{5cm}{Tests handling of units: +1) rebinning of the PSD data +2) rebinning of the LPSD data} & 1) Rebinning the data & pass \\ \cline{3-4} + & & Nothing to check & pass \\ \hline + \multirow{2}{3cm}{21 } & \multirow{2}{5cm}{Tests handling of units: +1) rebinning of the PSD data +2) rebinning of the LPSD data} & 1) Rebinning the data & pass \\ \cline{3-4} + & & Nothing to check & pass \\ \hline +\caption{Unit tests for bin/data.} +\label{tab:bin_data} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/cat} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/cat] method works with a vector of objects as input.} & Test that the [ao/cat] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/cat] method works with a matrix of objects as input.} & Test that the [ao/cat] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/cat] method works with a list of objects as input.} & Test that the [ao/cat] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/cat] method works with a mix of different arrays of objects as input.} & Tests that the [ao/cat] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{The cat method doesn't apply history.} & The cat method doesn't apply history. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{The cat method can not be used as a modifer method.} & The cat method can not be used as a modifer method. In this case +throws the method an error. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline +\caption{Unit tests for ao/cat.} +\label{tab:ao_cat} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/char} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the char method works with a vector of AOs as input.} & Test that the char method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the char method works with a matrix of AOs as input.} & Test that the char method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the char method works with a list of AOs as input.} & Test that the char method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the char method works with a mix of different shaped AOs as +input.} & Test that the char method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the char method properly applies history.} & The method char doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for ao/char.} +\label{tab:ao_char} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/cohere} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the cohere method works with a vector of AOs as input.} & Test that the cohere method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is 1 +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Test that the cohere method doesn't work for a matrix of AOs as input.} & Test that the cohere method doesn't work for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Nothing to check & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the cohere method works with a list of AOs as input (only +two objects).} & Test that the cohere method works for a list of AOs as input. (only +two objects) & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is 1. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Test that the cohere method doesn't work with an input of matrices +and vectors and single AOs.} & Test that the cohere method doesn't work with an input of matrices +and vectors and single AOs. & pass \\ \cline{3-4} + & & 1) Nothing to check & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the cohere method properly applies history.} & Test that the result of applying the cohere method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'cohere'. +2) Check that the rebuilt object is the same as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the cohere method can not modify the input AO.} & Test that the cohere method can not modify the input AO. +The method must throw an error for the modifier call. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the plus method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the output data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the cohere method pass back the output objects to a list of +output variables or to a single variable.} & This test is not longer necessary because the cohere method pass back +always only one object. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Tests that the cohere method agrees with MATLAB's mscohere when +configured to use the same parameters.} & Test that the applying cohere works on two AOs. & pass \\ \cline{3-4} + & & 1) Check that output agrees with the output of MATLAB's mscohere. +2) Check that the shape of the output data is equal to the input data & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/cohere] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Tests symmetry properties of complex-coherence: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) complex coherence of the white noise series +4) compare C(x,y) with conj(C(y,x)) +5) compare C(x,x) and C(y,y) with 1} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) complex coherence of the white noise & pass \\ \cline{3-4} + & & 1) Check that C(x,y) equals conj(C(y,x)) +2) Check that C(x,x) equals 1 +2) Check that C(y,y) equals 1 & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Tests symmetry properties of complex-coherence: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) magnitude-squared coherence of the white noise series +4) compare C(x,y) with C(y,x) +5) compare C(x,x) and C(y,y) with 1} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) magnitude-squared coherence of the white noise & pass \\ \cline{3-4} + & & 1) Check that C(x,y) equals C(y,x) +1) Check that C(x,x) equals 1 +1) Check that C(y,y) equals 1 & pass \\ \hline + \multirow{2}{3cm}{14 } & \multirow{2}{5cm}{Tests symmetry properties of complex-coherence: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) complex coherence of the combination of white noise series +4) compare C(x,y) with 1} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) complex coherence of the combination of noise & pass \\ \cline{3-4} + & & 1) Check that the complex coherence equals 1 & pass \\ \hline + \multirow{2}{3cm}{15 } & \multirow{2}{5cm}{Tests symmetry properties of complex-coherence: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) magnitude-squared coherence of the combination of white noise series +4) compare C(x,y) with 1} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) magnitude-squared coherence of the combination of noise & pass \\ \cline{3-4} + & & 1) Check that the magnitude-squared coherence equals 1 & pass \\ \hline + \multirow{2}{3cm}{16 } & \multirow{2}{5cm}{Tests symmetry properties of complex-coherence: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) magnitude-squared coherence M of the combination of white noise series +4) complex coherence C of the combination of white noise series +5) compare abs(C)\^2 with M} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) magnitude-squared coherence of the combination of noise & pass \\ \cline{3-4} + & & 1) Check that the magnitude-squared coherence equals the square +modulus of the complex coherence & pass \\ \hline + \multirow{2}{3cm}{17 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) complex coherence of the white noise series +4) compares the units of the input and output} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) complex cohere of the white noise & pass \\ \cline{3-4} + & & 1) Check that (complex coherence yunits) equals [1] +2) Check that (complex coherence xunits) equals [Hz] & pass \\ \hline + \multirow{2}{3cm}{18 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) magnitude-squared coherence of the white noise series +4) compares the units of the input and output} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) magnitude-squared cohere of the white noise & pass \\ \cline{3-4} + & & 1) Check that (magnitude-squared coherence yunits) equals [1] +2) Check that (magnitude-squared coherence xunits) equals [Hz] & pass \\ \hline + \multirow{2}{3cm}{19 } & \multirow{2}{5cm}{Tests that differently sized data sets are treated properly} & Test that applying cohere works on two AOs. & pass \\ \cline{3-4} + & & 1) Check that cohere used the length of the shortest ao. & pass \\ \hline + \multirow{2}{3cm}{20 } & \multirow{2}{5cm}{Tests that applying a single window the coherence is 1} & Test that applying cohere works on two AOs. & pass \\ \cline{3-4} + & & 1) Check that the calculated cohere is 1 & pass \\ \hline + \multirow{2}{3cm}{21 } & \multirow{2}{5cm}{Tests the possibility to set the number of averages rather than setting the Nfft: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) cohere of the noise, without detrending, random window, set number of +averages +3) check the effective number of averages} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) cohere of the noise, without detrending, random window, set number of +averages & pass \\ \cline{3-4} + & & 1) Check that calculated navs are identical to those requested & pass \\ \hline + \multirow{2}{3cm}{22 } & \multirow{2}{5cm}{Tests the possibility to set the number of averages rather than setting the Nfft: +1) white noise produced from uniform pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) cohere of the noise, without detrending, random window, random navs +3) get the number of averages +4) get the nfft used +5) run cohere again, with the nfft used +6) compare the calculated objects} & 1) white noise produced from uniform pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) cohere of the noise, without detrending, random window, random navs +3) get the number of averages +4) get the nfft used +5) run cohere again, with the nfft used & pass \\ \cline{3-4} + & & 1) Check that calculated objects C1 and C2 are identical & pass \\ \hline + \multirow{2}{3cm}{23 } & \multirow{2}{5cm}{Tests the possibility to set the number of averages rather than setting the Nfft: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) cohere of the noise, without detrending, random window, random navs +3) get the number of averages +4) get the nfft used +5) run cohere again, with the nfft used +6) compare navs, nfft, coheres} & 1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) cohere of the noise, without detrending, random window, random navs +3) get the number of averages +4) get the nfft used +5) run cohere again, with the nfft used +6) run cohere again, with conflicting parameters, and verify it uses +nfft rather than navs & pass \\ \cline{3-4} + & & 1) Check that calculated objects C1 and C2 are identical +2) Check that C3 used different values & pass \\ \hline + \multirow{2}{3cm}{24 } & \multirow{2}{5cm}{Tests that the cohere method agrees with MATLAB's mscohere when +configured to use the same parameters.} & Test that the applying cohere works on two AOs. & pass \\ \cline{3-4} + & & 1) Check that output agrees with the output of MATLAB's mscohere. +2) Check that the shape of the output data is equal to the input data & pass \\ \hline + \multirow{2}{3cm}{25 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) complex coherence of the white noise series +4) compares the units of the input and output} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) complex cohere of the white noise & pass \\ \cline{3-4} + & & 1) Check that (complex coherence yunits) equals [1] +2) Check that (complex coherence xunits) equals [Hz] & pass \\ \hline + \multirow{2}{3cm}{26 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) complex coherence of the white noise series +4) compares the units of the input and output} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) complex cohere of the white noise & pass \\ \cline{3-4} + & & 1) Check that (complex coherence yunits) equals [1] +2) Check that (complex coherence xunits) equals [Hz] & pass \\ \hline + \multirow{2}{3cm}{30 } & \multirow{2}{5cm}{Tests handling of special cases: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) the same noise series +3) cohere of the white noise series +4) compares the output to unity} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +the same data as 1) and 2) +4) cohere of the series & pass \\ \cline{3-4} + & & 1) Check that calculated cohere equals 1 & pass \\ \hline +\caption{Unit tests for ao/cohere.} +\label{tab:ao_cohere} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/complex} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the complex method works with a vector of AOs as input.} & Test that the complex method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is 1. +2) Check that the output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the complex method works with a list of AOs as input.} & Test that the complex method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is 1. +2) Check that the output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the complex method can not modify the input AO.} & Test that the complex method can not modify the input AO. +The method must throw an error for the modifier call. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/complex] method properly applies history.} & Test that the result of applying the [ao/complex] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/complex]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the complex method keeps the data shape of the first input object. +the input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/complex] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/complex.} +\label{tab:ao_complex} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/compute} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the complex method works with a vector of AOs as input.} & Test that the complex method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is 1. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the compute method works with a matrix of AOs as input.} & Test that the compute method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is 2. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the compute method works with a list of AOs as input.} & Test that the compute method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is 2. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the compute method works with a mix of different shaped AOs as +input.} & Test that the compute method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is 2. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the compute method applies no history.} & Test that the result of applying the compute method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' is not +'compute'. +2) Check that the rebuilt object is the same as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/compute] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/compute.} +\label{tab:ao_compute} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/conj} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/conj] method works with a vector of objects as input.} & Test that the [ao/conj] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/conj] method works with a matrix of objects as input.} & Test that the [ao/conj] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/conj] method works with a list of objects as input.} & Test that the [ao/conj] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/conj] method works with a mix of different arrays of objects as input.} & Tests that the [ao/conj] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/conj] method properly applies history.} & Test that the result of applying the [ao/conj] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/conj]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/conj] method can modify the input AO.} & Test that the [ao/conj] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/conj] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the [ao/conj] method uses the plist to get the axis.} & Test that the [ao/conj] method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the [ao/conj] method applies to the x-axis +2) Check that the [ao/conj] method applies to the y-axis +3) Check that the [ao/conj] method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/conj] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/conj] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/conj] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Check that the errors are cleared for this method.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output has no error fields & pass \\ \hline +\caption{Unit tests for ao/conj.} +\label{tab:ao_conj} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/conv} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the conv method works with a vector of AOs as input.} & Test that the conv method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one Ao with cdata. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the conv method works with a matrix of AOs as input.} & Test that the conv method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one Ao with cdata. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the conv method works with a list of AOs as input.} & Test that the conv method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one Ao with cdata. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the conv method works with a mix of different shaped AOs as +input.} & Test that the conv method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one Ao with cdata. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the conv method properly applies history.} & Test that the result of applying the conv method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'conv'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{The conv method can not modify the input AO.} & The conv method throws an error if it is uesed as a modifier. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/conv] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/conv.} +\label{tab:ao_conv} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/convert} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the convert method works with a vector of AOs as input.} & Test that the convert method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the convert method works with a matrix of AOs as input.} & Test that the convert method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the convert method works with a list of AOs as input.} & Tests that the convert method works with a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the convert method works with a mix of different shaped AOs +as input.} & Tests that the convert method works with a mix of different shaped AOs as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the convert method properly applies history.} & Test that the result of applying the convert method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'convert'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the convert method can modify the input AO.} & Test that the convert method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the convert value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the convert method can modify the input object depending +to the plist. & pass \\ \cline{3-4} + & & 1) Check that the convert method aplpiesthe different actions +4) Check that the rebuilt objects are the same as 'out[1..6]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the convert method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the convert method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/convert] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/convert.} +\label{tab:ao_convert} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/copy} &&& \\ \hline +\endhead + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline +\caption{Unit tests for ao/copy.} +\label{tab:ao_copy} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/cos} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/cos] method works with a vector of objects as input.} & Test that the [ao/cos] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/cos] method works with a matrix of objects as input.} & Test that the [ao/cos] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/cos] method works with a list of objects as input.} & Test that the [ao/cos] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/cos] method works with a mix of different arrays of objects as input.} & Tests that the [ao/cos] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/cos] method properly applies history.} & Test that the result of applying the [ao/cos] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/cos]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/cos] method can modify the input AO.} & Test that the [ao/cos] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/cos] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the [ao/cos] method uses the plist to get the axis.} & Test that the [ao/cos] method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the [ao/cos] method applies to the x-axis +2) Check that the [ao/cos] method applies to the y-axis +3) Check that the [ao/cos] method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/cos] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/cos] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/cos] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/cos.} +\label{tab:ao_cos} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/cov} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the cov method works with a vector of AOs as input.} & Test that the cov method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one Ao with cdata. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the cov method works with a matrix of AOs as input.} & Test that the cov method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one Ao with cdata. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the cov method works with a list of AOs as input.} & Tests that the cov method works with a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one Ao with cdata. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the cov method works with a mix of different shaped AOs as +input.} & Tests that the cov method works with a mix of different shaped AOs as +input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one Ao with cdata. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the cov method properly applies history.} & Test that the result of applying the cov method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'cov'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{The cov method can not modify the input AO.} & The cov method can not modify the input AO. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/cov] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/cov.} +\label{tab:ao_cov} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/cpsd} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the cpsd method works with a vector of AOs as input. (only +with two objects in the vector)} & Test that the cpsd method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the cpsd method doesn't work with a matrix of AOs as input.} & Test that the cpsd method doesn't work for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the cpsd method works with a list of AOs as input.} & Test that the cpsd method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the cpsd method doesn't work with a mix of different shaped +AOs as input.} & Test that the cpsd method doesn't work with an input of matrices and +vectors and single AOs. & pass \\ \cline{3-4} + & & 1) Nothing to check & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the cpsd method properly applies history.} & Test that the result of applying the cpsd method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'cpsd'. +2) Check that the rebuilt object is the same as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the cpsd method can not modify the input AO.} & Test that the cpsd method can not modify the input AO. +The method must throw an error for the modifier call. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the cpsd method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the output data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the cpsd method pass back the output objects to a list of +output variables or to a single variable.} & This test is not longer necessary because the cpsd method pass back +always only one object. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Tests that the cpsd method agrees with MATLAB's cpsd when +configured to use the same parameters.} & Test that the applying cpsd works on two AOs. & pass \\ \cline{3-4} + & & 1) Check that output agrees with the output of MATLAB's cpsd. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/cpsd] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{17 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) CPSD of the white noise series +4) compares the units of the input and output} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) CPSD of the white noise & pass \\ \cline{3-4} + & & 1) Check that (calculated CPSD yunits) equals +input\_1 units*input\_2 units/Hz & pass \\ \hline + \multirow{2}{3cm}{18 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) CPSD of the white noise series +Comparison with PSD: +4) compares the off-diagonal terms to check they are complex-conjugated +5) compares the diagonal terms with PSD of the individual noise} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) CPSD of the white noise +6) PSD of the white noise & pass \\ \cline{3-4} + & & 1) Check that CPSD(x,y) equals conj(CPSD(y,x)) +2) Check that CPSD(x,x) equals PSD(x) +3) Check that CPSD(y,y) equals PSD(y) & pass \\ \hline + \multirow{2}{3cm}{24 } & \multirow{2}{5cm}{Tests that differently sized data sets are treated properly} & Test that applying cpsd works on two AOs. & pass \\ \cline{3-4} + & & 1) Check that cpsd used the length of the shortest ao. & pass \\ \hline + \multirow{2}{3cm}{25 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) CPSD of the white noise series +4) compares the units of the input and output} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) CPSD of the white noise & pass \\ \cline{3-4} + & & 1) Check that (calculated CPSD yunits) equals +input\_1 units*input\_2 units/Hz & pass \\ \hline + \multirow{2}{3cm}{51 } & \multirow{2}{5cm}{Tests the possibility to set the number of averages rather than setting the Nfft: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) cpsd of the noise, without detrending, random window, set number of +averages +3) check the effective number of averages} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) cpsd of the noise, without detrending, random window, set number of +averages & pass \\ \cline{3-4} + & & 1) Check that calculated navs are identical to those requested & pass \\ \hline + \multirow{2}{3cm}{52 } & \multirow{2}{5cm}{Tests the possibility to set the number of averages rather than setting the Nfft: +1) white noise produced from uniform pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) cpsd of the noise, without detrending, random window, random navs +3) get the number of averages +4) get the nfft used +5) run cpsd again, with the nfft used +6) compare the calculated objects} & 1) white noise produced from uniform pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) cpsd of the noise, without detrending, random window, random navs +3) get the number of averages +4) get the nfft used +5) run cpsd again, with the nfft used & pass \\ \cline{3-4} + & & 1) Check that calculated objects C1 and C2 are identical & pass \\ \hline + \multirow{2}{3cm}{53 } & \multirow{2}{5cm}{Tests the possibility to set the number of averages rather than setting the Nfft: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) cpsd of the noise, without detrending, random window, random navs +3) get the number of averages +4) get the nfft used +5) run cpsd again, with the nfft used +6) compare navs, nfft, psds} & 1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) cpsd of the noise, without detrending, random window, random navs +3) get the number of averages +4) get the nfft used +5) run cpsd again, with the nfft used +6) run cpsd again, with conflicting parameters, and verify it uses +nfft rather than navs & pass \\ \cline{3-4} + & & 1) Check that calculated objects C1 and C2 are identical +2) Check that C3 used different values & pass \\ \hline +\caption{Unit tests for ao/cpsd.} +\label{tab:ao_cpsd} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/created} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the created method works with a vector of AOs as input.} & Test that the created method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the created method works with a matrix of AOs as input.} & Test that the created method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the created method works with a list of AOs as input.} & Test that the created method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the created method works with a mix of different shaped AOs +as input.} & Test that the created method works with an input of matrices and +vectors and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the created method properly applies history} & This method doesn't change the input object, thus no history is added +to the object. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the created method can be used with the modify command.} & Tests that the created method can be used with the modify command. & pass \\ \cline{3-4} + & & 1) Check the single object +2) Check the matrix object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the created method retruns always a well defined time object +even for an empty input object.} & Test that the created method with an empty AO & pass \\ \cline{3-4} + & & 1) Check that the output is a time object with a ell defined time. & pass \\ \hline +\caption{Unit tests for ao/created.} +\label{tab:ao_created} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/creator} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the creator method works with a vector of AOs as input.} & Test that the creator method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the creator method works with a matrix of AOs as input.} & Test that the creator method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the creator method works with a list of AOs as input.} & The creator method doesn't work for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the creator method works with a mix of different shaped +AOs as input.} & The creator method doesn't work with different shaped input objects. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the creator method properly applies history} & This method doesn't change the input object, thus no history is added +to the object. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the creator method can be used with the modify command.} & Tests that the creator method can be used with the modify command. & pass \\ \cline{3-4} + & & 1) Check the single object +2) Check the matrix object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the creator method retruns all creator(s)/modifier(s) which +are in the history.} & Test that the creator method uses the option 'all' direct or in a +plist. The test file must have the modifier 'first', 'second' and +'third' & pass \\ \cline{3-4} + & & 1) Check that out1 contains only one creator +2) Check that out2 contain more creator/modifier & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests the negative case for the option 'all'.} & Test that the creator method throws an error if the option 'all' is +used in connection with a matrix/vector of AOs. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline +\caption{Unit tests for ao/creator.} +\label{tab:ao_creator} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/ctranspose} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/ctranspose] method works with a vector of objects as input.} & Test that the [ao/ctranspose] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/ctranspose] method works with a matrix of objects as input.} & Test that the [ao/ctranspose] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/ctranspose] method works with a list of objects as input.} & Test that the [ao/ctranspose] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/ctranspose] method works with a mix of different arrays of objects as input.} & Tests that the [ao/ctranspose] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/ctranspose] method properly applies history.} & Test that the result of applying the [ao/ctranspose] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/ctranspose]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the ctranspose method can modify the input AO.} & Test that the ctranspose method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is ctranspose(at1). & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the abs method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/ctranspose] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/ctranspose] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Check that the errors are cleared for this method.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output has no error fields & pass \\ \hline +\caption{Unit tests for ao/ctranspose.} +\label{tab:ao_ctranspose} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/delay} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/delay] method works with a vector of objects as input.} & Test that the [ao/delay] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/delay] method works with a matrix of objects as input.} & Test that the [ao/delay] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/delay] method works with a list of objects as input.} & Test that the [ao/delay] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/delay] method works with a mix of different arrays of objects as input.} & Tests that the [ao/delay] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/delay] method properly applies history.} & Test that the result of applying the [ao/delay] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/delay]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/delay] method can modify the input AO.} & Test that the [ao/delay] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/delay] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/delay] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/delay] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/delay] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Check that the errors are cleared for this method.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output has no error fields & pass \\ \hline +\caption{Unit tests for ao/delay.} +\label{tab:ao_delay} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/demux} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the demux method works with a mix of different shaped AOs as +input.} & Tests that the demux method works with a mix of different shaped AOs +as input. & pass \\ \cline{3-4} + & & 1) Check the output objects. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Negative test. +Check that the demux method throwns an error for too few output +variables.} & Check that the demux method throwns an error for too few output +variables. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Negative test. +Check that the demux method throwns an error for too many output +variables.} & Check that the demux method throwns an error for too few output +variables. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline +\caption{Unit tests for ao/demux.} +\label{tab:ao_demux} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/det} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the det method works with a vector of AOs as input.} & Test that the det method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the det method works with a matrix of AOs as input.} & Test that the det method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the det method works with a list of AOs as input.} & Test that the det method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the det method works with a mix of different shaped AOs as +input.} & Test that the det method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the det method properly applies history.} & Test that the result of applying the det method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'det'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the det method can modify the input AO.} & Test that the det method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'at4' and 'ain' are now different. +2) Check that 'ain' is det(at4). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the det method can modify the single axis controlled by the +plist and the resuld can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the det method applies to the x-axis +2) Check that the det method applies to the y-axis +3) Check that the det method applies to both axes +4) Check that the re-built objects are the same object as 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the det method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the det method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/det] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Check that the errors are cleared for this method.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output has no error fields & pass \\ \hline +\caption{Unit tests for ao/det.} +\label{tab:ao_det} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/detrend} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/detrend] method works with a vector of objects as input.} & Test that the [ao/detrend] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/detrend] method works with a matrix of objects as input.} & Test that the [ao/detrend] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/detrend] method works with a list of objects as input.} & Test that the [ao/detrend] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/detrend] method works with a mix of different arrays of objects as input.} & Tests that the [ao/detrend] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/detrend] method properly applies history.} & Test that the result of applying the [ao/detrend] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/detrend]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/detrend] method can modify the input AO.} & Test that the [ao/detrend] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/detrend] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/detrend] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/detrend] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/detrend] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Check that the errors are cleared for this method.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output has no error fields & pass \\ \hline +\caption{Unit tests for ao/detrend.} +\label{tab:ao_detrend} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/dft} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/dft] method works with a vector of objects as input.} & Test that the [ao/dft] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/dft] method works with a matrix of objects as input.} & Test that the [ao/dft] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/dft] method works with a list of objects as input.} & Test that the [ao/dft] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/dft] method works with a mix of different arrays of objects as input.} & Tests that the [ao/dft] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/dft] method properly applies history.} & Test that the result of applying the [ao/dft] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/dft]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/dft] method can modify the input AO.} & Test that the [ao/dft] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/dft] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/dft] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/dft] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/dft] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Check that the errors are cleared for this method.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output has no error fields & pass \\ \hline +\caption{Unit tests for ao/dft.} +\label{tab:ao_dft} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/diag} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the diag method works with a vector of AOs as input.} & Test that the diag method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the diag method works with a matrix of AOs as input.} & Test that the diag method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the diag method works with a list of AOs as input.} & Test that the diag method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the diag method works with a mix of different shaped AOs as +input.} & Test that the diag method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the diag method properly applies history.} & Test that the result of applying the diag method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'diag'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the diag method can modify the input AO.} & Test that the diag method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'at4' and 'ain' are now different. +2) Check that 'ain' is diag(at4). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the diag method can modify the single axis controlled by the +plist and the resuld can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the svd method applies with different options. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the diag method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the diag method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/diag] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Check that the errors are cleared for this method.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output has no error fields & pass \\ \hline +\caption{Unit tests for ao/diag.} +\label{tab:ao_diag} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/diff} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/diff] method works with a vector of objects as input.} & Test that the [ao/diff] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/diff] method works with a matrix of objects as input.} & Test that the [ao/diff] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/diff] method works with a list of objects as input.} & Test that the [ao/diff] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/diff] method works with a mix of different arrays of objects as input.} & Tests that the [ao/diff] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/diff] method properly applies history.} & Test that the result of applying the [ao/diff] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/diff]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/diff] method can modify the input AO.} & Test that the [ao/diff] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/diff] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/diff] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/diff] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/diff] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Check that the errors are cleared for this method.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output has no error fields & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Control the method with a plist.} & Test the computation of derivative using a 2nd order & pass \\ \cline{3-4} + & & 1) Check that the diff method uses the 2nd order derivative. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{14 } & \multirow{2}{5cm}{Control the method with a plist.} & Test the computation of derivative using a 2nd order with a parabolic fit & pass \\ \cline{3-4} + & & 1) Check that the diff method uses the 2nd order derivative with a +parabolic fit +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{15 } & \multirow{2}{5cm}{Control the method with a plist.} & Test the 5 point derivative. & pass \\ \cline{3-4} + & & 1) Check that the diff method uses the 5 point derivative. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline +\caption{Unit tests for ao/diff.} +\label{tab:ao_diff} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/display} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the display method works with a vector of AOs as input.} & Test that the display method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the display method works with a matrix of AOs as input.} & Test that the display method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the display method works with a list of AOs as input.} & Test that the display method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the display method works with a mix of different shaped AOs as +input.} & Test that the display method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the display method properly applies history.} & The method display doesn't change the data, thus it is not possible to +check the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for ao/display.} +\label{tab:ao_display} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/dopplercorr} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the dopplercorr method works with a vector of AOs as input.} & Test that the dopplercorr method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the dopplercorr method works with a matrix of AOs as input.} & Test that the dopplercorr method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the dopplercorr method works with a list of AOs as input.} & Test that the dopplercorr method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the dopplercorr method works with a mix of different shaped AOs as +input.} & Test that the dopplercorr method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the dopplercorr method properly applies history.} & Test that the result of applying the dopplercorr method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'dopplercorr'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Check that the dopplercorr method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/dopplercorr] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/dopplercorr.} +\label{tab:ao_dopplercorr} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/downsample} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the downsample method works with a vector of AOs as input.} & Test that the downsample method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the downsample method works with a matrix of AOs as input.} & Test that the downsample method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the downsample method works with a list of AOs as input.} & Test that the downsample method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the downsample method works with a mix of different shaped AOs as +input.} & Test that the downsample method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the downsample method properly applies history.} & Test that the result of applying the downsample method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'downsample'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the downsample method can modify the input AO.} & Test that the downsample method can modify the input AO by calling with no +output. & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is downsample(at1). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the downsample method keeps the data shape of the input object.} & Test that the downsample method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the downsample method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Control the method with a plist.} & Test the downsample method with a factor and an offset. & pass \\ \cline{3-4} + & & 1) Check that the downsample method with an offset and a factor +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/downsample] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Check that the errors are cleared for this method.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output has no error fields & pass \\ \hline +\caption{Unit tests for ao/downsample.} +\label{tab:ao_downsample} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/dropduplicates} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the dropduplicates method works with a vector of AOs as input.} & Test that the dropduplicates method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the dropduplicates method works with a matrix of AOs as input.} & Test that the dropduplicates method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the dropduplicates method works with a list of AOs as input.} & Test that the dropduplicates method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the dropduplicates method works with a mix of different shaped AOs as +input.} & Test that the dropduplicates method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the dropduplicates method properly applies history.} & Test that the result of applying the dropduplicates method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'dropduplicates'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the dropduplicates method can modify the input AO.} & Test that the dropduplicates method can modify the input AO by calling +with no output. & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is dropduplicates(at1). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the dropduplicates method keeps the data shape of the input object.} & Test that the dropduplicates method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the dropduplicates method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Control the method with a plist.} & Test the dropduplicates method with different tolerances. & pass \\ \cline{3-4} + & & 1) Check that the different tolerances +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/dropduplicates] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/dropduplicates.} +\label{tab:ao_dropduplicates} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/dsmean} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the dsmean method works with a vector of AOs as input.} & Test that the dsmean method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the dsmean method works with a matrix of AOs as input.} & Test that the dsmean method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the dsmean method works with a list of AOs as input.} & Test that the dsmean method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the dsmean method works with a mix of different shaped AOs as +input.} & Test that the dsmean method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the dsmean method properly applies history.} & Test that the result of applying the dsmean method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'dsmean'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the dsmean method can modify the input AO.} & Test that the dsmean method can modify the input AO by calling +with no output. & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is dsmean(at1). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the dsmean method keeps the data shape of the input object.} & Test that the dsmean method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the dsmean method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/dsmean] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Check that the errors are cleared for this method.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output has no error fields & pass \\ \hline +\caption{Unit tests for ao/dsmean.} +\label{tab:ao_dsmean} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/eig} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the eig method works with a vector of AOs as input.} & Test that the eig method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the eig method works with a matrix of AOs as input.} & Test that the eig method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the eig method works with a list of AOs as input.} & Test that the eig method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the eig method works with a mix of different shaped AOs as +input.} & Test that the eig method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the eig method properly applies history.} & Test that the result of applying the eig method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'eig'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the eig method can modify the input AO.} & Test that the eig method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'at4' and 'ain' are now different. +2) Check that 'ain' is eig(at4). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the eig method can modify the single axis controlled by the +plist and the resuld can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the svd method applies with different options. +2) Check that the re-built objects are the same object as 'out[1..2]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the eig method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the eig method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/eig] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/eig.} +\label{tab:ao_eig} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/eq} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the eq method works with a vector of AOs as input.} & Test that the eq method works for a vector of AOs as input. Test the +positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the eq function. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the eq method works with a matrix of AOs as input.} & Test that the eq method works for a matrix of AOs as input. Test the +positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the eq function. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the eq method works with a list of AOs as input.} & The eq method doesn't works for a list of AOs as input. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the eq method works with a mix of different shaped AOs as +input.} & The eq method doesn't works for a list of AOs as input. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the eq method properly applies history.} & The eq method doesn't change the AO, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'name'. Use the option 'internal' to +suppress the history. It is necessary to add 'created' to the exception +list because aa is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'plotinfo'. Use the option 'internal' to +suppress the history. It is necessary to add 'created' to the exception +list because aa is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 't0'. Use the option 'internal' to +suppress the history. It is necessary to add 'created' to the exception +list because aa is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'x'. Use the option 'internal' to +suppress the history. It is necessary to add 'created' to the exception +list because aa is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'y'. Use the option 'internal' to +suppress the history. It is necessary to add 'created' to the exception +list because aa is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'xunits'. Use the option 'internal' to +suppress the history. It is necessary to add 'created' to the exception +list because aa is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'yunits'. Use the option 'internal' to +suppress the history. It is necessary to add 'created' to the exception +list because aa is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{14 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'fs'. Use the option 'internal' to +suppress the history. It is necessary to add 'created' to the exception +list because aa is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{15 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'description'. Use the option 'internal' to +suppress the history. It is necessary to add 'created' to the exception +list because aa is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{16 } & \multirow{2}{5cm}{Test the eq method with an exception list which is in a plist.} & Test that the eq method uses the exception list in a plist. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline +\caption{Unit tests for ao/eq.} +\label{tab:ao_eq} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/exp} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/exp] method works with a vector of objects as input.} & Test that the [ao/exp] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/exp] method works with a matrix of objects as input.} & Test that the [ao/exp] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/exp] method works with a list of objects as input.} & Test that the [ao/exp] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/exp] method works with a mix of different arrays of objects as input.} & Tests that the [ao/exp] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/exp] method properly applies history.} & Test that the result of applying the [ao/exp] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/exp]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/exp] method can modify the input AO.} & Test that the [ao/exp] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/exp] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the [ao/exp] method uses the plist to get the axis.} & Test that the [ao/exp] method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the [ao/exp] method applies to the x-axis +2) Check that the [ao/exp] method applies to the y-axis +3) Check that the [ao/exp] method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/exp] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/exp] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/exp] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/exp.} +\label{tab:ao_exp} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/export} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the export method works with non complex data in the AO.} & Tests that the export method works with non complex data in the AO. & pass \\ \cline{3-4} + & & 1) Check that the file exist. +2) Check that the read data is the same as the saved data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the export method works with complex data in the AO.} & Tests that the export method works with complex data in the AO. & pass \\ \cline{3-4} + & & 1) Check that the file exist. +2) Check that the read data is the same as the saved data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the export method works with a plist which contains the filename.} & Tests that the export method works with a plist which contains the +filename. & pass \\ \cline{3-4} + & & 1) Check that the file exist. +2) Check that the read data is the same as the saved data. & pass \\ \hline +\caption{Unit tests for ao/export.} +\label{tab:ao_export} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/fft} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/fft] method works with a vector of objects as input.} & Test that the [ao/fft] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/fft] method works with a matrix of objects as input.} & Test that the [ao/fft] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/fft] method works with a list of objects as input.} & Test that the [ao/fft] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/fft] method works with a mix of different arrays of objects as input.} & Tests that the [ao/fft] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/fft] method properly applies history.} & Test that the result of applying the [ao/fft] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/fft]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/fft] method can modify the input AO.} & Test that the [ao/fft] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/fft] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/fft] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/fft] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/fft] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Tests that the fft method agrees with MATLAB's fft when +configured to use the same parameters.} & Test that the applying fft works on a single AO. & pass \\ \cline{3-4} + & & 1) Check that output agrees with the output of MATLAB's fft. & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Tests that the fft method works with different data types. The testing of +tsdata types are done before.} & Test that the applying fft works on cdata and xydata. & pass \\ \cline{3-4} + & & 1) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{14 } & \multirow{2}{5cm}{Tests that the fft method works with a plist which constains the key/value +pair 'type'/'two'.} & Test that the applying fft works with a plist. & pass \\ \cline{3-4} + & & 1) Check that each output AO contains the correct data. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline +\caption{Unit tests for ao/fft.} +\label{tab:ao_fft} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/fftfilt} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the fftfilt method works with a vector of AOs as input.} & Test that the fftfilt method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the fftfilt method works with a matrix of AOs as input.} & Test that the fftfilt method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the fftfilt method works with a list of AOs as input.} & Test that the fftfilt method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the fftfilt method works with a mix of different shaped AOs as +input.} & Test that the fftfilt method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the fftfilt method properly applies history.} & Test that the result of applying the fftfilt method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'fftfilt'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the fftfilt method can modify the input AO.} & Test that the fftfilt method can modify the input AO by calling with no +output. & pass \\ \cline{3-4} + & & 1) Check that 'at2' and 'ain' are now different. +2) Check that 'ain' is fftfilt(at2). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the fftfilt method keeps the data shape of the input object.} & Test that the fftfilt method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the fftfilt method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for ao/fftfilt.} +\label{tab:ao_fftfilt} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/filtSubtract} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the filtSubtract method works with a vector of AOs as input.} & Test that the filtSubtract method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the filtSubtract method works with a matrix of AOs as input.} & Test that the filtSubtract method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the filtSubtract method works with a list of AOs as input.} & Test that the filtSubtract method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the filtSubtract method works with a mix of different shaped AOs as +input. +DOES NOT APPLY TO THIS METHOD} & Test that the filtSubtract method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the filtSubtract method properly applies history.} & Test that the result of applying the filtSubtract method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'filtSubtract'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the filtSubtract method can not modify the input AO.} & Test that the tfe method can not modify the input AO. +The method must throw an error for the modifier call. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline +\caption{Unit tests for ao/filtSubtract.} +\label{tab:ao_filtSubtract} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/filter} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the filter method works with a vector of AOs as input.} & Test that the filter method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. +3) Check the output-filter & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the filter method works with a matrix of AOs as input.} & Test that the filter method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. +3) Check the output-filter & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the filter method works with a list of AOs as input.} & Test that the filter method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the filter method works with a mix of different shaped AOs as +input.} & Test that the filter method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the filter method properly applies history.} & Test that the result of applying the filter method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'filter'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the filter method can modify the input AO.} & Test that the filter method can modify the input AO by calling +with no output. & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is filter(at1). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the filter method keeps the data shape of the input object.} & Test that the filter method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests that the filter method with a iir filter which have a different sample +rate as the input object.} & Test that the filter method can change the sample rate of the filter and +that the filter-object is returned. & pass \\ \cline{3-4} + & & 1) Check that the output AO contains the correct data. +2) Check that the second output is a iir filter. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Tests that the filter method with a fir filter.} & Test that the filter method with a fir filter. & pass \\ \cline{3-4} + & & 1) Check that the output AO contains the correct data. +2) Check that the second output is a fir filter. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/filter] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Tests the filter method with an AO and fsdata-object and an iir filter.} & Test that the result of the filter method is the product of the AO and the +response of the filter. & pass \\ \cline{3-4} + & & 1) Check that the output AO contains the correct data. +2) Check that the second output is a iir filter. +3) Check the units & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Tests that the filter method works with a bank of parallel filters.} & Test that the filter method works for bank of parallel filters. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same of the +number of elements in 'input' +2) Check that output AO contains the correct number of data. +3) Check that output AO contains the correct data. +4) Check that histout is properly assigned & pass \\ \hline + \multirow{2}{3cm}{14 } & \multirow{2}{5cm}{Tests that the filter method works with a bank of serial filters.} & Test that the filter method works for bank of serial filters. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same of the +number of elements in 'input' +2) Check that output AO contains the correct number of data. +3) Check that output AO contains the correct data. +4) Check that histout is properly assigned & pass \\ \hline + \multirow{2}{3cm}{15 } & \multirow{2}{5cm}{Tests the filter method with an AO of fsdata-object and a bank of iir +parallel filter.} & Test that the result of the filter method is the product of the AO and the +response of the parallel filter bank. & pass \\ \cline{3-4} + & & 1) Check that the output AO contains the correct data. +2) Check that the second output is a iir filter. +3) Check the units & pass \\ \hline + \multirow{2}{3cm}{16 } & \multirow{2}{5cm}{Tests the filter method with an AO of fsdata-object and a bank of iir +serial filter.} & Test that the result of the filter method is the product of the AO and the +response of the serial filter bank. & pass \\ \cline{3-4} + & & 1) Check that the output AO contains the correct data. +2) Check that the second output is a iir filter. +3) Check the units & pass \\ \hline + \multirow{2}{3cm}{17 } & \multirow{2}{5cm}{Tests the filter method with an AO and fsdata-object and an mfir filter.} & Test that the result of the filter method is the product of the AO and the +response of the filter. & pass \\ \cline{3-4} + & & 1) Check that the output AO contains the correct data. +2) Check that the second output is a fir filter. +3) Check the units & pass \\ \hline + \multirow{2}{3cm}{18 } & \multirow{2}{5cm}{Test that the filter method works with a filter embedded into a matrix +and input in a plist} & Test that the filter method works with a filter embedded into a +matrix & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same of the +number in the input. +2) Check that each output AO contains the correct data. +3) Check the output-filter & pass \\ \hline + \multirow{2}{3cm}{19 } & \multirow{2}{5cm}{Test that the filter method works with a filter embedded into a matrix +and input as a second input} & Test that the filter method works with a filter embedded into a +matrix & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same of the +number in the input. +2) Check that each output AO contains the correct data. +3) Check the output-filter & pass \\ \hline + \multirow{2}{3cm}{20 } & \multirow{2}{5cm}{Test that the filter method does not works with a N-dim matrix of +filters input in a plist.} & Test that the filter method does not works with a N-dim matrix of +filters input in a plist. & pass \\ \cline{3-4} + & & 1) Nothing to do. & pass \\ \hline + \multirow{2}{3cm}{21 } & \multirow{2}{5cm}{Test that the filter method does not works with a N-dim matrix of +filters input as a second object} & Test that the filter method does not works with a N-dim matrix of +filters input in a plist. & pass \\ \cline{3-4} + & & 1) Nothing to do. & pass \\ \hline +\caption{Unit tests for ao/filter.} +\label{tab:ao_filter} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/filtfilt} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the filtfilt method works with a vector of AOs as input.} & Test that the filtfilt method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. +3) Check the output-filter & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the filtfilt method works with a matrix of AOs as input.} & Test that the filtfilt method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. +3) Check the output-filter & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the filtfilt method works with a list of AOs as input.} & Test that the filtfilt method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the filtfilt method works with a mix of different shaped AOs as +input.} & Test that the filtfilt method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the filtfilt method properly applies history.} & Test that the result of applying the filtfilt method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'filtfilt'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the filtfilt method can modify the input AO.} & Test that the filtfilt method can modify the input AO by calling +with no output. & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is filtfilt(at1). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the filtfilt method keeps the data shape of the input object.} & Test that the filtfilt method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests that the filtfilt method with a iir filter which have a different sample +rate as the input object.} & Test that the filtfilt method can change the sample rate of the filter and +that the filtfilt-object is returned. & pass \\ \cline{3-4} + & & 1) Check that the output AO contains the correct data. +2) Check that the second output is a iir filtfilt. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Tests that the filtfilt method with a fir filter.} & Test that the filtfilt method with a fir filter. & pass \\ \cline{3-4} + & & 1) Check that the output AO contains the correct data. +2) Check that the second output is a fir filter. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/filtfilt] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Tests the filtfilt method with an AO and fsdata-object and an iir filter.} & Test that the result of the filtfilt method is the product of the AO and the +response of the filter. & pass \\ \cline{3-4} + & & 1) Check that the output AO contains the correct data. +2) Check that the second output is a iir filter. +3) Check the units & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Tests the filtfilt method with an AO and fsdata-object and an iir filter.} & Test that the result of the filtfilt method is the product of the AO and the +response of the filter. & pass \\ \cline{3-4} + & & 1) Check that the output AO contains the correct data. +2) Check that the second output is a fir filter. +3) Check the units & pass \\ \hline +\caption{Unit tests for ao/filtfilt.} +\label{tab:ao_filtfilt} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/find} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the find method works with a vector of AOs as input.} & Test that the find method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the find method works with a matrix of AOs as input.} & Tests that the find method works with a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the find method works with a list of AOs as input.} & Tests that the find method works with a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the find method works with a mix of different shaped AOs as +input.} & Tests that the find method works with a mix of different shaped AOs +as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the find method properly applies history.} & Test that the result of applying the find method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'finf'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the find method can modify the input AO.} & Test that the find method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the abs value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the find method works with different queries to the x-/y- +axis.} & Test that the find method works with different queries to the x-/y- +axis. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the find method keeps the data shape of the input object. +The input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the find method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/find] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Test that the find method works with AOs which have cdata.} & Test that the find method works with AOs which have cdata. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Test that the find method works with a plist which contains different +queries to the x-/y- axis.} & Test that the find method works with a plist which contains different +queries to the x-/y- axis. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline +\caption{Unit tests for ao/find.} +\label{tab:ao_find} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/firwhiten} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the firwhiten method works with a vector of AOs as input.} & Test that the firwhiten method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check the number of elements in 'out' +2) Check the number of filters (outf) and noise-floor estimates (outxx) +3) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the firwhiten method works with a matrix of AOs as input.} & Test that the firwhiten method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check the number of elements in 'out' +2) Check the number of filters (outf) and noise-floor estimates (outxx) +3) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the firwhiten method works with a list of AOs as input.} & Test that the firwhiten method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check the number of elements in 'out' +2) Check the number of filters (outf) and noise-floor estimates (outxx) +3) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the firwhiten method works with a mix of different shaped AOs as +input.} & Test that the firwhiten method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check the number of elements in 'out' +2) Check the number of filters (outf) and noise-floor estimates (outxx) +3) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the firwhiten method properly applies history.} & Test that the result of applying the firwhiten method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'firwhiten'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the firwhiten method can modify the input AO.} & Test that the firwhiten method can modify the input AO by calling +with no output. & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is firwhiten(at1). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the firwhiten method keeps the data shape of the input object.} & Test that the firwhiten method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests that the firwhiten method with a complex plist.} & Test that the result of applying the firwhiten method with a complex plist +can be processed back to a m-file. & pass \\ \cline{3-4} + & & 1) Check the output data +2) Check the output filter +3) Check the noise-floor estimates +4) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Test the spectral falttening capability of firwhiten method.} & Test that the application of the firwhiten method enhances the +spectral flatness of input data. & pass \\ \cline{3-4} + & & 1) Calculate PSD of input and whitened data +2) Compare relative spectral flatness coefficients & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/firwhiten] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Check that the errors are cleared for this method.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output has no error fields & pass \\ \hline +\caption{Unit tests for ao/firwhiten.} +\label{tab:ao_firwhiten} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/fixfs} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the fixfs method works with a vector of AOs as input.} & Test that the fixfs method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as +the number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the fixfs method works with a matrix of AOs as input.} & Test that the fixfs method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as +the number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the fixfs method works with a list of AOs as input.} & Test that the fixfs method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as +the number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the fixfs method works with a mix of different shaped AOs as +input.} & Test that the fixfs method works with an input of matrices and vectors +and single AOs. Additionally define a 'fs' in a plist. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. +3) Check that 't0' and 'fs' are correct. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the fixfs method properly applies history.} & Test that the result of applying the fixfs method can be processed back +to an m-file. Additionally define a 'fs' in a plist. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'fixfs'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the fixfs method can modify the input AO.} & Test that the fixfs method can modify the input AO by calling +with no output. & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is fixfs(at1). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the fixfs method keeps the data shape of the input object.} & Test that the fixfs method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the fixfs method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Tests that the fixfs method works with a list of AOs as input and different +'t0' and 'fs' for the inputs.} & Test that the fixfs method works for a list of AOs as input and different +'t0' and 'fs' & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as +the number in the input. +2) Check that each output AO contains the correct data. +3) Check that each output contains the correct frequency and start time. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/fixfs] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Tests that the fixfs method works with the method 'samples'.} & Test that the fixfs method works for the method 'samples'. & pass \\ \cline{3-4} + & & 1) Check that each output AO contains the correct data. +2) Check that each output contains the correct frequency and start time. & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Tests that the fixfs method works with antialising filter.} & Test that the fixfs method works for the antialising filters iir and fir. & pass \\ \cline{3-4} + & & 1) Check that each output AO contains the correct data. +2) Check that each output contains the correct frequency and start time. & pass \\ \hline + \multirow{2}{3cm}{14 } & \multirow{2}{5cm}{Tests that the fixfs method works with an AO with non evenly sampled data.} & Test that the fixfs method works for an AO with non evenly samples data. & pass \\ \cline{3-4} + & & 1) Check that each output AO contains the correct data. +2) Check that each output contains the correct frequency and start time. & pass \\ \hline +\caption{Unit tests for ao/fixfs.} +\label{tab:ao_fixfs} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/fs} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the fs method works with a vector of AOs as input.} & The fs method doesn't work with a vector of AOs. Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the fs method works with a matrix of AOs as input.} & The fs method doesn't work with a matrix of AOs. Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the fs method works with a list of AOs as input.} & The fs method doesn't work with a list of AOs. Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the fs method works with a mix of different shaped AOs as input.} & The fs method can only return the fs value of one AO. Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the fs method properly applies history.} & The fs method doesn't change the AO, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the fs method works for AOs with different data objects.} & Test that the fs method returns the fs value for AOs with cdata, +fsdata, tsdata and xydata objects. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline +\caption{Unit tests for ao/fs.} +\label{tab:ao_fs} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/ge} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the ge method compare an AO with scalar value} & Test that the ge method works with relational operators and the function +command. Use for this AOs with different data objects. & pass \\ \cline{3-4} + & & 1) Check that the result of the 'relational operator' and the 'function' +command are the same. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the ge method compare an AO with one other AO} & Test that the ge method works with relational operators and the function +command. Use for this AOs with different data objects. +Remark that both AOs must have the same size. & pass \\ \cline{3-4} + & & 1) Check that the result of the 'relational operator' and the 'function' +command are the same. +2) Check that each output AO contains the correct data. & pass \\ \hline +\caption{Unit tests for ao/ge.} +\label{tab:ao_ge} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/get} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests the get method of the ao class.} & Test that the get returns returns the value of the specified +property. Do this for all properties of the AO. & pass \\ \cline{3-4} + & & 1) Check the correct value of the output & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the get method works with a plist.} & Test that the get returns returns the value of the specified +property which is defined in a plist. & pass \\ \cline{3-4} + & & 1) Check the correct value of the output & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests the get method of the ao class.} & Test that the get throws an error if the input are more than +one AO. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline +\caption{Unit tests for ao/get.} +\label{tab:ao_get} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/gt} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the gt method compare an AO with scalar value} & Test that the gt method works with relational operators and the function +command. Use for this AOs with different data objects. & pass \\ \cline{3-4} + & & 1) Check that the result of the 'relational operator' and the 'function' +command are the same. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the gt method compare an AO with one other AO} & Test that the gt method works with relational operators and the function +command. Use for this AOs with different data objects. +Remark that both AOs must have the same size. & pass \\ \cline{3-4} + & & 1) Check that the result of the 'relational operator' and the 'function' +command are the same. +2) Check that each output AO contains the correct data. & pass \\ \hline +\caption{Unit tests for ao/gt.} +\label{tab:ao_gt} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/heterodyne} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the heterodyne method works with a vector of AOs as input.} & Test that the heterodyne method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the heterodyne method works with a matrix of AOs as input.} & Test that the heterodyne method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the heterodyne method works with a list of AOs as input.} & Test that the heterodyne method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the heterodyne method works with a mix of different shaped AOs as +input.} & Test that the heterodyne method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the heterodyne method properly applies history.} & Test that the result of applying the heterodyne method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'heterodyne'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests the heterodyne method functionality.} & Build reference signal, mixed signal and heterodyne the 2nd to obtain the first +Downsample is set to 'no' & pass \\ \cline{3-4} + & & Test that we can recover the initial signal after heterodyne up to +a numerical error given by tol & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests the heterodyne method functionality.} & Build reference signal, mixed signal and heterodyne the 2nd to obtain the first +Downsample is set to 'yes' & pass \\ \cline{3-4} + & & Test that we can recover the initial signal after heterodyne up to +a numerical error given by tol & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/heterodyne] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/heterodyne.} +\label{tab:ao_heterodyne} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/hist} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the hist method works with a vector of AOs as input.} & Test that the hist method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the hist method works with a matrix of AOs as input.} & Test that the hist method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the hist method works with a list of AOs as input.} & Test that the hist method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the hist method works with a mix of different shaped AOs as +input.} & Test that the hist method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the hist method properly applies history.} & Test that the result of applying the hist method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'hist'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the hist method can modify the input AO.} & Test that the hist method can modify the input AO by calling with no +output. Remark that the command at1.hist() doesn't call the histogram +method because an AO have a property with the name 'hist'. Thus the +command at1.hist returns the value in the property hist. & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is hist(at1). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the hist method keeps the data shape of the input object.} & Test that the hist method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the hist method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Control the method with a plist.} & Test the hist method with a factor and an offset. & pass \\ \cline{3-4} + & & 1) Check that the hist method with defined number of bins +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/hist] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Control the method with a plist.} & Test the hist method with a factor and an offset. & pass \\ \cline{3-4} + & & 1) Check that the hist method with set of bin centers +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline +\caption{Unit tests for ao/hist.} +\label{tab:ao_hist} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/ifft} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the ifft method works with a vector of AOs as input.} & Test that the ifft method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the ifft method works with a matrix of AOs as input.} & Test that the ifft method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the ifft method works with a list of AOs as input.} & Test that the ifft method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the ifft method works with a mix of different shaped AOs as +input.} & Test that the ifft method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the ifft method properly applies history.} & Test that the result of applying the ifft method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'ifft'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the ifft method can modify the input AO.} & Test that the ifft method can modify the input AO by calling with no +output. & pass \\ \cline{3-4} + & & 1) Check that 'at2' and 'ain' are now different. +2) Check that 'ain' is ifft(at2). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the ifft method keeps the data shape of the input object.} & Test that the ifft method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the ifft method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Tests that the ifft method agrees with MATLAB's ifft when +configured to use the same parameters.} & Test that the applying ifft works on two AOs. & pass \\ \cline{3-4} + & & 1) Check that output agrees with the output of MATLAB's ifft. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/ifft] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Tests that the ifft method agrees with MATLAB's ifft when +configured to use the same parameters.} & Test that the applying ifft works on a single AO with 'nonsymmetric' +option. & pass \\ \cline{3-4} + & & 1) Check that output agrees with the output of MATLAB's ifft. & pass \\ \hline +\caption{Unit tests for ao/ifft.} +\label{tab:ao_ifft} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/imag} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the imag method works with a vector of AOs as input.} & Test that the imag method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the imag method works with a matrix of AOs as input.} & Test that the imag method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the imag method works with a list of AOs as input.} & Test that the imag method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the imag method works with a mix of different shaped AOs as +input.} & Test that the imag method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the imag method properly applies history.} & Test that the result of applying the imag method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'imag'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the imag method can modify the input AO.} & Test that the imag method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is imag(at1). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the imag method can modify the single axis controlled by the +plist and the resuld can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the imag method applies to the x-axis +2) Check that the imag method applies to the y-axis +3) Check that the imag method applies to both axes +4) Check that the re-built objects are the same object as 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the imag method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the imag method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/imag] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/imag.} +\label{tab:ao_imag} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/index} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the index method works with a vector of AOs as input.} & Test that the index method works for a vector of AOs as input. The +following indexing should work: +I = [ 1 2 3 ] or (I/J) = [(1,1), (1,2), (1,3)] & pass \\ \cline{3-4} + & & 1) Check that the index method selects the correct object. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the index method works with a matrix of AOs as input.} & Test that the index method works for a matrix of AOs as input. The +following indexing should work: +I = [ 1 3 5 ] or (I/J) = [(1,1), (1,2), (1,3)] +[ 2 4 6 ] [(2,1), (2,2), (2,3)] & pass \\ \cline{3-4} + & & 1) Check that the index method selects the correct object. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the index method works with a list of AOs as input.} & The index method doesn't work for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the index method properly applies history.} & Test that the result of index have an additional history step. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds +to 'index'. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the index method works for the modifier command.} & Tests that the index method works for the modifier command. & pass \\ \cline{3-4} + & & 1) Check that the history-plist contains the used indices. +2) Check that the index method selects the correct object & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the index method can be controled with a plist. & pass \\ \cline{3-4} + & & 1) Check that the history-plist contains the used indices. +2) Check that the index method selects the correct object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the index method selects more objects if I have more indices.} & Test that the index method selects more objects if I have more indices. & pass \\ \cline{3-4} + & & 1) Check that the history-plist contains the used indices. +2) Check that the index method selects the correct object & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/index] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/index.} +\label{tab:ao_index} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/integrate} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the integrate method works with a vector of AOs as input.} & Test that the integrate method works for a vector of AOs as input. Use for +this test the trapezoidal method. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the integrate method works with a matrix of AOs as input.} & Test that the integrate method works for a matrix of AOs as input. Use for +this test the Trapezoidal method. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the integrate method works with a list of AOs as input.} & Test that the integrate method works for a list of AOs as input. Use for +this test the trapezoidal. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the integrate method works with a mix of integrateerent shaped AOs as +input.} & Test that the integrate method works with an input of matrices and vectors +and single AOs. Use for this test the trapezoidal. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the integrate method properly applies history.} & Test that the result of applying the integrate method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'integrate'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the integrate method can modify the input AO.} & Test that the integrate method can modify the input AO by calling with no +output. Use for this test the trapezoidal. & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now integrateerent. +2) Check that 'ain' is integrate(at1). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the integrate method keeps the data shape of the input object.} & Test that the integrate method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the integrate method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Control the method with a plist.} & Test the trapezoidal. & pass \\ \cline{3-4} + & & 1) Check that the integrate method uses the trapezoidal method. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/integrate] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/integrate.} +\label{tab:ao_integrate} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/interp} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the interp method works with a vector of AOs as input.} & Test that the interp method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the interp method works with a matrix of AOs as input.} & Test that the interp method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the interp method works with a list of AOs as input.} & Test that the interp method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the interp method works with a mix of different shaped AOs as +input.} & Test that the interp method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the interp method properly applies history.} & Test that the result of applying the interp method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'interp'. +2) Check that the re-built object is the same as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the interp method can modify the input AO.} & Test that the interp method can modify the input AO by calling with no +output. & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is interp(at1). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the interp method keeps the data shape of the input object.} & Test that the interp method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the interp method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Tests that the interp method can different interpolations.} & Test that the interp method can all of MATLAB interpolates methods. +'nearest' - Nearest neighbor interpolation +'linear' - Linear interpolation +'spline' - Cubic spline interpolation (see UTPs above) +'pchip' - Piecewise cubic Hermite interpolation & pass \\ \cline{3-4} + & & 1) Check the different interpolations +2) Check that the re-built objects are the same as 'out1..3'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/interp] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/interp.} +\label{tab:ao_interp} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/interpmissing} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the interpmissing method works with a vector of AOs as input.} & Test that the interpmissing method works for a vector of AOs as input. +Known gaps at the position idx = 30 and 51 & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the interpmissing method works with a matrix of AOs as input.} & Test that the interpmissing method works for a matrix of AOs as input. +Known gaps at the position idx = 30 and 51 & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the interpmissing method works with a list of AOs as input.} & Test that the interpmissing method works for a list of AOs as input. +Known gaps at the position idx = 30 and 51 & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the interpmissing method works with a mix of different shaped AOs as +input.} & Test that the interpmissing method works with an input of matrices and vectors +and single AOs. Known gaps at the position idx = 30 and 51 & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the interpmissing method properly applies history.} & Test that the result of applying the interpmissing method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'interpmissing'. +2) Check that the re-built object is the same as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the interpmissing method can modify the input AO.} & Test that the interpmissing method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). +Known gaps at the position idx = 30 and 51 & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is interpmissing(at1). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the interpmissing method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the interpmissing method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Tests that the interpmissing method can change the tolerance for finding +missing samples.} & Test that the interpmissing method works with a plist which changes the +tolerance. Known gaps at the position idx = 30 and 51 with the width of 40 +and 60 & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. +3) Check that the re-built object is the same as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/interpmissing] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/interpmissing.} +\label{tab:ao_interpmissing} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/inv} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the inv method works with a vector of AOs as input.} & Test that the inv method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the inv method works with a matrix of AOs as input.} & Test that the inv method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the inv method works with a list of AOs as input.} & Test that the inv method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the inv method works with a mix of different shaped AOs as +input.} & Test that the inv method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the inv method properly applies history.} & Test that the result of applying the inv method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'inv'. +2) Check that the re-built object is the same as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the inv method can modify the input AO.} & Test that the inv method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'at4' and 'ain' are now different. +2) Check that 'ain' is inv(at4). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the inv method can modify the single axis controlled by the +plist and the resuld can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the inv method applies to the x-axis +2) Check that the inv method applies to the y-axis +3) Check that the inv method applies to both axes +4) Check that the re-built objects are the same as 'out1..3'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the inv method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the inv method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/inv] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/inv.} +\label{tab:ao_inv} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/isprop} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the isprop method works with a vector of AOs as input.} & Test that the isprop method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the isprop method works with a matrix of AOs as input.} & Test that the isprop method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the isprop method works with a list of AOs as input.} & Test that the isprop method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the isprop method works with a mix of different shaped AOs as +input.} & Test that the isprop method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the isprop method properly applies history.} & The method isprop doesn't change the object, thus it is not necessary to +apply history. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the isprop method works for each property.} & Test that the isprop method works for the properties: +'data', 'mfile', 'mfilename', 'mdlfile', 'mdlfilename', 'procinfo', +'plotinfo', 'description', 'hist', 'name' & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the negatice case and the not function command.} & Test that the isprop method retrun false for a unknown property and for +methods of the object. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline +\caption{Unit tests for ao/isprop.} +\label{tab:ao_isprop} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf join/fsdata} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the join method works with a vector of AOs as input.} & Test that the join method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one AO. +2) Check that the output have the correct data. +3) Check the re-built object & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the join method works with a matrix of AOs as input.} & Tests that the join method works with a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one AO. +2) Check that the output have the correct data. +3) Check the re-built object & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the join method works with a list of AOs as input.} & Tests that the join method works with a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one AO. +2) Check that the output have the correct data. +3) Check the re-built object & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the join method works with a mix of different shaped AOs as +input.} & Tests that the join method works with a mix of different shaped AOs +as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one AO. +2) Check that the output have the correct data. +3) Check the re-built object & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the join method properly applies history.} & Test that the result of applying the join method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'join'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the join method can modify the input AO.} & Test that the join method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is joined +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the join method keeps the data shape of the input object. +The input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [join/fsdata] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for join/fsdata.} +\label{tab:join_fsdata} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf join/tsdata} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the join method works with a vector of AOs as input.} & Test that the join method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one AO. +2) Check that the output have the correct data. +3) Check the re-built object & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the join method works with a matrix of AOs as input.} & Test that the join method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one AO. +2) Check that the output have the correct data. +3) Check the re-built object & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the join method works with a list of AOs as input.} & Tests that the join method works with a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one AO. +2) Check that the output have the correct data. +3) Check the re-built object & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the join method works with a mix of different shaped AOs as +input.} & Tests that the join method works with a mix of different shaped AOs +as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one AO. +2) Check that the output have the correct data. +3) Check the re-built object & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the join method properly applies history.} & Test that the result of applying the join method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'join'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the join method can modify the input AO.} & Test that the join method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is joined +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the join method fills the gaps with zeros.} & Test that the join method fills the gaps with zeros. & pass \\ \cline{3-4} + & & 1) Check that the join method filled the gaps with zero +2) Check that the re-built objects are the same as out[1..2] & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the join method keeps the data shape of the input object. +The input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Test the x-values.} & Test the x-values. & pass \\ \cline{3-4} + & & 1) Check the x-values for the case where we 'zerofill' or not. +2) Compare the outputs to see that switching the order did not matter, +because if the different t0 of the data, that get sorted anyways. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [join/tsdata] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for join/tsdata.} +\label{tab:join_tsdata} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/lcohere} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the lcohere method works with a vector of AOs as input.} & Test that the lcohere method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the lcohere method doesn't work with a matrix of AOs as input.} & Test that the lcohere method doesn't work for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Nothing to do & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the lcohere method works with a list of AOs as input.} & Test that the lcohere method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the lcohere method doesn't work with a mix of different +shaped AOs as input.} & Test that the lcohere method doesn't work with an input of matrices +and vectors and single AOs. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the lcohere method properly applies history.} & Test that the result of applying the lcohere method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'lcohere'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the lcohere method can not modify the input AO.} & Test that the lcohere method can not modify the input AO. +The method must throw an error for the modifier call. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the plus method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the output data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the lcohere method pass back the output objects to a list of +output variables or to a single variable.} & This test is not longer necessary because the cohere method pass back +always only one object. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/lcohere] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Tests symmetry properties of complex-coherence: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) complex lcoherence of the white noise series +4) compare C(x,y) with conj(C(y,x)) +5) compare C(x,x) and C(y,y) with 1} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) complex log-scale coherence of the white noise & pass \\ \cline{3-4} + & & 1) Check that C(x,y) equals conj(C(y,x)) +2) Check that C(x,x) equals 1 +2) Check that C(y,y) equals 1 & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Tests symmetry properties of complex-coherence: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) magnitude-squared log-scale coherence of the white noise series +4) compare C(x,y) with C(y,x) +5) compare C(x,x) and C(y,y) with 1} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) magnitude-squared log-scale coherence of the white noise & pass \\ \cline{3-4} + & & 1) Check that C(x,y) equals C(y,x) +1) Check that C(x,x) equals 1 +1) Check that C(y,y) equals 1 & pass \\ \hline + \multirow{2}{3cm}{14 } & \multirow{2}{5cm}{Tests symmetry properties of complex-coherence: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) complex log-scale coherence of the combination of white noise series +4) compare C(x,y) with 1} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) complex log-scale coherence of the combination of noise & pass \\ \cline{3-4} + & & 1) Check that the complex coherence equals 1 & pass \\ \hline + \multirow{2}{3cm}{15 } & \multirow{2}{5cm}{Tests symmetry properties of complex-coherence: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) magnitude-squared log-scale coherence of the combination of white noise series +4) compare C(x,y) with 1} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) magnitude-squared log-scale coherence of the combination of noise & pass \\ \cline{3-4} + & & 1) Check that the magnitude-squared coherence equals 1 & pass \\ \hline + \multirow{2}{3cm}{16 } & \multirow{2}{5cm}{Tests symmetry properties of complex-coherence: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) magnitude-squared log-scale coherence M of the combination of white noise series +4) complex log-scale coherence C of the combination of white noise series +5) compare abs(C)\^2 with M} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) magnitude-squared log-scale coherence of the combination of noise +6) complex log-scale coherence of the combination of noise & pass \\ \cline{3-4} + & & 1) Check that the magnitude-squared coherence equals the square +modulus of the complex coherence & pass \\ \hline + \multirow{2}{3cm}{17 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) complex cohere of the white noise series +4) compares the units of the input and output} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) complex cohere of the white noise & pass \\ \cline{3-4} + & & 1) Check that (complex coherence yunits) equals [1] +2) Check that (complex coherence xunits) equals [Hz] & pass \\ \hline + \multirow{2}{3cm}{18 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) magnitude-squared cohere of the white noise series +4) compares the units of the input and output} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) magnitude-squared cohere of the white noise & pass \\ \cline{3-4} + & & 1) Check that (magnitude-squared coherence yunits) equals [1] +2) Check that (magnitude-squared coherence xunits) equals [Hz] & pass \\ \hline + \multirow{2}{3cm}{30 } & \multirow{2}{5cm}{Tests handling of special cases: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) the same noise series +3) lcohere of the white noise series +4) compares the output to unity} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +the same data as 1) and 2) +4) lcohere of the series & pass \\ \cline{3-4} + & & 1) Check that calculated lcohere equals 1 & pass \\ \hline +\caption{Unit tests for ao/lcohere.} +\label{tab:ao_lcohere} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/lcpsd} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the lcpsd method works with a vector of AOs as input.} & Test that the lcpsd method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the lcpsd method doesn't work with a matrix of AOs as input.} & Test that the lcpsd method doesn't work for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the lcpsd method works with a list of AOs as input.} & Test that the lcpsd method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the lcpsd method doesn't work with a mix of different shaped +AOs as input.} & Test that the lcpsd method doesn't work with an input of matrices and +vectors and single AOs. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the lcpsd method properly applies history.} & Test that the result of applying the lcpsd method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'lcpsd'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the lcpsd method can not modify the input AO.} & Test that the lcpsd method can not modify the input AO. +The method must throw an error for the modifier call. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the plus method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the output data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the lcpsd method pass back the output objects to a list of +output variables or to a single variable.} & This test is not longer necessary because the cohere method pass back +always only one object. & pass \\ \cline{3-4} + & & 1) Nothing to check & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/lcpsd] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Tests that differently sized data sets are treated properly} & Test that applying lcpsd works on two AOs. & pass \\ \cline{3-4} + & & 1) Check that lcpsd used the length of the shortest ao. & pass \\ \hline + \multirow{2}{3cm}{17 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) LCPSD of the white noise series +4) compares the units of the input and output} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) LCPSD of the white noise & pass \\ \cline{3-4} + & & 1) Check that (calculated LCPSD yunits) equals +input\_1 units*input\_2 units/Hz & pass \\ \hline + \multirow{2}{3cm}{18 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) LCPSD of the white noise series +Comparison with LPSD: +4) compares the off-diagonal terms to check they are complex-conjugated +5) compares the diagonal terms with PSD of the individual noise} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) LCPSD of the white noise +6) LPSD of the white noise & pass \\ \cline{3-4} + & & 1) Check that LCPSD(x,x) equals LPSD(x) +2) Check that LCPSD(y,y) equals LPSD(y) +3) Check that LCPSD(x,y) equals conj(LCPSD(y,x)) & pass \\ \hline +\caption{Unit tests for ao/lcpsd.} +\label{tab:ao_lcpsd} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/le} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the le method compare an AO with scalar value} & Test that the le method works with relational operators and the function +command. Use for this AOs with different data objects. & pass \\ \cline{3-4} + & & 1) Check that the result of the 'relational operator' and the 'function' +command are the same. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the le method compare an AO with one other AO} & Test that the le method works with relational operators and the function +command. Use for this AOs with different data objects. +Remark that both AOs must have the same size. & pass \\ \cline{3-4} + & & 1) Check that the result of the 'relational operator' and the 'function' +command are the same. +2) Check that each output AO contains the correct data. & pass \\ \hline +\caption{Unit tests for ao/le.} +\label{tab:ao_le} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/len} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the len method works with a vector of AOs as input.} & Test that the len method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the len method works with a matrix of AOs as input.} & Test that the len method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the len method works with a list of AOs as input.} & Test that the len method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the len method works with a mix of different shaped AOs as +input.} & Test that the len method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the len method properly applies history.} & The len method doesn't change the object, thus it is not necessary to test +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for ao/len.} +\label{tab:ao_len} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/linSubtract} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the linSubtract method works with a vector of AOs as input.} & Test that the linSubtract method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the linSubtract method works with a matrix of AOs as input.} & Test that the linSubtract method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the linSubtract method works with a list of AOs as input.} & Test that the linSubtract method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the linSubtract method works with a mix of different shaped AOs as +input.} & Test that the linSubtract method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the linSubtract method properly applies history.} & Test that the result of applying the linSubtract method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'linSubtract'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the linSubtract method can not modify the input AO.} & Test that the tfe method can not modify the input AO. +The method must throw an error for the modifier call. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/linSubtract] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/linSubtract.} +\label{tab:ao_linSubtract} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/lincom} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the lincom method works with a vector of AOs as input.} & Test that the lincom method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is 1 +2) Check that the output AO contains the correct units +3) Check that the output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the lincom method works with a list of AOs as input.} & Test that the lincom method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is 1. +2) Check that the output AO contains the correct units +3) Check that the output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the lincom method properly applies history.} & Test that the result of applying the lincom method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'lincom'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the lincom method can not modify the input AO.} & Test that the lincom method can not modify the input AO. +The method must throw an error for the modifier call. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the plus method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the output data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/lincom] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Tests that the lincom method works with a vector of AOs as input + a pest object.} & Test that the lincom method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is 1 +2) Check that the output AO contains the correct units +3) Check that the output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{14 } & \multirow{2}{5cm}{Tests that the lincom method works with a list of AOs as input + a pest object.} & Test that the lincom method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is 1. +2) Check that the output AO contains the correct units +3) Check that the output AO contains the correct data. & pass \\ \hline +\caption{Unit tests for ao/lincom.} +\label{tab:ao_lincom} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/ln} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/ln] method works with a vector of objects as input.} & Test that the [ao/ln] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/ln] method works with a matrix of objects as input.} & Test that the [ao/ln] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/ln] method works with a list of objects as input.} & Test that the [ao/ln] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/ln] method works with a mix of different arrays of objects as input.} & Tests that the [ao/ln] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/ln] method properly applies history.} & Test that the result of applying the [ao/ln] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/ln]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/ln] method can modify the input AO.} & Test that the [ao/ln] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/ln] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/ln] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/ln] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/ln] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/ln.} +\label{tab:ao_ln} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/loadobj} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check the shape of the loaded objects. & pass \\ \hline +\caption{Unit tests for ao/loadobj.} +\label{tab:ao_loadobj} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/log} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/log] method works with a vector of objects as input.} & Test that the [ao/log] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/log] method works with a matrix of objects as input.} & Test that the [ao/log] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/log] method works with a list of objects as input.} & Test that the [ao/log] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/log] method works with a mix of different arrays of objects as input.} & Tests that the [ao/log] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/log] method properly applies history.} & Test that the result of applying the [ao/log] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/log]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/log] method can modify the input AO.} & Test that the [ao/log] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/log] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/log] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/log] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/log] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/log.} +\label{tab:ao_log} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/log10} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/log10] method works with a vector of objects as input.} & Test that the [ao/log10] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/log10] method works with a matrix of objects as input.} & Test that the [ao/log10] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/log10] method works with a list of objects as input.} & Test that the [ao/log10] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/log10] method works with a mix of different arrays of objects as input.} & Tests that the [ao/log10] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/log10] method properly applies history.} & Test that the result of applying the [ao/log10] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/log10]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/log10] method can modify the input AO.} & Test that the [ao/log10] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/log10] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/log10] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/log10] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/log10] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/log10.} +\label{tab:ao_log10} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/lpsd} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the lpsd method works with a vector of AOs as input.} & Test that the lpsd method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in the input. +2) Check that each output object contains the correct values. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the lpsd method works with a matrix of AOs as input.} & Test that the lpsd method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in the input. +2) Check that each output object contains the correct values. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the lpsd method works with a list of AOs as input.} & Test that the lpsd method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the lpsd method works with a mix of different shaped AOs as +input.} & Test that the lpsd method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the lpsd method properly applies history.} & Test that the result of applying the lpsd method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'lpsd'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Check that the lpsd method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the lpsd method agrees with MATLAB's pwelch if the frequency +resolution of the latter is changed to match those used in lpsd} & Test that the applying psd works on a single AO. & pass \\ \cline{3-4} + & & 1) Check that the DFT equations (eq. (3) and (4) in [1]) are fulfilled. +2) Check that we get the same outputs for each frequency bin when +computing the psd using matlab's fft with the frequency resolution +values retrieved by lpsd (and already tested in (1)) +[1] G. Heinzel, lpsd revisited: ltf, S2-AEI-TN-3052 & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/lpsd] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{17 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) LPSD of the white noise +3) compares the units of the input and output} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) LPSD of the white noise & pass \\ \cline{3-4} + & & 1) Check that (calculated LPSD yunits) equals (input units)\^2 / Hz +2) Check that (calculated LPSD xunits) equals Hz & pass \\ \hline + \multirow{2}{3cm}{18 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from uniform pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) LASD of the white noise +3) compares the units of the input and output} & 1) Prepare the test tsdata: +white noise from uniform distribution + offset +2) Assign a random unit +3) LASD of the white noise & pass \\ \cline{3-4} + & & 1) Check that (calculated LASD yunits) equals (input units) / Hz\^(1/2) +2) Check that (calculated LASD xunits) equals Hz & pass \\ \hline + \multirow{2}{3cm}{19 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) LPS of the white noise +3) compares the units of the input and output} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) LPS of the white noise & pass \\ \cline{3-4} + & & 1) Check that (calculated LPS yunits) equals (input units)\^2 +2) Check that (calculated LPS xunits) equals Hz & pass \\ \hline + \multirow{2}{3cm}{20 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from uniform distribution, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) LAS of the white noise +3) compares the units of the input and output} & 1) Prepare the test tsdata: +white noise from uniform distribution + offset +2) Assign a random unit +3) LAS of the white noise & pass \\ \cline{3-4} + & & 1) Check that (calculated LAS yunits) equals (input units) +2) Check that (calculated LAS xunits) equals Hz & pass \\ \hline + \multirow{2}{3cm}{41 } & \multirow{2}{5cm}{Tests the effect of windowing: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) lpsd passing the window name (Rectangular) +3) lpsd passing the window object (Rectangular type) +4) compares the two psds} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd without detrending, Rectangular window (name) +4) Estimate the psd without detrending, Rectangular window (object) +5) Compare results & pass \\ \cline{3-4} + & & 1) Check that calculated psds are identical & pass \\ \hline + \multirow{2}{3cm}{42 } & \multirow{2}{5cm}{Tests the effect of windowing: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) lpsd passing the window name (BH92) +3) lpsd passing the window object (BH92 type) +4) compares the two psds} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd without detrending, BH92 window (name) +4) Estimate the psd without detrending, BH92 window (object) +5) Compare results & pass \\ \cline{3-4} + & & 1) Check that calculated psds are identical & pass \\ \hline + \multirow{2}{3cm}{43 } & \multirow{2}{5cm}{Tests the effect of windowing: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) lpsd passing the window name (Hamming) +3) lpsd passing the window object (Hamming type) +4) compares the two psds} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd without detrending, Hamming window (name) +4) Estimate the psd without detrending, Hamming window (object) +5) Compare results & pass \\ \cline{3-4} + & & 1) Check that calculated psds are identical & pass \\ \hline + \multirow{2}{3cm}{44 } & \multirow{2}{5cm}{Tests the effect of windowing: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) lpsd passing the window name (Hanning) +3) lpsd passing the window object (Hanning type) +4) compares the two psds} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd without detrending, Hanning window (name) +4) Estimate the psd without detrending, Hanning window (object) +5) Compare results & pass \\ \cline{3-4} + & & 1) Check that calculated psds are identical & pass \\ \hline + \multirow{2}{3cm}{45 } & \multirow{2}{5cm}{Tests the effect of windowing: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) lpsd passing the window name (Bartlett) +3) lpsd passing the window object (Bartlett type) +4) compares the two psds} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd without detrending, Bartlett window (name) +4) Estimate the psd without detrending, Bartlett window (object) +5) Compare results & pass \\ \cline{3-4} + & & 1) Check that calculated psds are identical & pass \\ \hline + \multirow{2}{3cm}{46 } & \multirow{2}{5cm}{Tests the effect of windowing: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) lpsd passing the window name (Nuttall3) +3) lpsd passing the window object (Nuttall3 type) +4) compares the two psds} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd without detrending, Nuttall3 window (name) +4) Estimate the psd without detrending, Nuttall3 window (object) +5) Compare results & pass \\ \cline{3-4} + & & 1) Check that calculated psds are identical & pass \\ \hline + \multirow{2}{3cm}{47 } & \multirow{2}{5cm}{Tests the effect of windowing: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) lpsd passing the window name (Kaiser, psll = 150) +3) lpsd passing the window object (Kaiser type, psll = 150) +4) compares the two psds} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd without detrending, Kaiser window (name) +4) Estimate the psd without detrending, Kaiser window (object) +5) Compare results & pass \\ \cline{3-4} + & & 1) Check that calculated psds are identical & pass \\ \hline + \multirow{2}{3cm}{48 } & \multirow{2}{5cm}{Tests the effect of windowing: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) lpsd passing the window name (Kaiser, psll = default) +3) lpsd passing the window object (Kaiser type, psll = default) +4) compares the two psds} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd without detrending, Kaiser window (name) +4) Estimate the psd without detrending, Kaiser window (object) +5) Compare results & pass \\ \cline{3-4} + & & 1) Check that calculated psds are identical & pass \\ \hline + \multirow{2}{3cm}{49 } & \multirow{2}{5cm}{Tests the effect of windowing: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) lpsd passing the window name (Nuttall4) +3) lpsd passing the window object (Nuttall4 type) +4) compares the two psds} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd without detrending, Nuttall4 window (name) +4) Estimate the psd without detrending, Nuttall4 window (object) +5) Compare results & pass \\ \cline{3-4} + & & 1) Check that calculated psds are identical & pass \\ \hline + \multirow{2}{3cm}{50 } & \multirow{2}{5cm}{Tests the effect of windowing: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) lpsd passing the window name (SFT3F) +3) lpsd passing the window object (SFT3F type) +4) compares the two psds} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd without detrending, SFT3F window (name) +4) Estimate the psd without detrending, SFT3F window (object) +5) Compare results & pass \\ \cline{3-4} + & & 1) Check that calculated psds are identical & pass \\ \hline +\caption{Unit tests for ao/lpsd.} +\label{tab:ao_lpsd} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/lscov} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the lscov method works with a vector of AOs as input.} & Test that the lscov method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check the data type of the output +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the lscov method works with a matrix of AOs as input.} & Tests that the lscov method works with a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check the data type of the output +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the lscov method works with a list of AOs as input.} & Tests that the lscov method works with a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check the data type of the output +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the lscov method properly applies history.} & Test that the result of applying the lscov method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'lscov'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{The lscov method can not be used as a modifer method.} & The lscov method can not be used as a modifer method. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Check that the lscov method uses weights for the fit.} & Check that the lscov method uses weights for the fit. & pass \\ \cline{3-4} + & & 1) Check the output data +2) Check the yunits +3) Check that 'out1' and 'out2' have the same data +4) Check that 'out3' and 'out4' have the same data +5) Check the re-built objects & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/lscov] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/lscov.} +\label{tab:ao_lscov} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/lt} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the lt method compare an AO with scalar value} & Test that the lt method works with relational operators and the function +command. Use for this AOs with different data objects. & pass \\ \cline{3-4} + & & 1) Check that the result of the 'relational operator' and the 'function' +command are the same. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the lt method compare an AO with one other AO} & Test that the lt method works with relational operators and the function +command. Use for this AOs with different data objects. +Remark that both AOs must have the same size. & pass \\ \cline{3-4} + & & 1) Check that the result of the 'relational operator' and the 'function' +command are the same. +2) Check that each output AO contains the correct data. & pass \\ \hline +\caption{Unit tests for ao/lt.} +\label{tab:ao_lt} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/ltfe} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the ltfe method works with a vector of AOs as input.} & Test that the ltfe method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the ltfe method doesn't work with a matrix of AOs as input.} & Test that the ltfe method doesn't work for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the ltfe method works with a list of AOs as input.} & Test that the ltfe method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the ltfe method doesn't work with a mix of different shaped +AOs as input.} & Test that the ltfe method doesn't work with an input of matrices and +vectors and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the ltfe method properly applies history.} & Test that the result of applying the ltfe method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'ltfe'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the ltfe method can not modify the input AO.} & Test that the ltfe method can not modify the input AO. +The method must throw an error for the modifier call. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the ltfe method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the output data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the ltfe method pass back the output objects to a list of +output variables or to a single variable.} & This test is not longer necessary because the ltfe method pass back +always only one object. & pass \\ \cline{3-4} + & & 1) Nothing to check & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/ltfe] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{17 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) Ltfe of the white noise series +4) compares the units of the input and output} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) Ltfe of the white noise & pass \\ \cline{3-4} + & & 1) Check that (calculated ltfe yunits) equals [1/Hz] & pass \\ \hline + \multirow{2}{3cm}{30 } & \multirow{2}{5cm}{Tests handling of special cases: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) the same noise series +3) ltfe of the white noise series +4) compares the output to unity} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +the same data as 1) and 2) +4) ltfe of the series & pass \\ \cline{3-4} + & & 1) Check that calculated ltfe equals 1 & pass \\ \hline +\caption{Unit tests for ao/ltfe.} +\label{tab:ao_ltfe} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/max} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/max] method works with a vector of objects as input.} & Test that the [ao/max] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/max] method works with a matrix of objects as input.} & Test that the [ao/max] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/max] method works with a list of objects as input.} & Test that the [ao/max] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/max] method works with a mix of different arrays of objects as input.} & Tests that the [ao/max] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/max] method properly applies history.} & Test that the result of applying the [ao/max] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/max]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/max] method can modify the input AO.} & Test that the [ao/max] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/max] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{208 } & \multirow{2}{5cm}{Test that the [ao/max] method uses the plist to get the axis. This is +intended to test methods like ao/max and ao/min which only allow 'x' and +'y' choices.} & Test that the [ao/max] method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the [ao/max] method applies to the x-axis +2) Check that the [ao/max] method applies to the y-axis +3) Check that the [ao/max] method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/max] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/max] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/max] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/max.} +\label{tab:ao_max} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/mcmc} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the metropolis2D method works with a vector of AOs as input.} & Test that the metropolis2D method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the metropolis2D method works with a matrix of AOs as input.} & Test that the metropolis2D method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the metropolis2D method works with a list of AOs as input.} & Test that the metropolis2D method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the metropolis2D method works with a mix of different shaped AOs as +input.} & Test that the metropolis2D method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the metropolis2D method properly applies history.} & Test that the result of applying the metropolis2D method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'm' corresponds to +'metropolis2D'. +2) Check that the re-built object is the same object as 'm'. +THIS IS NOT TRUE FOR METROPOLIS BECAUSE THE OUTPUT CHAIN IS ONLY +EQUAL STATISTICALLY & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the metropolis2D method can not modify the input AO.} & Test that the tfe method can not modify the input AO. +The method must throw an error for the modifier call. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline +\caption{Unit tests for ao/mcmc.} +\label{tab:ao_mcmc} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/md5} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the md5 method works with a vector of AOs as input.} & Test that the md5 method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' are the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the md5 method works with a matrix of AOs as input.} & Tests that the md5 method works with a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' are the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the md5 method works with a list of AOs as input.} & Tests that the md5 method works with a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' are the same as in the input +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the md5 method works with a mix of different shaped AOs as +input.} & Tests that the md5 method works with a mix of different shaped AOs as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' are the same as in the input +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the md5 method retruns for one input a string and not a cell +of a string} & Special case for one input because in this case retruns md5 a string +and not a cell. & pass \\ \cline{3-4} + & & 1) Check that the output is a string +2) Check that each output AO contains the correct data. & pass \\ \hline +\caption{Unit tests for ao/md5.} +\label{tab:ao_md5} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/mean} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/mean] method works with a vector of objects as input.} & Test that the [ao/mean] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/mean] method works with a matrix of objects as input.} & Test that the [ao/mean] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/mean] method works with a list of objects as input.} & Test that the [ao/mean] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/mean] method works with a mix of different arrays of objects as input.} & Tests that the [ao/mean] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/mean] method properly applies history.} & Test that the result of applying the [ao/mean] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/mean]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/mean] method can modify the input AO.} & Test that the [ao/mean] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/mean] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{108 } & \multirow{2}{5cm}{Test that the [ao/mean] method uses the plist to get the axis. This is +intended to test methods like ao/mean and ao/std which return different +data types depending on which axis is selected.} & Test that the [ao/mean] method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the [ao/mean] method applies to the x-axis +2) Check that the [ao/mean] method applies to the y-axis +3) Check that the [ao/mean] method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/mean] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/mean] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/mean] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/mean.} +\label{tab:ao_mean} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/median} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/median] method works with a vector of objects as input.} & Test that the [ao/median] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/median] method works with a matrix of objects as input.} & Test that the [ao/median] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/median] method works with a list of objects as input.} & Test that the [ao/median] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/median] method works with a mix of different arrays of objects as input.} & Tests that the [ao/median] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/median] method properly applies history.} & Test that the result of applying the [ao/median] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/median]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/median] method can modify the input AO.} & Test that the [ao/median] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/median] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{108 } & \multirow{2}{5cm}{Test that the [ao/median] method uses the plist to get the axis. This is +intended to test methods like ao/mean and ao/std which return different +data types depending on which axis is selected.} & Test that the [ao/median] method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the [ao/median] method applies to the x-axis +2) Check that the [ao/median] method applies to the y-axis +3) Check that the [ao/median] method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/median] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/median] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/median] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/median.} +\label{tab:ao_median} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/min} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/min] method works with a vector of objects as input.} & Test that the [ao/min] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/min] method works with a matrix of objects as input.} & Test that the [ao/min] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/min] method works with a list of objects as input.} & Test that the [ao/min] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/min] method works with a mix of different arrays of objects as input.} & Tests that the [ao/min] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/min] method properly applies history.} & Test that the result of applying the [ao/min] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/min]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/min] method can modify the input AO.} & Test that the [ao/min] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/min] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{208 } & \multirow{2}{5cm}{Test that the [ao/min] method uses the plist to get the axis. This is +intended to test methods like ao/max and ao/min which only allow 'x' and +'y' choices.} & Test that the [ao/min] method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the [ao/min] method applies to the x-axis +2) Check that the [ao/min] method applies to the y-axis +3) Check that the [ao/min] method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/min] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/min] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/min] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/min.} +\label{tab:ao_min} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/minus} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{rule1 (tsdata and tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (fsdata and fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (tsdata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (tsdata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (fsdata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (fsdata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector tsdata and single tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single xydata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector tsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector tsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector fsdata and single fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single xydata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector fsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector fsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector xydata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector xydata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector cdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP tsdata and single tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP tsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP tsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP fsdata and single fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP fsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP fsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP xydata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP xydata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP cdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP tsdata and NxQ tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP tsdata and NxQ xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP tsdata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP fsdata and NxQ fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP fsdata and NxQ xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP fsdata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP xydata and NxQ xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP xydata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP cdata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{minus } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{tests (fsdata and tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (tsdata and fsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (AO no data and tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (tsdata and AO no data)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (different fs in tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (different x units in tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (different x values in fsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (negative test)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (negative test)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline +\caption{Unit tests for ao/minus.} +\label{tab:ao_minus} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/mode} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/mode] method works with a vector of objects as input.} & Test that the [ao/mode] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/mode] method works with a matrix of objects as input.} & Test that the [ao/mode] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/mode] method works with a list of objects as input.} & Test that the [ao/mode] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/mode] method works with a mix of different arrays of objects as input.} & Tests that the [ao/mode] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/mode] method properly applies history.} & Test that the result of applying the [ao/mode] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/mode]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/mode] method can modify the input AO.} & Test that the [ao/mode] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/mode] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{108 } & \multirow{2}{5cm}{Test that the [ao/mode] method uses the plist to get the axis. This is +intended to test methods like ao/mean and ao/std which return different +data types depending on which axis is selected.} & Test that the [ao/mode] method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the [ao/mode] method applies to the x-axis +2) Check that the [ao/mode] method applies to the y-axis +3) Check that the [ao/mode] method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/mode] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/mode] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/mode] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/mode.} +\label{tab:ao_mode} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/mpower} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the mpower method works with a vector of AOs as input.} & Test that the mpower method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is 1 +2) Check that each output AO contains the correct data. +3) Check the y-units & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the mpower method works with a matrix of AOs as input.} & Test that the mpower method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is 1 +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the mpower method works with a list of AOs as input.} & Test that the mpower method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is 1. +2) Check that each output AO contains the correct data. +3) Check the y-units & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the mpower method works with a mix of different shaped AOs as +input.} & Test that the mpower method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Nothing to check & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the mpower method properly applies history.} & Test that the result of applying the mpower method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' and 'out2' corresponds to +'mpower'. +2) Check that the re-built objects are the same objectd as 'out1' and 'out2'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the mpower method can modify the input AO.} & Test that the mpower method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'at4' and 'ain' are now different. +2) Check that 'ain' is mpower(at4). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the mpower method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Nothinf to check & pass \\ \hline +\caption{Unit tests for ao/mpower.} +\label{tab:ao_mpower} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/mrdivide} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{rule1 (tsdata and tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (fsdata and fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (tsdata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (tsdata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (fsdata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (fsdata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector tsdata and single tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single xydata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector tsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector tsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector fsdata and single fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single xydata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector fsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector fsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector xydata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector xydata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector cdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP tsdata and single tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP tsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP tsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP fsdata and single fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP fsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP fsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP xydata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP xydata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP cdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP tsdata and NxQ tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP tsdata and NxQ xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP tsdata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP fsdata and NxQ fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP fsdata and NxQ xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP fsdata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP xydata and NxQ xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP xydata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP cdata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rdivide } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{tests (fsdata and tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (tsdata and fsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (AO no data and tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (tsdata and AO no data)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (different fs in tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (different x values in fsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (negative test)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (negative test)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline +\caption{Unit tests for ao/mrdivide.} +\label{tab:ao_mrdivide} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/mtimes} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the mtimes method works with a list of AOs as input.} & Test that the mtimes method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is 1. +2) Check that each output AO contains the correct data. +3) Check the y-units & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the mtimes method properly applies history.} & Test that the result of applying the mtimes method can be processed back +with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'mtimes'. +2) Check that the rebuilt object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the mtimes method can not be used as a modifier method.} & Tests that the mtimes method can not be used as a modifier method. The +command should fail. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the mtimes method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the method with all data objects.} & Test that the mtimes method works with cdata-, fsdata-, tsdata-, and xydata +objects & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. +2) Check that re-building of output is the same as the output & pass \\ \hline +\caption{Unit tests for ao/mtimes.} +\label{tab:ao_mtimes} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/ne} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the ne method works with a vector of AOs as input.} & Test that the ne method works for a vector of AOs as input. Test the +positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the ne function. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the ne method works with a matrix of AOs as input.} & Test that the ne method works for a matrix of AOs as input. Test the +positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the ne function. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the ne method works with a list of AOs as input.} & The ne method doesn't works for a list of AOs as input. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the ne method works with a mix of different shaped AOs as +input.} & The ne method doesn't works for a list of AOs as input. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the ne method properly applies history.} & The ne method doesn't change the AO, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the ne method with an exception list. +The function ao/ne use the function ao/eq so it is not necessary to check +all possibilities of the exception list.} & Test the ne method with the exception 'name'. Use the option 'internal' to +suppress the history. It is necessary to add 'created' to the exception +list because aa is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the ne method with an exception list which is in a plist.} & Test that the ne method uses the exception list in a plist. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline +\caption{Unit tests for ao/ne.} +\label{tab:ao_ne} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/noisegen1D} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the noisegen1D method works with a vector of AOs as input.} & Test that the noisegen1D method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'av' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the noisegen1D method works with a matrix of AOs as input.} & Test that the noisegen1D method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the noisegen1D method works with a list of AOs as input.} & Test that the noisegen1D method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the noisegen1D method works with a mix of different shaped AOs as +input.} & Test that the noisegen1D method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the noisegen1D method properly applies history.} & Test that the result of applying the noisegen1D method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'noisegen1D'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the noisegen1D method can modify the input AO.} & Test that the noisegen1D method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is changed & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the noisegen1D method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the noisegen1D method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Tests that the noisegen1D method properly applies history for set filter.} & Test that the result of applying the noisegen1D method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'noisegen1D'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Tests that the noisegen1D method can modify the input AO for set 'filter'.} & Test that the noisegen1D method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Check that the noisegen1D method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for ao/noisegen1D.} +\label{tab:ao_noisegen1D} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/noisegen2D} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the noisegen2D method works with a vector of AOs as input.} & Test that the noisegen2D method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'acv2' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the noisegen2D method works with a matrix of AOs as input.} & Test that the noisegen2D method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the noisegen2D method works with a list of AOs as input.} & Test that the noisegen2D method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the noisegen2D method works with a mix of different shaped AOs as +input.} & Test that the whiten1D method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the noisegen2D method properly applies history.} & Test that the result of applying the noisegen2D method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'noisegen2D'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{The noisegen2D method can not modify the input AO.} & The noisegen2D method can not modify the input AO. & pass \\ \cline{3-4} + & & 1) Nothing to do. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the noisegen2D method keeps the data shape of the input object. The +input AO must be a couple AO with row data and a couple AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the noisegen2D method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Tests that the noisegen2D method properly applies history.} & Test that the result of applying the noisegen2D method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'noisegen2D'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline +\caption{Unit tests for ao/noisegen2D.} +\label{tab:ao_noisegen2D} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/norm} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the norm method works with a vector of AOs as input.} & Test that the norm method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the norm method works with a matrix of AOs as input.} & Test that the norm method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the norm method works with a list of AOs as input.} & Test that the norm method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the norm method works with a mix of different shaped AOs as +input.} & Test that the norm method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the norm method properly applies history.} & Test that the result of applying the norm method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'norm'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the norm method can modify the input AO.} & Test that the norm method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'at4' and 'ain' are now different. +2) Check that 'ain' is norm(at4). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the norm method can modify the single axis controlled by the +plist and the resuld can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the norm method applies with different options +2) Check that the re-built objects are the same object as 'out[1..4]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the norm method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline +\caption{Unit tests for ao/norm.} +\label{tab:ao_norm} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/offset} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the offset method works with a vector of AOs as input.} & Test that the offset method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the offset method works with a matrix of AOs as input.} & Test that the offset method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the offset method works with a list of AOs as input.} & Test that the offset method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the offset method works with a mix of different shaped AOs as +input.} & Test that the offset method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the offset method properly applies history.} & Test that the result of applying the offset method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'offset'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the offset method can modify the input AO.} & Test that the offset method can modify the input AO by calling with +no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified have an offset of 3 +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the offset method uses the offset in a plist.} & Test that the offset method uses the offset in a plist. & pass \\ \cline{3-4} + & & 1) Check that the offset uses the offset in the plist +2) Check that the re-built object is the same as 'out' & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the offset method keeps the data shape of the input object. +The input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the offset method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/offset] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/offset.} +\label{tab:ao_offset} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/or} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{rule1 (tsdata and tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (fsdata and fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (tsdata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (tsdata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (fsdata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (fsdata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector tsdata and single tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single xydata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector tsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector tsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector fsdata and single fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single xydata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector fsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector fsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector xydata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector xydata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector cdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP tsdata and single tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP tsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP tsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP fsdata and single fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP fsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP fsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP xydata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP xydata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP cdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP tsdata and NxQ tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP tsdata and NxQ xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP tsdata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP fsdata and NxQ fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP fsdata and NxQ xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP fsdata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP xydata and NxQ xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP xydata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP cdata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{or } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{tests (fsdata and tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (tsdata and fsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (AO no data and tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (tsdata and AO no data)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (different fs in tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (different x values in fsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (negative test)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (negative test)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline +\caption{Unit tests for ao/or.} +\label{tab:ao_or} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/phase} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/phase] method works with a vector of objects as input.} & Test that the [ao/phase] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/phase] method works with a matrix of objects as input.} & Test that the [ao/phase] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/phase] method works with a list of objects as input.} & Test that the [ao/phase] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/phase] method works with a mix of different arrays of objects as input.} & Tests that the [ao/phase] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/phase] method properly applies history.} & Test that the result of applying the [ao/phase] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/phase]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/phase] method can modify the input AO.} & Test that the [ao/phase] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/phase] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/phase] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/phase] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/phase] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/phase.} +\label{tab:ao_phase} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/plus} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{rule1 (tsdata and tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (fsdata and fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (tsdata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (tsdata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (fsdata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (fsdata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector tsdata and single tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single xydata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector tsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector tsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector fsdata and single fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single xydata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector fsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector fsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector xydata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector xydata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector cdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP tsdata and single tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP tsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP tsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP fsdata and single fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP fsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP fsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP xydata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP xydata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP cdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP tsdata and NxQ tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP tsdata and NxQ xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP tsdata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP fsdata and NxQ fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP fsdata and NxQ xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP fsdata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP xydata and NxQ xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP xydata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP cdata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{plus } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{tests (fsdata and tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (tsdata and fsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (AO no data and tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (tsdata and AO no data)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (different fs in tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (different x units in tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (different x values in fsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (negative test)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (negative test)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline +\caption{Unit tests for ao/plus.} +\label{tab:ao_plus} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/polyfit} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the polyfit method fails with with a vector of AOs as input.} & Test that the polyfit method works with a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check we have the correct number of output objects in the version with +single output +2) Check we have the correct number of elements in the output objects & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the polyfit method works with a matrix of AOs as input.} & Test that the polyfit method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check we have the correct number of output objects & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the polyfit method works with a list of AOs as input.} & Test that the polyfit method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check we have the correct number of output objects in the version with +single output +2) Check we have the correct number of elements in the output objects & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the polyfit method works with a mix of different shaped AOs as +input.} & Test that the polyfit method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check we have the correct number of output objects & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the polyfit method properly applies history.} & Test that the result of applying the polyfit method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'polyfit'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the polyfit method cannot modify the input AO.} & Test that the polyfit method cannot modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Nothing to check & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the polyfit method handles units correctly.} & Tests that the polyfit method handles units correctly. & pass \\ \cline{3-4} + & & 1) Check that the units in both cases are yunits/(xunits)\^(j) & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests that the ao/polyfit method agrees with MATLAB's polyfit when +configured to use the same parameters.} & Test that applying polyfit works on a single AO. & pass \\ \cline{3-4} + & & 1) Check that output agrees with the output of MATLAB's polyfit. & pass \\ \hline +\caption{Unit tests for ao/polyfit.} +\label{tab:ao_polyfit} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/power} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the power method works with a vector of AOs as input.} & Test that the power method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is 1 +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the power method works with a matrix of AOs as input.} & Test that the power method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is 1 +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the power method works with a list of AOs as input.} & Test that the power method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is 1. +2) Check that each output AO contains the correct data. +3) Check the y-units & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the power method works with a mix of different shaped AOs as +input.} & Test that the power method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is 1. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the power method properly applies history.} & Test that the result of applying the power method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'power'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the power method can modify the input AO.} & Test that the power method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is power(at1). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the power method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the method with all data objects.} & Test that the power method works with cdata-, fsdata-, tsdata-, and xydata +objects & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. +2) Check that re-building of output is the same as the output & pass \\ \hline +\caption{Unit tests for ao/power.} +\label{tab:ao_power} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/psd} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the psd method works with a vector of AOs as input.} & Test that the psd method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in the input. +2) Check that each output object contains the correct values. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the psd method works with a matrix of AOs as input.} & Test that the psd method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in the input. +2) Check that each output object contains the correct values. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the psd method works with a list of AOs as input.} & Test that the psd method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the psd method works with a mix of different shaped AOs as +input.} & Test that the psd method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the psd method properly applies history.} & Test that the result of applying the psd method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'psd'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the psd method agrees with MATLAB's pwelch, within some tolerance, +when configured to use the same parameters.} & Test that the applying psd works on a single AO. & pass \\ \cline{3-4} + & & 1) Check that output agrees with the output of MATLAB's pwelch within tolerance. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Check that the psd method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests that the psd method agrees with MATLAB's pwelch when +configured to use the same parameters.} & Test that the applying psd works on a single AO. & pass \\ \cline{3-4} + & & 1) Check that output agrees with the output of MATLAB's pwelch. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Tests that the psd method agrees with MATLAB's pwelch when +configured to use the same parameters.} & Test that the applying psd works on a single AO. & pass \\ \cline{3-4} + & & 1) Check that output agrees with the output of MATLAB's pwelch. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/psd] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Tests "conservation of energy": +1) white noise produced from uniform pdf, with a given mean value and +sigma (distribution's 1st and 2nd order) +2) evaluate the sample mean value m and standard deviation s +3) psd of the white noise +4) compares the sqrt(sum(S * df)) with the standard deviation s} & 1) Prepare the test tsdata: +white noise from uniform distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd & pass \\ \cline{3-4} + & & 1) Check that calculated psd energy equals the rms content of the tsdata, estimated by the std of the sample & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Tests "conservation of energy" with fixed parameters: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd order) +2) evaluate the sample mean value m and standard deviation s +3) psd of the white noise +4) compares the sqrt(sum(S * df)) with the standard deviation s} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd & pass \\ \cline{3-4} + & & 1) Check that calculated psd energy equals the rms content of the tsdata, estimated by the std of the sample & pass \\ \hline + \multirow{2}{3cm}{14 } & \multirow{2}{5cm}{Tests "conservation of energy" with fixed parameters: +1) white noise produced from uniform pdf, with a given mean value and +sigma (distribution's 1st and 2nd order) +2) evaluate the sample mean value m and standard deviation s +3) psd of the white noise +4) compares the sqrt(sum(S * df)) with the standard deviation s} & 1) Prepare the test tsdata: +white noise from uniform distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd & pass \\ \cline{3-4} + & & 1) Check that calculated psd energy equals the rms content of the tsdata, estimated by the std of the sample & pass \\ \hline + \multirow{2}{3cm}{15 } & \multirow{2}{5cm}{Tests "conservation of energy" with fixed parameters: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd order) +2) evaluate the sample mean value m and standard deviation s +3) psd of the white noise +4) compares the sqrt(sum(S * df)) with the standard deviation s} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd & pass \\ \cline{3-4} + & & 1) Check that calculated psd energy equals the rms content of the tsdata, estimated by the std of the sample & pass \\ \hline + \multirow{2}{3cm}{16 } & \multirow{2}{5cm}{Tests "conservation of energy" with fixed parameters: +1) white noise produced from uniform pdf, with a given mean value and +sigma (distribution's 1st and 2nd order) +2) evaluate the sample mean value m and standard deviation s +3) psd of the white noise +4) compares the sqrt(sum(S * df)) with the standard deviation s} & 1) Prepare the test tsdata: +white noise from uniform distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd & pass \\ \cline{3-4} + & & 1) Check that calculated psd energy equals the rms content of the tsdata, estimated by the std of the sample & pass \\ \hline + \multirow{2}{3cm}{17 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) PSD of the white noise +3) compares the units of the input and output} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) PSD of the white noise & pass \\ \cline{3-4} + & & 1) Check that (calculated PSD yunits) equals (input units)\^2 / Hz +2) Check that (calculated PSD xunits) equals Hz & pass \\ \hline + \multirow{2}{3cm}{18 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from uniform pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) ASD of the white noise +3) compares the units of the input and output} & 1) Prepare the test tsdata: +white noise from uniform distribution + offset +2) Assign a random unit +3) ASD of the white noise & pass \\ \cline{3-4} + & & 1) Check that (calculated ASD yunits) equals (input units) / Hz\^(1/2) +2) Check that (calculated ASD xunits) equals Hz & pass \\ \hline + \multirow{2}{3cm}{19 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) PS of the white noise +3) compares the units of the input and output} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) PS of the white noise & pass \\ \cline{3-4} + & & 1) Check that (calculated PS yunits) equals (input units)\^2 +2) Check that (calculated PS xunits) equals Hz & pass \\ \hline + \multirow{2}{3cm}{20 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from uniform distribution, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) AS of the white noise +3) compares the units of the input and output} & 1) Prepare the test tsdata: +white noise from uniform distribution + offset +2) Assign a random unit +3) AS of the white noise & pass \\ \cline{3-4} + & & 1) Check that (calculated AS yunits) equals (input units) +2) Check that (calculated AS xunits) equals Hz & pass \\ \hline + \multirow{2}{3cm}{21 } & \multirow{2}{5cm}{Tests "conservation of energy": +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) Calculate the expected level of noise from sample statistics +3) Calculates the PSD of the individual parts, with: +Welch window and no detrend +4) Evaluate the mean and standard deviation of the Checks on individual PSDs: +5) Checks on individual PSDs: mean and standard deviation of the PSD points +6) Evaluate the expected value, estimated from the std of the +individual segments +7) Compares with the mean performed on the individual segments +8) Checks on averaged PSDs: mean and standard deviation of all the PSD points +9) Compares the grand-mean with the estimated white noise level} & 1) Split the reference data into different segments +2) Calculates the PSD of the individual parts & pass \\ \cline{3-4} + & & 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: +2) Checks on individual PSDs: mean and standard deviation of the PSD points +3) Evaluate the expected value, estimated from the std of the +individual segments +4) Compares with the mean performed on the individual segments +5) Checks on averaged PSDs: mean and standard deviation of all the PSD points +6) Compares the grand-mean with the estimated white noise level & pass \\ \hline + \multirow{2}{3cm}{22 } & \multirow{2}{5cm}{Tests "conservation of energy": +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) Calculate the expected level of noise from sample statistics +3) Calculates the PSD of the individual parts, with: +Welch window and mean detrend +4) Evaluate the mean and standard deviation of the Checks on individual PSDs: +5) Checks on individual PSDs: mean and standard deviation of the PSD points +6) Evaluate the expected value, estimated from the std of the +individual segments +7) Compares with the mean performed on the individual segments +8) Checks on averaged PSDs: mean and standard deviation of all the PSD points +9) Compares the grand-mean with the estimated white noise level} & 1) Split the reference data into different segments +2) Calculates the PSD of the individual parts & pass \\ \cline{3-4} + & & 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: +2) Checks on individual PSDs: mean and standard deviation of the PSD points +3) Evaluate the expected value, estimated from the std of the +individual segments +4) Compares with the mean performed on the individual segments +5) Checks on averaged PSDs: mean and standard deviation of all the PSD points +6) Compares the grand-mean with the estimated white noise level & pass \\ \hline + \multirow{2}{3cm}{23 } & \multirow{2}{5cm}{Tests "conservation of energy": +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) Calculate the expected level of noise from sample statistics +3) Calculates the PSD of the individual parts, with: +Welch window and linear detrend +4) Evaluate the mean and standard deviation of the Checks on individual PSDs: +5) Checks on individual PSDs: mean and standard deviation of the PSD points +6) Evaluate the expected value, estimated from the std of the +individual segments +7) Compares with the mean performed on the individual segments +8) Checks on averaged PSDs: mean and standard deviation of all the PSD points +9) Compares the grand-mean with the estimated white noise level} & 1) Split the reference data into different segments +2) Calculates the PSD of the individual parts & pass \\ \cline{3-4} + & & 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: +2) Checks on individual PSDs: mean and standard deviation of the PSD points +3) Evaluate the expected value, estimated from the std of the +individual segments +4) Compares with the mean performed on the individual segments +5) Checks on averaged PSDs: mean and standard deviation of all the PSD points +6) Compares the grand-mean with the estimated white noise level & pass \\ \hline + \multirow{2}{3cm}{24 } & \multirow{2}{5cm}{Tests "conservation of energy": +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) Calculate the expected level of noise from sample statistics +3) Calculates the PSD of the individual parts, with: +Hanning window and no detrend +4) Evaluate the mean and standard deviation of the Checks on individual PSDs: +5) Checks on individual PSDs: mean and standard deviation of the PSD points +6) Evaluate the expected value, estimated from the std of the +individual segments +7) Compares with the mean performed on the individual segments +8) Checks on averaged PSDs: mean and standard deviation of all the PSD points +9) Compares the grand-mean with the estimated white noise level} & 1) Split the reference data into different segments +2) Calculates the PSD of the individual parts & pass \\ \cline{3-4} + & & 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: +2) Checks on individual PSDs: mean and standard deviation of the PSD points +3) Evaluate the expected value, estimated from the std of the +individual segments +4) Compares with the mean performed on the individual segments +5) Checks on averaged PSDs: mean and standard deviation of all the PSD points +6) Compares the grand-mean with the estimated white noise level & pass \\ \hline + \multirow{2}{3cm}{25 } & \multirow{2}{5cm}{Tests "conservation of energy": +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) Calculate the expected level of noise from sample statistics +3) Calculates the PSD of the individual parts, with: +Hanning window and mean detrend +4) Evaluate the mean and standard deviation of the Checks on individual PSDs: +5) Checks on individual PSDs: mean and standard deviation of the PSD points +6) Evaluate the expected value, estimated from the std of the +individual segments +7) Compares with the mean performed on the individual segments +8) Checks on averaged PSDs: mean and standard deviation of all the PSD points +9) Compares the grand-mean with the estimated white noise level} & 1) Split the reference data into different segments +2) Calculates the PSD of the individual parts & pass \\ \cline{3-4} + & & 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: +2) Checks on individual PSDs: mean and standard deviation of the PSD points +3) Evaluate the expected value, estimated from the std of the +individual segments +4) Compares with the mean performed on the individual segments +5) Checks on averaged PSDs: mean and standard deviation of all the PSD points +6) Compares the grand-mean with the estimated white noise level & pass \\ \hline + \multirow{2}{3cm}{26 } & \multirow{2}{5cm}{Tests "conservation of energy": +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) Calculate the expected level of noise from sample statistics +3) Calculates the PSD of the individual parts, with: +Hanning window and linear detrend +4) Evaluate the mean and standard deviation of the Checks on individual PSDs: +5) Checks on individual PSDs: mean and standard deviation of the PSD points +6) Evaluate the expected value, estimated from the std of the +individual segments +7) Compares with the mean performed on the individual segments +8) Checks on averaged PSDs: mean and standard deviation of all the PSD points +9) Compares the grand-mean with the estimated white noise level} & 1) Split the reference data into different segments +2) Calculates the PSD of the individual parts & pass \\ \cline{3-4} + & & 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: +2) Checks on individual PSDs: mean and standard deviation of the PSD points +3) Evaluate the expected value, estimated from the std of the +individual segments +4) Compares with the mean performed on the individual segments +5) Checks on averaged PSDs: mean and standard deviation of all the PSD points +6) Compares the grand-mean with the estimated white noise level & pass \\ \hline + \multirow{2}{3cm}{27 } & \multirow{2}{5cm}{Tests "conservation of energy": +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) Calculate the expected level of noise from sample statistics +3) Calculates the PSD of the individual parts, with: +Hamming window and no detrend +4) Evaluate the mean and standard deviation of the Checks on individual PSDs: +5) Checks on individual PSDs: mean and standard deviation of the PSD points +6) Evaluate the expected value, estimated from the std of the +individual segments +7) Compares with the mean performed on the individual segments +8) Checks on averaged PSDs: mean and standard deviation of all the PSD points +9) Compares the grand-mean with the estimated white noise level} & 1) Split the reference data into different segments +2) Calculates the PSD of the individual parts & pass \\ \cline{3-4} + & & 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: +2) Checks on individual PSDs: mean and standard deviation of the PSD points +3) Evaluate the expected value, estimated from the std of the +individual segments +4) Compares with the mean performed on the individual segments +5) Checks on averaged PSDs: mean and standard deviation of all the PSD points +6) Compares the grand-mean with the estimated white noise level & pass \\ \hline + \multirow{2}{3cm}{28 } & \multirow{2}{5cm}{Tests "conservation of energy": +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) Calculate the expected level of noise from sample statistics +3) Calculates the PSD of the individual parts, with: +Hamming window and mean detrend +4) Evaluate the mean and standard deviation of the Checks on individual PSDs: +5) Checks on individual PSDs: mean and standard deviation of the PSD points +6) Evaluate the expected value, estimated from the std of the +individual segments +7) Compares with the mean performed on the individual segments +8) Checks on averaged PSDs: mean and standard deviation of all the PSD points +9) Compares the grand-mean with the estimated white noise level} & 1) Split the reference data into different segments +2) Calculates the PSD of the individual parts & pass \\ \cline{3-4} + & & 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: +2) Checks on individual PSDs: mean and standard deviation of the PSD points +3) Evaluate the expected value, estimated from the std of the +individual segments +4) Compares with the mean performed on the individual segments +5) Checks on averaged PSDs: mean and standard deviation of all the PSD points +6) Compares the grand-mean with the estimated white noise level & pass \\ \hline + \multirow{2}{3cm}{29 } & \multirow{2}{5cm}{Tests "conservation of energy": +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) Calculate the expected level of noise from sample statistics +3) Calculates the PSD of the individual parts, with: +Hamming window and linear detrend +4) Evaluate the mean and standard deviation of the Checks on individual PSDs: +5) Checks on individual PSDs: mean and standard deviation of the PSD points +6) Evaluate the expected value, estimated from the std of the +individual segments +7) Compares with the mean performed on the individual segments +8) Checks on averaged PSDs: mean and standard deviation of all the PSD points +9) Compares the grand-mean with the estimated white noise level} & 1) Split the reference data into different segments +2) Calculates the PSD of the individual parts & pass \\ \cline{3-4} + & & 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: +2) Checks on individual PSDs: mean and standard deviation of the PSD points +3) Evaluate the expected value, estimated from the std of the +individual segments +4) Compares with the mean performed on the individual segments +5) Checks on averaged PSDs: mean and standard deviation of all the PSD points +6) Compares the grand-mean with the estimated white noise level & pass \\ \hline + \multirow{2}{3cm}{30 } & \multirow{2}{5cm}{Tests "conservation of energy": +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) Calculate the expected level of noise from sample statistics +3) Calculates the PSD of the individual parts, with: +BH92 window and no detrend +4) Evaluate the mean and standard deviation of the Checks on individual PSDs: +5) Checks on individual PSDs: mean and standard deviation of the PSD points +6) Evaluate the expected value, estimated from the std of the +individual segments +7) Compares with the mean performed on the individual segments +8) Checks on averaged PSDs: mean and standard deviation of all the PSD points +9) Compares the grand-mean with the estimated white noise level} & 1) Split the reference data into different segments +2) Calculates the PSD of the individual parts & pass \\ \cline{3-4} + & & 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: +2) Checks on individual PSDs: mean and standard deviation of the PSD points +3) Evaluate the expected value, estimated from the std of the +individual segments +4) Compares with the mean performed on the individual segments +5) Checks on averaged PSDs: mean and standard deviation of all the PSD points +6) Compares the grand-mean with the estimated white noise level & pass \\ \hline + \multirow{2}{3cm}{31 } & \multirow{2}{5cm}{Tests "conservation of energy": +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) Calculate the expected level of noise from sample statistics +3) Calculates the PSD of the individual parts, with: +BH92 window and mean detrend +4) Evaluate the mean and standard deviation of the Checks on individual PSDs: +5) Checks on individual PSDs: mean and standard deviation of the PSD points +6) Evaluate the expected value, estimated from the std of the +individual segments +7) Compares with the mean performed on the individual segments +8) Checks on averaged PSDs: mean and standard deviation of all the PSD points +9) Compares the grand-mean with the estimated white noise level} & 1) Split the reference data into different segments +2) Calculates the PSD of the individual parts & pass \\ \cline{3-4} + & & 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: +2) Checks on individual PSDs: mean and standard deviation of the PSD points +3) Evaluate the expected value, estimated from the std of the +individual segments +4) Compares with the mean performed on the individual segments +5) Checks on averaged PSDs: mean and standard deviation of all the PSD points +6) Compares the grand-mean with the estimated white noise level & pass \\ \hline + \multirow{2}{3cm}{32 } & \multirow{2}{5cm}{Tests "conservation of energy": +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) Calculate the expected level of noise from sample statistics +3) Calculates the PSD of the individual parts, with: +BH92 window and linear detrend +4) Evaluate the mean and standard deviation of the Checks on individual PSDs: +5) Checks on individual PSDs: mean and standard deviation of the PSD points +6) Evaluate the expected value, estimated from the std of the +individual segments +7) Compares with the mean performed on the individual segments +8) Checks on averaged PSDs: mean and standard deviation of all the PSD points +9) Compares the grand-mean with the estimated white noise level} & 1) Split the reference data into different segments +2) Calculates the PSD of the individual parts & pass \\ \cline{3-4} + & & 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: +2) Checks on individual PSDs: mean and standard deviation of the PSD points +3) Evaluate the expected value, estimated from the std of the +individual segments +4) Compares with the mean performed on the individual segments +5) Checks on averaged PSDs: mean and standard deviation of all the PSD points +6) Compares the grand-mean with the estimated white noise level & pass \\ \hline + \multirow{2}{3cm}{33 } & \multirow{2}{5cm}{Tests "conservation of energy": +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) Calculate the expected level of noise from sample statistics +3) Calculates the PSD of the individual parts, with: +Kaiser200 window and no detrend +4) Evaluate the mean and standard deviation of the Checks on individual PSDs: +5) Checks on individual PSDs: mean and standard deviation of the PSD points +6) Evaluate the expected value, estimated from the std of the +individual segments +7) Compares with the mean performed on the individual segments +8) Checks on averaged PSDs: mean and standard deviation of all the PSD points +9) Compares the grand-mean with the estimated white noise level} & 1) Split the reference data into different segments +2) Calculates the PSD of the individual parts & pass \\ \cline{3-4} + & & 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: +2) Checks on individual PSDs: mean and standard deviation of the PSD points +3) Evaluate the expected value, estimated from the std of the +individual segments +4) Compares with the mean performed on the individual segments +5) Checks on averaged PSDs: mean and standard deviation of all the PSD points +6) Compares the grand-mean with the estimated white noise level & pass \\ \hline + \multirow{2}{3cm}{34 } & \multirow{2}{5cm}{Tests "conservation of energy": +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) Calculate the expected level of noise from sample statistics +3) Calculates the PSD of the individual parts, with: +Kaiser200 window and mean detrend +4) Evaluate the mean and standard deviation of the Checks on individual PSDs: +5) Checks on individual PSDs: mean and standard deviation of the PSD points +6) Evaluate the expected value, estimated from the std of the +individual segments +7) Compares with the mean performed on the individual segments +8) Checks on averaged PSDs: mean and standard deviation of all the PSD points +9) Compares the grand-mean with the estimated white noise level} & 1) Split the reference data into different segments +2) Calculates the PSD of the individual parts & pass \\ \cline{3-4} + & & 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: +2) Checks on individual PSDs: mean and standard deviation of the PSD points +3) Evaluate the expected value, estimated from the std of the +individual segments +4) Compares with the mean performed on the individual segments +5) Checks on averaged PSDs: mean and standard deviation of all the PSD points +6) Compares the grand-mean with the estimated white noise level & pass \\ \hline + \multirow{2}{3cm}{35 } & \multirow{2}{5cm}{Tests "conservation of energy": +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) Calculate the expected level of noise from sample statistics +3) Calculates the PSD of the individual parts, with: +Kaiser200 window and linear detrend +4) Evaluate the mean and standard deviation of the Checks on individual PSDs: +5) Checks on individual PSDs: mean and standard deviation of the PSD points +6) Evaluate the expected value, estimated from the std of the +individual segments +7) Compares with the mean performed on the individual segments +8) Checks on averaged PSDs: mean and standard deviation of all the PSD points +9) Compares the grand-mean with the estimated white noise level} & 1) Split the reference data into different segments +2) Calculates the PSD of the individual parts & pass \\ \cline{3-4} + & & 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: +2) Checks on individual PSDs: mean and standard deviation of the PSD points +3) Evaluate the expected value, estimated from the std of the +individual segments +4) Compares with the mean performed on the individual segments +5) Checks on averaged PSDs: mean and standard deviation of all the PSD points +6) Compares the grand-mean with the estimated white noise level & pass \\ \hline + \multirow{2}{3cm}{38 } & \multirow{2}{5cm}{Tests "conservation of energy": +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) evaluate the sample mean value m and standard deviation s +3) add a given trend of order n +4) psd of the noise, with proper detrending +5) compares the sqrt(sum(S * df)) with the standard deviation s} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Add a trend +4) Estimate the psd & pass \\ \cline{3-4} + & & 1) Check that calculated psd energy equals the rms content of the tsdata, estimated by the std of the sample & pass \\ \hline + \multirow{2}{3cm}{39 } & \multirow{2}{5cm}{Tests "conservation of energy": +1) white noise produced from uniform pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) evaluate the sample mean value m and standard deviation s +3) add a given trend of order n +4) psd of the noise, with proper detrending +5) compares the sqrt(sum(S * df)) with the standard deviation s} & 1) Prepare the test tsdata: +white noise from uniform distribution + offset +2) Calculate the statistical parameters +3) Add a trend +4) Estimate the psd & pass \\ \cline{3-4} + & & 1) Check that calculated psd energy equals the rms content of the tsdata, estimated by the std of the sample & pass \\ \hline + \multirow{2}{3cm}{40 } & \multirow{2}{5cm}{Tests "conservation of energy": +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) evaluate the sample mean value m and standard deviation s +3) add a given trend of order n +4) psd of the noise, with proper detrending +5) compares the sqrt(sum(S * df)) with the standard deviation s} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Add a trend +4) Estimate the psd & pass \\ \cline{3-4} + & & 1) Check that calculated psd energy equals the rms content of the tsdata, estimated by the std of the sample & pass \\ \hline + \multirow{2}{3cm}{41 } & \multirow{2}{5cm}{Tests the effect of windowing: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) psd of the noise, without detrending, Rectangular window +3) Apply the detrending and the window manually +4) psd of the noise, without detrending, Rectangular window +5) compares the to psds} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd without detrending, Rectangular window +4) Manually apply window to the data +5) Estimate the psd without detrending, Rectangular window & pass \\ \cline{3-4} + & & 1) Check that calculated psds are identical within a part in 10\^12 & pass \\ \hline + \multirow{2}{3cm}{42 } & \multirow{2}{5cm}{Tests the effect of windowing: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) psd of the noise, without detrending, BH92 window +3) Apply the detrending and the window manually +4) psd of the noise, without detrending, Rectangular window +5) compares the to psds} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd without detrending, BH92 window +4) Manually apply window to the data +5) Estimate the psd without detrending, Rectangular window & pass \\ \cline{3-4} + & & 1) Check that calculated psds are identical within a part in 10\^12 & pass \\ \hline + \multirow{2}{3cm}{43 } & \multirow{2}{5cm}{Tests the effect of windowing: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) psd of the noise, without detrending, Hamming window +3) Apply the detrending and the window manually +4) psd of the noise, without detrending, Rectangular window +5) compares the to psds} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd without detrending, Hamming window +4) Manually apply window to the data +5) Estimate the psd without detrending, Rectangular window & pass \\ \cline{3-4} + & & 1) Check that calculated psds are identical within a part in 10\^12 & pass \\ \hline + \multirow{2}{3cm}{44 } & \multirow{2}{5cm}{Tests the effect of windowing: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) psd of the noise, without detrending, Hanning window +3) Apply the detrending and the window manually +4) psd of the noise, without detrending, Rectangular window +5) compares the to psds} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd without detrending, Hanning window +4) Manually apply window to the data +5) Estimate the psd without detrending, Rectangular window & pass \\ \cline{3-4} + & & 1) Check that calculated psds are identical within a part in 10\^12 & pass \\ \hline + \multirow{2}{3cm}{45 } & \multirow{2}{5cm}{Tests the effect of windowing: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) psd of the noise, without detrending, Bartlett window +3) Apply the detrending and the window manually +4) psd of the noise, without detrending, Rectangular window +5) compares the to psds} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd without detrending, Bartlett window +4) Manually apply window to the data +5) Estimate the psd without detrending, Rectangular window & pass \\ \cline{3-4} + & & 1) Check that calculated psds are identical within a part in 10\^12 & pass \\ \hline + \multirow{2}{3cm}{46 } & \multirow{2}{5cm}{Tests the effect of windowing: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) psd of the noise, without detrending, Nuttall3 window +3) Apply the detrending and the window manually +4) psd of the noise, without detrending, Rectangular window +5) compares the to psds} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd without detrending, Nuttall3 window +4) Manually apply window to the data +5) Estimate the psd without detrending, Rectangular window & pass \\ \cline{3-4} + & & 1) Check that calculated psds are identical within a part in 10\^12 & pass \\ \hline + \multirow{2}{3cm}{47 } & \multirow{2}{5cm}{Tests the effect of windowing: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) psd of the noise, without detrending, Kaiser psll = random window +3) Apply the detrending and the window manually +4) psd of the noise, without detrending, Rectangular window +5) compares the to psds} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd without detrending, Kaiser psll = random window +4) Manually apply window to the data +5) Estimate the psd without detrending, Rectangular window & pass \\ \cline{3-4} + & & 1) Check that calculated psds are identical within a part in 10\^12 & pass \\ \hline + \multirow{2}{3cm}{48 } & \multirow{2}{5cm}{Tests the effect of windowing: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) psd of the noise, without detrending, Kaiser psll = default window +3) Apply the detrending and the window manually +4) psd of the noise, without detrending, Rectangular window +5) compares the to psds} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd without detrending, Kaiser psll = default window +4) Manually apply window to the data +5) Estimate the psd without detrending, Rectangular window & pass \\ \cline{3-4} + & & 1) Check that calculated psds are identical within a part in 10\^12 & pass \\ \hline + \multirow{2}{3cm}{49 } & \multirow{2}{5cm}{Tests the effect of windowing: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) psd of the noise, without detrending, Nuttall4 window +3) Apply the detrending and the window manually +4) psd of the noise, without detrending, Rectangular window +5) compares the to psds} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd without detrending, Nuttall4 window +4) Manually apply window to the data +5) Estimate the psd without detrending, Rectangular window & pass \\ \cline{3-4} + & & 1) Check that calculated psds are identical within a part in 10\^12 & pass \\ \hline + \multirow{2}{3cm}{50 } & \multirow{2}{5cm}{Tests the effect of windowing: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) psd of the noise, without detrending, SFT3F window +3) Apply the detrending and the window manually +4) psd of the noise, without detrending, Rectangular window +5) compares the to psds} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd without detrending, SFT3F window +4) Manually apply window to the data +5) Estimate the psd without detrending, Rectangular window & pass \\ \cline{3-4} + & & 1) Check that calculated psds are identical within a part in 10\^12 & pass \\ \hline + \multirow{2}{3cm}{51 } & \multirow{2}{5cm}{Tests the possibility to set the number of averages rather than setting the Nfft: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) psd of the noise, without detrending, random window, set number of +averages +3) check the effective number of averages} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) psd of the noise, without detrending, random window, set number of +averages & pass \\ \cline{3-4} + & & 1) Check that calculated navs are identical to those requested & pass \\ \hline + \multirow{2}{3cm}{52 } & \multirow{2}{5cm}{Tests the possibility to set the number of averages rather than setting the Nfft: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) psd of the noise, without detrending, random window, random navs +3) get the number of averages +4) get the nfft used +5) run psd again, with the nfft used +6) compare the calculated objects} & 1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) psd of the noise, without detrending, random window, random navs +3) get the number of averages +4) get the nfft used +5) run psd again, with the nfft used & pass \\ \cline{3-4} + & & 1) Check that calculated objects S1 and S2 are identical & pass \\ \hline + \multirow{2}{3cm}{53 } & \multirow{2}{5cm}{Tests the possibility to set the number of averages rather than setting the Nfft: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) psd of the noise, without detrending, random window, random navs +3) get the number of averages +4) get the nfft used +5) run psd again, with the nfft used +6) compare navs, nfft, psds} & 1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) psd of the noise, without detrending, random window, random navs +3) get the number of averages +4) get the nfft used +5) run psd again, with the nfft used +6) run psd again, with conflicting parameters, and verify it uses +nfft rather than navs & pass \\ \cline{3-4} + & & 1) Check that calculated objects S1 and S2 are identical +2) Check that S3 used different values & pass \\ \hline + \multirow{2}{3cm}{54 } & \multirow{2}{5cm}{Tests "conservation of energy": +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd order) +2) evaluate the sample mean value m and standard deviation s +3) psd of the white noise +4) compares the sqrt(sum(S * df)) with the standard deviation s} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd & pass \\ \cline{3-4} + & & 1) Check that calculated psd energy equals the rms content of the tsdata, estimated by the std of the sample & pass \\ \hline + \multirow{2}{3cm}{60 } & \multirow{2}{5cm}{Tests the 'basic' call: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) psd of the noise, defualt detrending, default window, no averaging} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd with default detrending, default window, no averaging & pass \\ \cline{3-4} + & & 1) Nothing to check & pass \\ \hline + \multirow{2}{3cm}{61 } & \multirow{2}{5cm}{Tests the 'basic' call: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) psd of the noise, defualt detrending, default window, no averaging} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd with default detrending, default window, no averaging & pass \\ \cline{3-4} + & & 1) Nothing to check & pass \\ \hline + \multirow{2}{3cm}{62 } & \multirow{2}{5cm}{Tests the 'basic' call: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) psd of the noise, defualt detrending, default window, no averaging} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd with default detrending, default window, no averaging & pass \\ \cline{3-4} + & & 1) Nothing to check & pass \\ \hline + \multirow{2}{3cm}{63 } & \multirow{2}{5cm}{Tests the 'basic' call: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) psd of the noise, defualt detrending, default window, no averaging} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Calculate the statistical parameters +3) Estimate the psd with default detrending, default window, no averaging & pass \\ \cline{3-4} + & & 1) Nothing to check & pass \\ \hline +\caption{Unit tests for ao/psd.} +\label{tab:ao_psd} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/rdivide} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{rule1 (tsdata and tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (fsdata and fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (tsdata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (tsdata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (fsdata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (fsdata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector tsdata and single tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single xydata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector tsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector tsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector fsdata and single fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single xydata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector fsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector fsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector xydata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector xydata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector cdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP tsdata and single tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP tsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP tsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP fsdata and single fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP fsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP fsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP xydata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP xydata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP cdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP tsdata and NxQ tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP tsdata and NxQ xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP tsdata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP fsdata and NxQ fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP fsdata and NxQ xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP fsdata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP xydata and NxQ xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP xydata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP cdata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rdivide } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{tests (fsdata and tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (tsdata and fsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (AO no data and tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (tsdata and AO no data)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (different fs in tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (different x values in fsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (negative test)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (negative test)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline +\caption{Unit tests for ao/rdivide.} +\label{tab:ao_rdivide} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/real} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the real method works with a vector of AOs as input.} & Test that the real method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the real method works with a matrix of AOs as input.} & Test that the real method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the real method works with a list of AOs as input.} & Test that the real method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the real method works with a mix of different shaped AOs as +input.} & Test that the real method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the real method properly applies history.} & Test that the result of applying the real method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'real'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the real method can modify the input AO.} & Test that the real method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is real(at1). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the real method can modify the single axis controlled by the +plist and the resuld can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the real method applies to the x-axis +2) Check that the real method applies to the y-axis +3) Check that the real method applies to both axes +4) Check that the re-built objects are the same object as 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the real method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the real method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/real] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/real.} +\label{tab:ao_real} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/rebuild} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the rebuild method works with a vector of AO objects as input.} & Test that the rebuild method works for a vector of AO objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the rebuild method works with a matrix of AO objects as input.} & Test that the rebuild method works for a matrix of AO objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the rebuild method works with a list of AO objects as input.} & Test that the rebuild method works for a list of AO objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the rebuild method works with a mix of different shaped AO objects +as input.} & Test that the rebuild method works with an input of matrices and vectors +and single AO objects. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the rebuild method properly applies history.} & The method rebuild doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Check that the rebuild method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/rebuild] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/rebuild.} +\label{tab:ao_rebuild} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/resample} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the resample method works with a vector of AOs as input.} & Test that the resample method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the resample method works with a matrix of AOs as input.} & Test that the resample method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the resample method works with a list of AOs as input.} & Test that the resample method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the resample method works with a mix of different shaped AOs as +input.} & Test that the resample method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the resample method properly applies history.} & Test that the result of applying the resample method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'resample'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the resample method can modify the input AO.} & Test that the resample method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is resample(at1). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the resample method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the resample method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/resample] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/resample.} +\label{tab:ao_resample} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/rms} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the rms method works with a vector of AOs as input.} & Test that the rms method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the rms method works with a matrix of AOs as input.} & Test that the rms method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the rms method works with a list of AOs as input.} & Test that the rms method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the rms method works with a mix of different shaped AOs as +input.} & Test that the rms method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the rms method properly applies history.} & Test that the result of applying the rms method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'rms'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the rms method can modify the input AO.} & Test that the rms method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is rms(at1). +3) Check the algorithm & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the rms method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the rms method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/rms] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/rms.} +\label{tab:ao_rms} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/round} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/round] method works with a vector of objects as input.} & Test that the [ao/round] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/round] method works with a matrix of objects as input.} & Test that the [ao/round] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/round] method works with a list of objects as input.} & Test that the [ao/round] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/round] method works with a mix of different arrays of objects as input.} & Tests that the [ao/round] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/round] method properly applies history.} & Test that the result of applying the [ao/round] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/round]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/round] method can modify the input AO.} & Test that the [ao/round] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/round] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the [ao/round] method uses the plist to get the axis.} & Test that the [ao/round] method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the [ao/round] method applies to the x-axis +2) Check that the [ao/round] method applies to the y-axis +3) Check that the [ao/round] method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/round] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/round] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/round] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/round.} +\label{tab:ao_round} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/sDomainFit} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the sDomainFit method works with a vector of AOs as input.} & Test that the sDomainFit method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'av' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the sDomainFit method works with a matrix of AOs as input.} & Test that the sDomainFit method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'am' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the sDomainFit method works with a list of AOs as input.} & Test that the sDomainFit method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the sDomainFit method works with a mix of different shaped AOs as +input.} & Test that the sDomainFit method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the sDomainFit method properly applies history.} & Test that the result of applying the sDomainFit method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'sDomainFit'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{sDomainFit cannot modify the input AO.} & Test that the sDomainFit method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Nothing to do. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the sDomainFit method pass back the output objects to a +single variable correctly.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Tests that the sDomainFit method return the correct coefficients} & Test that the sDomainFit method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that output contains the correct coefficients. & pass \\ \hline +\caption{Unit tests for ao/sDomainFit.} +\label{tab:ao_sDomainFit} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/save} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the save method works with a vector of AOs as input.} & Test that the save method works for a vector of AOs as input. Test both +formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the same +as in 'atvec' +2) Check that the loaded objects are the same as the saved objects except +the the history because the load-constructor adds one history step. +3) The outputs 'out1' and 'out2' must be the same except the history +properties 'methodInfo', 'plistUsed' and 'proctime'. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the save method works with a matrix of AOs as input.} & Test that the save method works for a matrix of AOs as input. Test both +formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the same +as in 'atmat' +2) Check that the loaded objects are the same as the saved objects except +the the history because the load-constructor adds one history step. +3) The outputs 'out1' and 'out2' must be the same except the history +properties 'methodInfo', 'plistUsed' and 'proctime'. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the save method works with a list of AOs as input.} & Test that the save method works for a list of AOs as input. Test both +formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the same +as in the list +2) Check that the loaded objects are the same as the saved objects except +the the history because the load-constructor adds one history step. +3) The outputs 'out1' and 'out2' must be the same except the history +properties 'methodInfo', 'plistUsed' and 'proctime'. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the save method works with a mix of different shaped AOs as +input.} & Test that the save method works with an input of matrices and vectors +and single AOs. Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the save method properly applies history.} & Test that the result of applying the save method can be processed back +to an m-file. Do this for both extensions 'mat' and 'xml' & pass \\ \cline{3-4} + & & 1) Check that save doesn't add a history step. +2) Check that the read object is the same as the stored object. +save + load doesn't add history. +3) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the save method works with the modify command.} & Test that the modify command. & pass \\ \cline{3-4} + & & 1) Check that the save method applies the history. +2) Check the output against the input except the history. +3) Check the history of the output against the input. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the save method uses the filename which is stored in a plist. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the save method with an AO with complex data.} & Save an AO with complex fsdata object. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Test the save method with an AO which is created from a pole/zero model} & Save an AO which is created from a pzmodel. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Test the save method with a complex plist which builds the AO} & Save an AO which is created from a complex plist. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline +\caption{Unit tests for ao/save.} +\label{tab:ao_save} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/scale} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/scale] method works with a vector of objects as input.} & Test that the [ao/scale] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/scale] method works with a matrix of objects as input.} & Test that the [ao/scale] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/scale] method works with a list of objects as input.} & Test that the [ao/scale] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/scale] method works with a mix of different arrays of objects as input.} & Tests that the [ao/scale] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/scale] method properly applies history.} & Test that the result of applying the [ao/scale] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/scale]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/scale] method can modify the input AO.} & Test that the [ao/scale] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/scale] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/scale] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/scale] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/scale] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/scale.} +\label{tab:ao_scale} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/search} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the search method works with a vector of AOs as input.} & Test that the search method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' are the same as in 'atvec' +2) Check that the number of elements in 'out2' +3) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the search method works with a matrix of AOs as input.} & Test that the search method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' are the same as in 'atmat' +2) Check that the number of elements in 'out2' +3) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the search method works with a list of AOs as input.} & Test that the search method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' are the same as the input +2) Check that the number of elements in 'out2' +3) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the search method works with a mix of different shaped AOs as +input.} & Test that the search method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' are the same as the input +2) Check that the number of elements in 'out2' +3) Check that 'out3' doesn't contain an AO +4) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the search method properly applies history.} & Test that the result of applying the search method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'search'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the modifier call for the search method doesn't work.} & Tests that the modifier call for the search method doesn't work. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Check that the search method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for ao/search.} +\label{tab:ao_search} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/select} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the select method works with a vector of AOs as input.} & Test that the select method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the select method works with a matrix of AOs as input.} & Test that the select method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the select method works with a list of AOs as input.} & Test that the select method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the select method works with a mix of different shaped AOs +as input.} & Test that the select method works with an input of matrices and +vectors and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the select method properly applies history.} & Test that the result of applying the select method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'select'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the select method can modify the input AO.} & Test that the select method can modify the input AO by calling with +no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the selected value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the select method keeps the data shape of the input object. +The input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the select method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single +output variable. Additionaly check that the rebuild method works on +the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Test that the select method uses the plist to select the samples.} & Test that the select method uses the plist to select the samples. & pass \\ \cline{3-4} + & & 1) Check that the select method uses the samples in the plist +2) Check that the select method uses the samples in the plist and input +3) Check that the select method uses the samples in the plist and input +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/select] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Test that the select method also select the 'dx' and 'dy' values.} & Test that the select method also select the 'dx' and 'dy' values. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the re-built object is the same as in 'out'. & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Test that the select method updates the t0.} & Test that the select method updates the t0. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the re-built object is the same as in 'out'. & pass \\ \hline +\caption{Unit tests for ao/select.} +\label{tab:ao_select} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/setDescription} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setDescription method works with a vector of AOs as input.} & Test that the setDescription method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setDescription method works with a matrix of AOs as input.} & Test that the setDescription method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setDescription method works with a list of AOs as input.} & Test that the setDescription method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setDescription method works with a mix of different shaped AOs as +input.} & Test that the setDescription method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setDescription method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setDescription method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setDescription'. +1) Check that the last entry in the history of 'out2' NOT corresponds to +'setDescription'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setDescription method can modify the input AO.} & Test that the setDescription method can modify the input AO by calling with no +output. & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' has the correct description field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setDescription method can set the property with a plist.} & Test that the setDescription method can modify the property 'description' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct description field +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setDescription method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/setDescription] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/setDescription.} +\label{tab:ao_setDescription} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/setFs} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setFs method works with a vector of AOs as input.} & Test that the setFs method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'avec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setFs method works with a matrix of AOs as input.} & Test that the setFs method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'amat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setFs method works with a list of AOs as input.} & Test that the setFs method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setFs method works with a mix of different shaped AOs as +input.} & Test that the setFs method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setFs method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setFs method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setFs'. +1) Check that the last entry in the history of 'out2' NOT corresponds to +'setFs'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setFs method can modify the input AO.} & Test that the setFs method can modify the input AO by calling with no +output. & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' has the correct fs field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setFs method can set the property with a plist.} & Test that the setFs method can modify the property 'fs' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct fs field +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setFs method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/setFs] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/setFs.} +\label{tab:ao_setFs} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/setName} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setName method works with a vector of AOs as input.} & Test that the setName method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setName method works with a matrix of AOs as input.} & Test that the setName method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setName method works with a list of AOs as input.} & Test that the setName method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setName method works with a mix of different shaped AOs as +input.} & Test that the setName method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setName method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setName method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setName'. +1) Check that the last entry in the history of 'out2' NOT corresponds to +'setName'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setName method can modify the input AO.} & Test that the setName method can modify the input AO by calling with no +output. & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' has the correct name field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setName method can set the property with a plist.} & Test that the setName method can modify the property 'name' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct name field +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setName method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/setName] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/setName.} +\label{tab:ao_setName} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/setPlotinfo} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setPlotinfo method works with a vector of AOs as input.} & Test that the setPlotinfo method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setPlotinfo method works with a matrix of AOs as input.} & Test that the setPlotinfo method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setPlotinfo method works with a list of AOs as input.} & Test that the setPlotinfo method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setPlotinfo method works with a mix of different shaped AOs as +input.} & Test that the setPlotinfo method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setPlotinfo method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setPlotinfo method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setPlotinfo'. +1) Check that the last entry in the history of 'out2' NOT corresponds to +'setPlotinfo'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setPlotinfo method can modify the input AO.} & Test that the setPlotinfo method can modify the input AO by calling with no +output. & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' has the correct plotinfo field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setPlotinfo method can set the property with a plist.} & Test that the setPlotinfo method can modify the property 'plotinfo' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct plotinfo field +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setPlotinfo method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for ao/setPlotinfo.} +\label{tab:ao_setPlotinfo} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/setT0} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setT0 method works with a vector of AOs as input.} & Test that the setT0 method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'avec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setT0 method works with a matrix of AOs as input.} & Test that the setT0 method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'amat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setT0 method works with a list of AOs as input.} & Test that the setT0 method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setT0 method works with a mix of different shaped AOs as +input.} & Test that the setT0 method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setT0 method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setT0 method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setT0'. +1) Check that the last entry in the history of 'out2' NOT corresponds to +'setT0'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setT0 method can modify the input AO.} & Test that the setT0 method can modify the input AO by calling with no +output. & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' has the correct t0 field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setT0 method can set the property with a plist.} & Test that the setT0 method can modify the property 't0' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct t0 field +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setT0 method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/setT0] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/setT0.} +\label{tab:ao_setT0} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/setX} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setX method works with a vector of AOs as input.} & Test that the setX method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'avec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setX method works with a matrix of AOs as input.} & Test that the setX method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'amat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setX method works with a list of AOs as input.} & Test that the setX method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setX method works with a mix of different shaped AOs as +input.} & Test that the setX method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setX method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setX method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setX'. +1) Check that the last entry in the history of 'out2' NOT corresponds to +'setX'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setX method can modify the input AO.} & Test that the setX method can modify the input AO by calling with no +output. & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' has the correct 'x' field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setX method can set the property with a plist.} & Test that the setX method can modify the property 'x' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct x field +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests that the setX method keeps the shape of the data.} & Test that the setX method keeps the shape of the data. Independent of the +input & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the setX method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/setX] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/setX.} +\label{tab:ao_setX} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/setXY} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setXY method works with a vector of AOs as input.} & Test that the setXY method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'avec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setXY method works with a matrix of AOs as input.} & Test that the setXY method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'amat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setXY method works with a list of AOs as input.} & Test that the setXY method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setXY method works with a mix of different shaped AOs as +input.} & Test that the setXY method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setXY method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setXY method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setXY'. +1) Check that the last entry in the history of 'out2' NOT corresponds to +'setXY'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setXY method can modify the input AO.} & Test that the setXY method can modify the input AO by calling with no +output. & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' has the correct 'x' and 'y' field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setXY method can set the property with a plist.} & Test that the setXY method can modify the property 'x' and 'y' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct x and y fields +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests that the setXY method keeps the shape of the data.} & Test that the setXY method keeps the shape of the data. Independent of the +input & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the setXY method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/setXY] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/setXY.} +\label{tab:ao_setXY} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/setXunits} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setXunits method works with a vector of AOs as input.} & Test that the setXunits method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'avec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setXunits method works with a matrix of AOs as input.} & Test that the setXunits method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'amat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setXunits method works with a list of AOs as input.} & Test that the setXunits method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setXunits method works with a mix of different shaped AOs as +input.} & Test that the setXunits method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setXunits method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setXunits method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setXunits'. +1) Check that the last entry in the history of 'out2' NOT corresponds to +'setXunits'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setXunits method can modify the input AO.} & Test that the setXunits method can modify the input AO by calling with no +output. & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' has the correct xunits field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setXunits method can set the property with a plist.} & Test that the setXunits method can modify the property 'xunits' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct xunits field +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setXunits method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/setXunits] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/setXunits.} +\label{tab:ao_setXunits} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/setY} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setY method works with a vector of AOs as input.} & Test that the setY method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setY method works with a matrix of AOs as input.} & Test that the setY method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setY method works with a list of AOs as input.} & Test that the setY method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setY method works with a mix of different shaped AOs as +input.} & Test that the setY method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setY method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setY method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setY'. +1) Check that the last entry in the history of 'out2' NOT corresponds to +'setY'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setY method can modify the input AO.} & Test that the setY method can modify the input AO by calling with no +output. & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' has the correct 'y' field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setY method can set the property with a plist.} & Test that the setY method can modify the property 'y' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct y field +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests that the setY method keeps the shape of the data.} & Test that the setY method keeps the shape of the data. Independent of the +input & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the setY method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/setY] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/setY.} +\label{tab:ao_setY} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/setYunits} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setYunits method works with a vector of AOs as input.} & Test that the setYunits method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setYunits method works with a matrix of AOs as input.} & Test that the setYunits method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setYunits method works with a list of AOs as input.} & Test that the setYunits method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setYunits method works with a mix of different shaped AOs as +input.} & Test that the setYunits method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setYunits method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setYunits method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setYunits'. +1) Check that the last entry in the history of 'out2' NOT corresponds to +'setYunits'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setYunits method can modify the input AO.} & Test that the setYunits method can modify the input AO by calling with no +output. & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' has the correct yunits field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setYunits method can set the property with a plist.} & Test that the setYunits method can modify the property 'yunits' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct yunits field +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setYunits method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/setYunits] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/setYunits.} +\label{tab:ao_setYunits} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/sign} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/sign] method works with a vector of objects as input.} & Test that the [ao/sign] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/sign] method works with a matrix of objects as input.} & Test that the [ao/sign] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/sign] method works with a list of objects as input.} & Test that the [ao/sign] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/sign] method works with a mix of different arrays of objects as input.} & Tests that the [ao/sign] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/sign] method properly applies history.} & Test that the result of applying the [ao/sign] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/sign]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/sign] method can modify the input AO.} & Test that the [ao/sign] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/sign] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/sign] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/sign] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/sign] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/sign.} +\label{tab:ao_sign} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/simplifyYunits} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the simplifyYunits method works with a vector of AOs as +input.} & Test that the simplifyYunits method works for a vector of AOs as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the simplifyYunits method works with a matrix of AOs as +input.} & Test that the simplifyYunits method works for a matrix of AOs as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the simplifyYunits method works with a list of AOs as input.} & Test that the simplifyYunits method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the simplifyYunits method works with a mix of different +shaped AOs as input.} & Test that the simplifyYunits method works with an input of matrices +and vectors and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the simplifyYunits method properly applies history.} & Test that the result of applying the simplifyYunits method can be +processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'simplifyYunits'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the simplifyYunits method can modify the input AO.} & Test that the simplifyYunits method can modify the input AO by +calling with no output and that the method doesn't change the input +of the function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input simplifies the y-units of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Check that the simplifyYunits method pass back the output objects to a +list of output variables or to a single variable.} & Call the method with a list of output variables and with a single +output variable. Additionaly check that the rebuild method works on +the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test that the simplifyYunits works for different complex y-units.} & Test that the simplifyYunits works for different complex y-units. & pass \\ \cline{3-4} + & & 1) Check that the correct data +2) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Test that the simplifyYunits works with a exception list.} & Test that the simplifyYunits works with a exception list. & pass \\ \cline{3-4} + & & 1) Check that the correct data +2) Check that the re-built object is the same as in 'out[1..2]'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/simplifyYunits] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Test that the simplifyYunits doesn't apply the prefixes to the data.} & Test that the simplifyYunits doesn't apply the prefixes to the data. & pass \\ \cline{3-4} + & & 1) Check that the correct data +2) Check that the re-built object is the same as in 'out[1..2]'. & pass \\ \hline +\caption{Unit tests for ao/simplifyYunits.} +\label{tab:ao_simplifyYunits} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/sin} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/sin] method works with a vector of objects as input.} & Test that the [ao/sin] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/sin] method works with a matrix of objects as input.} & Test that the [ao/sin] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/sin] method works with a list of objects as input.} & Test that the [ao/sin] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/sin] method works with a mix of different arrays of objects as input.} & Tests that the [ao/sin] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/sin] method properly applies history.} & Test that the result of applying the [ao/sin] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/sin]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/sin] method can modify the input AO.} & Test that the [ao/sin] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/sin] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the [ao/sin] method uses the plist to get the axis.} & Test that the [ao/sin] method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the [ao/sin] method applies to the x-axis +2) Check that the [ao/sin] method applies to the y-axis +3) Check that the [ao/sin] method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/sin] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/sin] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/sin] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/sin.} +\label{tab:ao_sin} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/smoother} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the smoother method works with a vector of AOs as input.} & Test that the smoother method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the smoother method works with a matrix of AOs as input.} & Test that the smoother method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the smoother method works with a list of AOs as input.} & Test that the smoother method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the smoother method works with a mix of different shaped AOs as +input.} & Test that the smoother method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the smoother method properly applies history.} & Test that the result of applying the smoother method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'smoother'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the smoother method can modify the input AO.} & Test that the smoother method can modify the input AO by calling +with no output. & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is smoother(at5). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the smoother method keeps the data shape of the input object.} & Test that the smoother method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the smoother method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/smoother] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/smoother.} +\label{tab:ao_smoother} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/sort} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the sort method works with a vector of AOs as input.} & Test that the sort method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the sort method works with a matrix of AOs as input.} & Test that the sort method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the sort method works with a list of AOs as input.} & Test that the sort method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the sort method works with a mix of different shaped AOs as +input.} & Test that the sort method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the sort method properly applies history.} & Test that the result of applying the sort method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'sort'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the sort method can modify the input AO.} & Test that the sort method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the sort value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the sort method keeps the data shape of the input object. +The input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the sort method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single +output variable. Additionaly check that the rebuild method works on +the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Test that the sort method uses the plist to sort on the x- or y- axis} & Test that the sort method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the sort method applies to the y-axis in ascend direction +2) Check that the sort method applies to the y-axis in descend direction +3) Check that the sort method applies to the x-axis in ascend direction +4) Check that the sort method applies to the x-axis in descend direction +5) Check that the re-built object is the same as in 'out[1..4]'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/sort] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/sort.} +\label{tab:ao_sort} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/spectrogram} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the spectrogram method works with a vector of AOs as input.} & Test that the spectrogram method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the spectrogram method works with a matrix of AOs as input.} & Test that the spectrogram method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the spectrogram method works with a list of AOs as input.} & Test that the spectrogram method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the spectrogram method works with a mix of different shaped AOs as +input.} & Test that the spectrogram method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the spectrogram method properly applies history.} & Test that the result of applying the spectrogram method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'spectrogram'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/spectrogram] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/spectrogram.} +\label{tab:ao_spectrogram} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf split/chunks} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the split method works with a vector of AOs as input.} & Test that the split method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of outputs +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the split method works with a matrix of AOs as input.} & Tests that the split method works with a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of outputs +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the split method works with a list of AOs as input.} & Tests that the split method works with a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of outputs +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the split method works with a mix of different shaped AOs as +input.} & Tests that the split method works with a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of outputs +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the split method properly applies history.} & Test that the result of applying the split method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'split'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{The split method can not modify the input AO.} & The split method can not modify the input AO. & pass \\ \cline{3-4} + & & 1) Nothind to do. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the split method keeps the data shape of the input object. +The input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the split method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single +output variable. Additionaly check that the rebuild method works on +the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the split method accepts both key-words 'N' and 'chunks'.} & Check that the split method accepts both key-words 'N' and 'chunks'. & pass \\ \cline{3-4} + & & 1) Check that the number of outputs +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [split/chunks] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Tests that the split method works also split 'dx' and 'dy'.} & Tests that the split method works also split 'dx' and 'dy'. & pass \\ \cline{3-4} + & & 1) Check that the number of outputs +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Check that the split method ignores the samples which doesn't fit.} & Check that the split method ignores the samples which doesn't fit. +Use for this test the key-word 'match' & pass \\ \cline{3-4} + & & 1) Check that the number of outputs +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{15 } & \multirow{2}{5cm}{Check that the split method works with notequal sampled data. +Check that the split method works with 'timeshift' option.} & Check that the split method works with notequal sampled data. +Check that the split method works with 'timeshift' option. & pass \\ \cline{3-4} + & & 1) Check the outputs +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for split/chunks.} +\label{tab:split_chunks} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf split/interval} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the split method works with a vector of AOs as input.} & Test that the split method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +'avec' times numbers of intervals +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the split method works with a matrix of AOs as input.} & Tests that the split method works with a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +'amat' times numbers of intervals +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the split method works with a list of AOs as input.} & Tests that the split method works with a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +'amat' times numbers of intervals +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the split method works with a mix of different shaped AOs as +input.} & Tests that the split method works with a mix of different shaped AOs as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +'amat' times numbers of intervals +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the split method properly applies history.} & Test that the result of applying the split method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'split'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{The split method can not modify the input AO.} & The split method can not modify the input AO. & pass \\ \cline{3-4} + & & 1) Nothind to do. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the split method keeps the data shape of the input object. +The input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the split method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single +output variable. Additionaly check that the rebuild method works on +the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the split method can handle AO which have a collaped x-axis.} & Check that the split method can handle AO which have a collaped x-axis. & pass \\ \cline{3-4} + & & 1) Check the number of outputs +2) Check the output +3) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [split/interval] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Check that the split method uses the key-words: start\_time and duration} & Check that the split method uses the key-words: start\_time and +duration & pass \\ \cline{3-4} + & & 1) Check the number of outputs +2) Check the output +3) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Check that the split method uses the key-words: timespan} & Check that the split method uses the key-words: timespan & pass \\ \cline{3-4} + & & 1) Check the number of outputs +2) Check the output +3) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{14 } & \multirow{2}{5cm}{Check that the split method uses the key-words: start\_time and end\_time} & Check that the split method uses the key-words: start\_time and end\_time & pass \\ \cline{3-4} + & & 1) Check the number of outputs +2) Check the output +3) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{15 } & \multirow{2}{5cm}{Check that the split method works with notequal sampled data. +Check that the split method works with 'timeshift' option. +Check that the interval can be passed via two time objects.} & Check that the split method works with notequal sampled data. +Check that the split method works with 'timeshift' option. +Check that the interval can be passed via two time objects. & pass \\ \cline{3-4} + & & 1) Check the outputs +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{16 } & \multirow{2}{5cm}{Check that the split method works with notequal sampled data. +Check that the split method works with 'timeshift' option. +Check that the interval can be passed via two time strings.} & Check that the split method works with notequal sampled data. +Check that the split method works with 'timeshift' option. +Check that the interval can be passed via two time strings. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{17 } & \multirow{2}{5cm}{Check that the split method works with notequal sampled data. +Check that the split method works with 'timeshift' option. +Check that the interval can be passed via one timespan object.} & Check that the split method works with notequal sampled data. +Check that the split method works with 'timeshift' option. +Check that the interval can be passed via one timespan object. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{18 } & \multirow{2}{5cm}{Check that the split method works with notequal sampled data. +Check that the split method works with 'timeshift' option. +Check that the interval can be passed via one timespan object.} & Check that the split method works with notequal sampled data. +Check that the split method works with 'timeshift' option. +Check that the interval can be passed via one timespan object. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for split/interval.} +\label{tab:split_interval} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf split/samples} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the split method works with a vector of AOs as input.} & Test that the split method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +'atvec' times numbers of intervals +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the split method works with a matrix of AOs as input.} & Tests that the split method works with a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +'atmat' times numbers of intervals +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the split method works with a list of AOs as input.} & Tests that the split method works with a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +'atvec' times numbers of intervals +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the split method works with a mix of different shaped AOs as +input.} & Tests that the split method works with a mix of different shaped AOs as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +'atvec' times numbers of intervals +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the split method properly applies history.} & Test that the result of applying the split method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'split'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{The split method can not modify the input AO.} & The split method can not modify the input AO. & pass \\ \cline{3-4} + & & 1) Nothind to do. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the split method keeps the data shape of the input object. +The input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the split method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single +output variable. Additionaly check that the rebuild method works on +the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Test that the split method also splits the 'dx' and 'dy' values.} & Test that the split method also splits the 'dx' and 'dy' values. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the re-built object is the same as in 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [split/samples] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{15 } & \multirow{2}{5cm}{Check that the split method works with notequal sampled data. +Check that the split method works with 'timeshift' option.} & Check that the split method works with notequal sampled data. +Check that the split method works with 'timeshift' option. & pass \\ \cline{3-4} + & & 1) Check the outputs +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for split/samples.} +\label{tab:split_samples} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf times/frequ} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the split method works with a vector of AOs as input.} & Test that the split method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +'atvec' times numbers of intervals +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the split method works with a matrix of AOs as input.} & Tests that the split method works with a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +'atvec' times numbers of intervals +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the split method works with a list of AOs as input.} & Tests that the split method works with a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +'atvec' times numbers of intervals +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the split method works with a mix of different shaped AOs as +input.} & Tests that the split method works with a mix of different shaped AOs as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +'atvec' times numbers of intervals +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the split method properly applies history.} & Test that the result of applying the split method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'split'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{The split method can not modify the input AO.} & The split method can not modify the input AO. & pass \\ \cline{3-4} + & & 1) Nothind to do. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the split method keeps the data shape of the input object. +The input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the split method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single +output variable. Additionaly check that the rebuild method works on +the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the split method interprets a negative end interval as a +indicates count from end and a zero for the and interval as the end of +the vector.} & Check this behavior for time-series data. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [times/frequ] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Check that the split method works with notequal sampled data.} & Check that the split method works with notequal sampled data. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Check that the split method also split 'dx' and 'dy'.} & Check that the split method also split 'dx' and 'dy' if this values +have the same length of the y-values. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{14 } & \multirow{2}{5cm}{Check that the split method interprets a negative end interval as a +indicates count from end and a zero for the and interval as the end of +the vector.} & Check this behavior for frequency-series data. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. +3) Check that the output have the same 'fs', 'enbw', 'navs', 'xunits' +and 'yunits' & pass \\ \hline + \multirow{2}{3cm}{15 } & \multirow{2}{5cm}{Check that the split method works with notequal sampled data. +Check that the interval can be passed via an array of double. +Check that the split method works with 'timeshift' option.} & Check that the split method works with notequal sampled data. +Check that the interval can be passed via an array of double. +Check that the split method works with 'timeshift' option. & pass \\ \cline{3-4} + & & 1) Check the outputs +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{16 } & \multirow{2}{5cm}{Check that the split method works with time intervals which doesn' +match the sample frequency.} & Check that the split method works with time intervals which doesn' +match the sample frequency. & pass \\ \cline{3-4} + & & 1) Check the outputs +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for times/frequ.} +\label{tab:times_frequ} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/sqrt} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/sqrt] method works with a vector of objects as input.} & Test that the [ao/sqrt] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/sqrt] method works with a matrix of objects as input.} & Test that the [ao/sqrt] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/sqrt] method works with a list of objects as input.} & Test that the [ao/sqrt] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/sqrt] method works with a mix of different arrays of objects as input.} & Tests that the [ao/sqrt] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/sqrt] method properly applies history.} & Test that the result of applying the [ao/sqrt] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/sqrt]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/sqrt] method can modify the input AO.} & Test that the [ao/sqrt] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/sqrt] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the [ao/sqrt] method uses the plist to get the axis.} & Test that the [ao/sqrt] method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the [ao/sqrt] method applies to the x-axis +2) Check that the [ao/sqrt] method applies to the y-axis +3) Check that the [ao/sqrt] method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/sqrt] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/sqrt] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/sqrt] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/sqrt.} +\label{tab:ao_sqrt} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/std} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/std] method works with a vector of objects as input.} & Test that the [ao/std] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/std] method works with a matrix of objects as input.} & Test that the [ao/std] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/std] method works with a list of objects as input.} & Test that the [ao/std] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/std] method works with a mix of different arrays of objects as input.} & Tests that the [ao/std] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/std] method properly applies history.} & Test that the result of applying the [ao/std] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/std]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/std] method can modify the input AO.} & Test that the [ao/std] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/std] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{108 } & \multirow{2}{5cm}{Test that the [ao/std] method uses the plist to get the axis. This is +intended to test methods like ao/mean and ao/std which return different +data types depending on which axis is selected.} & Test that the [ao/std] method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the [ao/std] method applies to the x-axis +2) Check that the [ao/std] method applies to the y-axis +3) Check that the [ao/std] method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/std] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/std] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/std] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/std.} +\label{tab:ao_std} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/string} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the string method works with a vector of AO objects as input.} & Test that the string method works for a vector of AO objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the string method works with a matrix of AO objects as input.} & Test that the string method works for a matrix of AO objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the string method works with a list of AO objects as input.} & Test that the string method works for a list of AO objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the string method works with a mix of different shaped AO objects +as input.} & Test that the string method works with an input of matrices and vectors +and single AO objects. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the string method properly applies history.} & The method string doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the string method doesn't work if the AO object have more +than one history step.} & The method string throws an error because the input object have more than +one history step. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for ao/string.} +\label{tab:ao_string} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/sum} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/sum] method works with a vector of objects as input.} & Test that the [ao/sum] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/sum] method works with a matrix of objects as input.} & Test that the [ao/sum] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/sum] method works with a list of objects as input.} & Test that the [ao/sum] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/sum] method works with a mix of different arrays of objects as input.} & Tests that the [ao/sum] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/sum] method properly applies history.} & Test that the result of applying the [ao/sum] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/sum]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/sum] method can modify the input AO.} & Test that the [ao/sum] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/sum] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{108 } & \multirow{2}{5cm}{Test that the [ao/sum] method uses the plist to get the axis. This is +intended to test methods like ao/mean and ao/std which return different +data types depending on which axis is selected.} & Test that the [ao/sum] method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the [ao/sum] method applies to the x-axis +2) Check that the [ao/sum] method applies to the y-axis +3) Check that the [ao/sum] method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/sum] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/sum] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/sum] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/sum.} +\label{tab:ao_sum} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/sumjoin} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the sumjoin method works with a vector of AOs as input.} & Test that the sumjoin method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one AO +2) Check that the output have the correct data. +3) Check the rebuilt object & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the sumjoin method works with a matrix of AOs as input.} & Tests that the sumjoin method works with a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one AO +2) Check that the output have the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the sumjoin method works with a list of AOs as input.} & Tests that the sumjoin method works with a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one AO +2) Check that the output have the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the sumjoin method works with a mix of different shaped AOs as +input.} & Tests that the sumjoin method works with a mix of different shaped AOs as +input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one AO +2) Check that the output have the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the sumjoin method properly applies history.} & Test that the result of applying the sumjoin method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'sumjoin'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the sumjoin method can modify the input AO.} & Test that the sumjoin method can modify the input AO by calling with +no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input have the new data +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the sumjoin method keeps the data shape of the input +object. The input AO must be an AO with row data and an AO with +column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline +\caption{Unit tests for ao/sumjoin.} +\label{tab:ao_sumjoin} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/svd} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the svd method works with a vector of AOs as input.} & Test that the svd method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the svd method works with a matrix of AOs as input.} & Test that the svd method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the svd method works with a list of AOs as input.} & Test that the svd method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the svd method works with a mix of different shaped AOs as +input.} & Test that the svd method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the svd method properly applies history.} & Test that the result of applying the svd method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'svd'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the svd method can modify the input AO.} & Test that the svd method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'at4' and 'ain' are now different. +2) Check that 'ain' is svd(at4). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the svd method can modify the single axis controlled by the +plist and the resuld can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the svd method applies with different options. +2) Check that the re-built objects are the same object as 'out[1..2]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the svd method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the svd method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for ao/svd.} +\label{tab:ao_svd} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/t0} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the t0 method works with a vector of AOs as input.} & The t0 method doesn't work with a vector of AOs. Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the t0 method works with a matrix of AOs as input.} & The t0 method doesn't work with a matrix of AOs. Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the t0 method works with a list of AOs as input.} & The t0 method doesn't work with a list of AOs. Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the t0 method works with a mix of different shaped AOs as +input.} & The t0 method can only return the t0 value of one AO. Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the t0 method properly applies history.} & The t0 method doesn't change the AO, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the t0 method works for AOs with different data objects.} & Test that the t0 method returns the t0 value for AOs with cdata, +fsdata, tsdata and xydata objects. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline +\caption{Unit tests for ao/t0.} +\label{tab:ao_t0} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/tan} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/tan] method works with a vector of objects as input.} & Test that the [ao/tan] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/tan] method works with a matrix of objects as input.} & Test that the [ao/tan] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/tan] method works with a list of objects as input.} & Test that the [ao/tan] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/tan] method works with a mix of different arrays of objects as input.} & Tests that the [ao/tan] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/tan] method properly applies history.} & Test that the result of applying the [ao/tan] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/tan]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/tan] method can modify the input AO.} & Test that the [ao/tan] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/tan] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the [ao/tan] method uses the plist to get the axis.} & Test that the [ao/tan] method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the [ao/tan] method applies to the x-axis +2) Check that the [ao/tan] method applies to the y-axis +3) Check that the [ao/tan] method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/tan] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/tan] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/tan] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/tan.} +\label{tab:ao_tan} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/tfe} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the tfe method works with a vector of AOs as input.} & Test that the tfe method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the tfe method doesn't work with a matrix of AOs as input.} & Test that the tfe method doesn't work for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Nothing to check & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the tfe method works with a list of AOs as input.} & Test that the tfe method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the tfe method doesn't work with a mix of different shaped +AOs as input.} & Test that the tfe method doesn't work with an input of matrices and +vectors and single AOs. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the tfe method properly applies history.} & Test that the result of applying the tfe method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'tfe'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the tfe method can not modify the input AO.} & Test that the tfe method can not modify the input AO. +The method must throw an error for the modifier call. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the plus method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the output data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the tfe method pass back the output objects to a list of +output variables or to a single variable.} & This test is not longer necessary because the tfe method pass back +always only one object. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Tests that the tfe method agrees with MATLAB's tfestimate when +configured to use the same parameters.} & Test that applying tfe works on two AOs. & pass \\ \cline{3-4} + & & 1) Check that output agrees with the output of MATLAB's tfestimate. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/tfe] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Tests that differently sized data sets are treated properly} & Test that applying tfe works on two AOs. & pass \\ \cline{3-4} + & & 1) Check that tfe used the length of the shortest ao. & pass \\ \hline + \multirow{2}{3cm}{17 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) tfe of the white noise series +4) compares the units of the input and output} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) tfe of the white noise & pass \\ \cline{3-4} + & & 1) Check that (calculated tfe yunits) equals [1/Hz] & pass \\ \hline + \multirow{2}{3cm}{21 } & \multirow{2}{5cm}{Tests the possibility to set the number of averages rather than setting the Nfft: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) tfe of the 2 series, without detrending, random window, set number of +averages +3) check the effective number of averages} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) tfe of the 2 series, without detrending, random window, set number of +averages & pass \\ \cline{3-4} + & & 1) Check that calculated navs are identical to those requested & pass \\ \hline + \multirow{2}{3cm}{22 } & \multirow{2}{5cm}{Tests the possibility to set the number of averages rather than setting the Nfft: +1) white noise produced from uniform pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) tfe of the time series, without detrending, random window, random navs +3) get the number of averages +4) get the nfft used +5) run tfe again, with the nfft used +6) compare the calculated objects} & 1) white noise produced from uniform pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) tfe of the time series, without detrending, random window, random navs +3) get the number of averages +4) get the nfft used +5) run tfe again, with the nfft used & pass \\ \cline{3-4} + & & 1) Check that calculated objects T1 and T2 are identical & pass \\ \hline + \multirow{2}{3cm}{23 } & \multirow{2}{5cm}{Tests the possibility to set the number of averages rather than setting the Nfft: +1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) tfe of the time series, without detrending, random window, random navs +3) get the number of averages +4) get the nfft used +5) run tfe again, with the nfft used +6) compare navs, nfft, tfes} & 1) white noise produced from normal pdf, with: +a given mean value and sigma (distribution's 1st and 2nd order) +2) tfe of the time series, without detrending, random window, random navs +3) get the number of averages +4) get the nfft used +5) run tfe again, with the nfft used +6) run tfe again, with conflicting parameters, and verify it uses +nfft rather than navs & pass \\ \cline{3-4} + & & 1) Check that calculated objects T1 and T2 are identical +2) Check that T3 used different values & pass \\ \hline + \multirow{2}{3cm}{25 } & \multirow{2}{5cm}{Tests handling of units: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +3) tfe of the white noise series +4) compares the units of the input and output} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +white noise from normal distribution + offset +4) Assign a random unit +5) tfe of the white noise & pass \\ \cline{3-4} + & & 1) Check that (calculated tfe yunits) equals [1/Hz] & pass \\ \hline + \multirow{2}{3cm}{30 } & \multirow{2}{5cm}{Tests handling of special cases: +1) white noise produced from normal pdf, with a given mean value and +sigma (distribution's 1st and 2nd orders) +2) the same noise series +3) tfe of the white noise series +4) compares the output to unity} & 1) Prepare the test tsdata: +white noise from normal distribution + offset +2) Assign a random unit +3) Prepare the test tsdata: +the same data as 1) and 2) +4) tfe of the series & pass \\ \cline{3-4} + & & 1) Check that calculated tfe equals 1 & pass \\ \hline +\caption{Unit tests for ao/tfe.} +\label{tab:ao_tfe} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/times} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{rule1 (tsdata and tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (fsdata and fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (tsdata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (tsdata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (fsdata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (fsdata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (xydata and cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule1 (cdata and xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 1.} & Tests the arithmetic operators rule 1 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule1 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector tsdata and single tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single xydata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector tsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector tsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector fsdata and single fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single xydata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector fsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector fsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector xydata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector xydata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (vector cdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule2 (single cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 2.} & Tests the arithmetic operators rule 2 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule2 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule3 (vector cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 3.} & Tests the arithmetic operators rule 3 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule3 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule4 (vector cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 4.} & Tests the arithmetic operators rule 4 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule4 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP tsdata and single tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP tsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP tsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP fsdata and single fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP fsdata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP fsdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP xydata and single xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP xydata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (NxP cdata and single cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule5 (single cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 5.} & Tests the arithmetic operators rule 5 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule5 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (NxP cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule6 (vector cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 6.} & Tests the arithmetic operators rule 6 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule6 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (NxP cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule7 (vector cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 7.} & Tests the arithmetic operators rule 7 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule7 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP tsdata and vector tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP tsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP tsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP fsdata and vector fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP fsdata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP fsdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP xydata and vector xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP xydata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (NxP cdata and vector cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule8 (vector cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 8.} & Tests the arithmetic operators rule 8 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule8 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP tsdata and NxQ tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP tsdata and NxQ xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP tsdata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP fsdata and NxQ fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP fsdata and NxQ xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP fsdata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP xydata and NxQ xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP xydata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxP cdata and NxQ cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule9 (NxQ cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 9.} & Tests the arithmetic operators rule 9 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule9 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP tsdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP tsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP fsdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP fsdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP xydata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP xydata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{rule10 (NxP cdata and NxP cdata)} & \multirow{2}{5cm}{Tests the arithmetic operators rule 10.} & Tests the arithmetic operators rule 10 for each data type: xydata, +fsdata, tsdata, cdata and useful combinations. & pass \\ \cline{3-4} + & & Here we test element-wise operator rule10 as in S2-AEI-TN-3059. +1) Check the data type of the resulting object. +2) Check the resulting object contains the correct values. +3) Check the error propagation. +4) Check the units of the output object. +5) Check the resulting object can be rebuilt. & pass \\ \hline + \multirow{2}{3cm}{times } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{tests (fsdata and tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (tsdata and fsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (AO no data and tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (tsdata and AO no data)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (different fs in tsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (different x values in fsdata)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (negative test)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline + \multirow{2}{3cm}{tests (negative test)} & \multirow{2}{5cm}{Tests all arithmetic operations which are not allowed.} & Tests all arithmetic operations which are not allowed. & pass \\ \cline{3-4} + & & Here we test some negative cases. & pass \\ \hline +\caption{Unit tests for ao/times.} +\label{tab:ao_times} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/timeshift} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the timeshift method works with a vector of AOs as input.} & Test that the timeshift method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the timeshift method works with a matrix of AOs as input.} & Test that the timeshift method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the timeshift method works with a list of AOs as input.} & Test that the timeshift method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the timeshift method works with a mix of different shaped AOs as +input.} & Test that the timeshift method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the timeshift method properly applies history.} & Test that the result of applying the timeshift method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'timeshift'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the timeshift method can modify the input AO.} & Test that the timeshift method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is timeshift(at1). +3) Check the algorithm & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the timeshift method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the timeshift method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/timeshift] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/timeshift.} +\label{tab:ao_timeshift} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/transpose} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/transpose] method works with a vector of objects as input.} & Test that the [ao/transpose] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/transpose] method works with a matrix of objects as input.} & Test that the [ao/transpose] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/transpose] method works with a list of objects as input.} & Test that the [ao/transpose] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/transpose] method works with a mix of different arrays of objects as input.} & Tests that the [ao/transpose] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/transpose] method properly applies history.} & Test that the result of applying the [ao/transpose] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/transpose]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the transpose method can modify the input AO.} & Test that the transpose method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is transpose(at1). & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the abs method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/transpose] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/transpose] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/transpose.} +\label{tab:ao_transpose} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/type} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the type method works with a vector of AO objects as input.} & Test that the type method works for a vector of AO objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the type method works with a matrix of AO objects as input.} & Test that the type method works for a matrix of AO objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the type method works with a list of AO objects as input.} & Test that the type method works for a list of AO objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the type method works with a mix of different shaped AO objects +as input.} & Test that the type method works with an input of matrices and vectors +and single AO objects. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the type method properly applies history.} & The method type doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for ao/type.} +\label{tab:ao_type} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/uminus} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/uminus] method works with a vector of objects as input.} & Test that the [ao/uminus] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/uminus] method works with a matrix of objects as input.} & Test that the [ao/uminus] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/uminus] method works with a list of objects as input.} & Test that the [ao/uminus] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/uminus] method works with a mix of different arrays of objects as input.} & Tests that the [ao/uminus] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/uminus] method properly applies history.} & Test that the result of applying the [ao/uminus] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/uminus]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/uminus] method can modify the input AO.} & Test that the [ao/uminus] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/uminus] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the [ao/uminus] method uses the plist to get the axis.} & Test that the [ao/uminus] method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the [ao/uminus] method applies to the x-axis +2) Check that the [ao/uminus] method applies to the y-axis +3) Check that the [ao/uminus] method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/uminus] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/uminus] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/uminus] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/uminus.} +\label{tab:ao_uminus} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/unwrap} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the unwrap method works with a vector of AOs as input.} & Test that the unwrap method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'avec' +2) Check that each ouput corrects the phase angles & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the unwrap method works with a matrix of AOs as input.} & Tests that the unwrap method works with a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'amat' +2) Check that each ouput corrects the phase angles & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the unwrap method works with a list of AOs as input.} & Tests that the unwrap method works with a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in the +input +2) Check that each ouput corrects the phase angles & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the unwrap method works with a mix of different shaped AOs +as input.} & Tests that the unwrap method works with a mix of different shaped AOs +as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in the +input +2) Check that each ouput corrects the phase angles & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the unwrap method properly applies history.} & Test that the result of applying the unwrap method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'unwrap'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the unwrap method can modify the input AO.} & Test that the unwrap method can modify the input AO by calling with +no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the unwraped value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the unwrap method uses the plist to get the axis.} & Test that the unwrap method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the unwrap method applies to the x-axis +2) Check that the unwrap method applies to the y-axis +3) Check that the unwrap method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the unwrap method keeps the data shape of the input object. +The input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the unwrap method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/unwrap] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/unwrap.} +\label{tab:ao_unwrap} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/upsample} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the upsample method works with a vector of AOs as input.} & Test that the upsample method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the upsample method works with a matrix of AOs as input.} & Test that the upsample method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the upsample method works with a list of AOs as input.} & Test that the upsample method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the upsample method works with a mix of different shaped AOs as +input.} & Test that the upsample method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the upsample method properly applies history.} & Test that the result of applying the upsample method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'upsample'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the upsample method can modify the input AO.} & Test that the upsample method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is upsample(at1). +3) Check the algorithm & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the upsample method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the upsample method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/upsample] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/upsample.} +\label{tab:ao_upsample} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/var} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ao/var] method works with a vector of objects as input.} & Test that the [ao/var] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ao/var] method works with a matrix of objects as input.} & Test that the [ao/var] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ao/var] method works with a list of objects as input.} & Test that the [ao/var] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ao/var] method works with a mix of different arrays of objects as input.} & Tests that the [ao/var] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ao/var] method properly applies history.} & Test that the result of applying the [ao/var] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ao/var]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the [ao/var] method can modify the input AO.} & Test that the [ao/var] method can modify the input object by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the [ao/var] value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{108 } & \multirow{2}{5cm}{Test that the [ao/var] method uses the plist to get the axis. This is +intended to test methods like ao/mean and ao/std which return different +data types depending on which axis is selected.} & Test that the [ao/var] method uses the plist to get the axis. & pass \\ \cline{3-4} + & & 1) Check that the [ao/var] method applies to the x-axis +2) Check that the [ao/var] method applies to the y-axis +3) Check that the [ao/var] method applies to both axes +4) Check that the re-built object is the same as in 'out[1..3]'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the shape of the data in AOs.} & Test that the [ao/var] method keeps the data shape of the input object. The +input AO data must be an array with row data and/or column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the [ao/var] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/var] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/var.} +\label{tab:ao_var} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/whiten1D} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the whiten1D method works with a vector of AOs as input.} & Test that the whiten1D method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atvec' +2) Check that each output AO contains the correct data. +3) Check that each output AO contains empty yunits & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the whiten1D method works with a matrix of AOs as input.} & Test that the whiten1D method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. +3) Check that each output AO contains empty yunits & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the whiten1D method works with a list of AOs as input.} & Test that the whiten1D method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. +3) Check that each output AO contains empty yunits & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the whiten1D method works with a mix of different shaped AOs as +input.} & Test that the whiten1D method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. +3) Check that each output AO contains empty yunits & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the whiten1D method properly applies history.} & Test that the result of applying the whiten1D method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'whiten1D'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the whiten1D method can modify the input AO.} & Test that the whiten1D method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is whiten1D(at1). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the whiten1D method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. +2) Check that the output AOs have empty yunits & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the whiten1D method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the whiten1D method is capable to increase spectral flatness +in case of no model input} & Generate a fixed series of noise data, apply a filter to colour data +and run the method with a certain number of parameters. & pass \\ \cline{3-4} + & & 1) Check that the output spectrum is flatter than input colored +spectrum +2) Check that the output AOs have empty yunits & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the whiten1D method is capable to increase spectral flatness +when a model is input} & Generate a fixed series of noise data, apply a filter to colour data +and run the method with a certain number of parameters. & pass \\ \cline{3-4} + & & 1) Check that the output spectrum is flatter than input colored +spectrum & pass \\ \hline +\caption{Unit tests for ao/whiten1D.} +\label{tab:ao_whiten1D} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/whiten2D} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the whiten2D method works with a vector of AOs as input.} & Test that the whiten2D method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'acv2' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the whiten2D method works with a matrix of AOs as input.} & Test that the whiten2D method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'atmat' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the whiten2D method works with a list of AOs as input.} & Test that the whiten2D method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the whiten2D method works with a mix of different shaped AOs as +input.} & Test that the whiten1D method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the whiten2D method properly applies history.} & Test that the result of applying the whiten2D method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'whiten2D'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the whiten2D method can modify the input AO.} & Test that the whiten2D method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Nothing to do. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the whiten2D method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the noisegen2D method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for ao/whiten2D.} +\label{tab:ao_whiten2D} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/x} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the x method works with a vector of AOs as input.} & The x method doesn't work with a vector of AOs. Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the x method works with a matrix of AOs as input.} & The x method doesn't work with a matrix of AOs. Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the x method works with a list of AOs as input.} & The x method doesn't work with a list of AOs. Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the x method works with a mix of different shaped AOs as +input.} & The x method can only return the x values of one AO. Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the x method properly applies history.} & The x method doesn't change the AO, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the x method works for AOs with different data objects.} & Test that the x method returns the x values for AOs with cdata, fsdata, +tsdata and xydata objects. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the x method returns the x values of the data object} & Test that the x method returns the x values in a column vector independent +form the shape of the values in the data object. & pass \\ \cline{3-4} + & & 1) Check that 'x1' and 'x2' are column vectors. & pass \\ \hline +\caption{Unit tests for ao/x.} +\label{tab:ao_x} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/xcorr} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the xcorr method works with a vector with 2 AOs as input.} & Test that the xcorr method works for a vector with 2 AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the numbers of outputs is 1 +2) Check that the output AO contains the correct data. +3) Check that the units are properly handled & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the xcorr method does not work with a matrix of AOs as input.} & Tests that the xcorr method does not work with a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Nothing to check & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the xcorr method works with a list of 2 AOs as input.} & Tests that the xcorr method works with a list of 2 AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the numbers of outputs is 1 +2) Check that the output AO contains the correct data. +3) Check that the units are properly handled & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the xcorr method does not work with a mix of different shaped AOs +as input.} & Tests that the xcorr method does not work with a mix of different shaped AOs +as input. & pass \\ \cline{3-4} + & & 1) Nothing to check & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the xcorr method properly applies history.} & Test that the result of applying the xcorr method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'xcorr'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the xcorr method keeps the data shape of the input object. +In this case the first AO defines the data shape. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Check that the xcorr method pass back the output objects to a list of +output variables or to a single variable. +Does not make sense anymore, given the structure double input -> single output} & Call the method with a list of output variables and with a single output +variable. +Additionaly check that the rebuild method works on the output. +Additionaly check that the units are handled properly. +Additionaly check that the symmetry is preserved. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. +3) Check that the units are handled properly. +4) Check that the symmetry is preserved. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the xcorr method re-sample all input AOs to the highest +frequency.} & Check that the xcorr method re-sample all input AOs to the highest +frequency. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the first AO is resampled to '200' +3) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the xcorr method truncate all input AOs to the same length.} & Check that the xcorr method truncate all input AOs to the same length. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the second AO is truncated to 10 seconds +3) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/xcorr] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Check that the xcorr uses different lag ranges [-maxlags:maxlags] +Check that the xcorr accepts different scales options +Check that the xcorr handles units properly} & 1) Check that the xcorr uses different lag ranges [-maxlags:maxlags] +2) Check that the xcorr accepts different scales options & pass \\ \cline{3-4} + & & 1) Check that the output have the range [-maxlags:maxlags] +2) Check that the output have correct units & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Check that the xcorr uses different lag ranges [-maxlags:maxlags]} & Check that the xcorr uses different lag ranges [-maxlags:maxlags] & pass \\ \cline{3-4} + & & 1) Check that the output have the range [-maxlags:maxlags] & pass \\ \hline +\caption{Unit tests for ao/xcorr.} +\label{tab:ao_xcorr} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/xunits} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the xunits method works with a vector of AOs as input.} & Tests that the xunits method works with a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in the input. +2) Check that each output unit object contains the correct values. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the xunits method works with a matrix of AOs as input.} & Tests that the xunits method works with a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in the input. +2) Check that each output unit object contains the correct values. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the xunits method works with a list of AOs as input.} & Tests that the xunits method works with a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in the input. +2) Check that each output unit object contains the correct values. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the xunits method works with a mix of different shaped AOs as +input.} & Tests that the xunits method works with a mix of different shaped AOs as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in the input. +2) Check that each output unit object contains the correct values. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the xunits method properly applies history.} & The xunits method doesn't change the AO, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the xunits method works for AOs with different data objects.} & Test that the xunits method returns the xunits values for AOs with fsdata, +tsdata and xydata objects, and empty units for AOs with cdata. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline +\caption{Unit tests for ao/xunits.} +\label{tab:ao_xunits} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/y} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the y method works with a vector of AOs as input.} & The y method doesn't work with a vector of AOs. Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the y method works with a matrix of AOs as input.} & The y method doesn't work with a matrix of AOs. Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the y method works with a list of AOs as input.} & The y method doesn't work with a list of AOs. Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the y method works with a mix of different shaped AOs as +input.} & The y method can only return the y values of one AO. Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the y method properly applies history.} & The y method doesn't change the AO, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the y method works for AOs with different data objects.} & Test that the y method returns the y values for AOs with cdata, fsdata, +tsdata and xydata objects. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the y method returns the y values of the data object} & Test that the y method returns the y values in a column vector independent +form the shape of the values in the data object. & pass \\ \cline{3-4} + & & 1) Check that 'y1' and 'y2' are column vectors. & pass \\ \hline +\caption{Unit tests for ao/y.} +\label{tab:ao_y} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/yunits} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the yunits method works with a vector of AOs as input.} & Tests that the yunits method works with a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in the input. +2) Check that each output unit object contains the correct values. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the yunits method works with a matrix of AOs as input.} & Tests that the yunits method works with a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in the input. +2) Check that each output unit object contains the correct values. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the yunits method works with a list of AOs as input.} & Tests that the yunits method works with a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in the input. +2) Check that each output unit object contains the correct values. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the yunits method works with a mix of different shaped AOs as +input.} & Tests that the yunits method works with a mix of different shaped AOs as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in the input. +2) Check that each output unit object contains the correct values. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the yunits method properly applies history.} & The yunits method doesn't change the AO, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the yunits method works for AOs with different data objects.} & Test that the yunits method returns the yunits values for AOs with cdata, +fsdata, tsdata and xydata objects. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline +\caption{Unit tests for ao/yunits.} +\label{tab:ao_yunits} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/zDomainFit} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the zDomainFit method works with a vector of AOs as input.} & Test that the zDomainFit method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'av' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the zDomainFit method works with a matrix of AOs as input.} & Test that the zDomainFit method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'am' +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the zDomainFit method works with a list of AOs as input.} & Test that the zDomainFit method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the zDomainFit method works with a mix of different shaped AOs as +input.} & Test that the zDomainFit method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the zDomainFit method properly applies history.} & Test that the result of applying the zDomainFit method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'zDomainFit'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{zDomainFit cannot modify the input AO.} & Test that the sDomainFit method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Nothing to do. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the zDomainFit method pass back the output objects to a +single variable correctly.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Tests that the zDomainFit method return the correct coefficients} & Test that the zDomainFit method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that output contains the correct coefficients. & pass \\ \hline +\caption{Unit tests for ao/zDomainFit.} +\label{tab:ao_zDomainFit} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ao/zeropad} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the zeropad method works with a vector of AOs as input.} & Test that the zeropad method works for a vector of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the zeropad method works with a matrix of AOs as input.} & Test that the zeropad method works for a matrix of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the zeropad method works with a list of AOs as input.} & Test that the zeropad method works for a list of AOs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the square of the +number in the input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the zeropad method works with a mix of different shaped AOs as +input.} & Test that the zeropad method works with an input of matrices and vectors +and single AOs. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output AO contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the zeropad method properly applies history.} & Test that the result of applying the zeropad method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'zeropad'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the zeropad method can modify the input AO.} & Test that the zeropad method can modify the input AO by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'at1' and 'ain' are now different. +2) Check that 'ain' is zeropad(at1). & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Check the data shape of the output against the input.} & Test that the zeropad method keeps the data shape of the input object. The +input AO must be an AO with row data and an AO with column data. & pass \\ \cline{3-4} + & & 1) Check that the shpe of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the zeropad method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [ao/zeropad] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for ao/zeropad.} +\label{tab:ao_zeropad} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf collection/collection} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [collection/collection] method works with a vector of objects as input.} & Test that the [collection/collection] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [collection/collection] method works with a matrix of objects as input.} & Test that the [collection/collection] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [collection/collection] method works with a list of objects as input.} & Test that the [collection/collection] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [collection/collection] method works with a mix of different arrays of objects as input.} & Tests that the [collection/collection] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [collection/collection] method properly applies history.} & Test that the result of applying the [collection/collection] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[collection/collection]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the collection method properly applies history to the +constructor with different numbers of inputs.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'collection'. +2) Check that the rebuilt objects are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests the collection constructor with different inputs.} & Tests the collection constructor with different inputs. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'collection'. +2) Check that the rebuilt objects are the same & pass \\ \hline + \multirow{2}{3cm}{60 } & \multirow{2}{5cm}{Tests that the constructor method doesn't apply history to the read +MAT-file constructor.} & Tests that the constructor method doesn't apply history to the read +MAT-file constructor. & pass \\ \cline{3-4} + & & 1) Check that the history is the same as the history of the saved +object. Because save and load shouldn't add a history step. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{61 } & \multirow{2}{5cm}{Tests that the constructor properly applies history to the read +XML-file constructor.} & Tests that the constructor properly applies history to the read +XML-file constructor. & pass \\ \cline{3-4} + & & 1) Check that the history is the same as the history of the saved +object. Because save and load shouldn't add a history step. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{62 } & \multirow{2}{5cm}{Tests that the constructor properly applies history in the struct constructor.} & Tests that the constructor properly applies history in the struct constructor. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to the class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{64 } & \multirow{2}{5cm}{Tests that the contructor properly applies history to the +plist(filename) constructor.} & Tests that the contructor properly applies history to the +plist(filename) constructor. & pass \\ \cline{3-4} + & & 1) Check that the save method doesn't change the input object +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{65 } & \multirow{2}{5cm}{Tests that the contructed object can be submitted and retrieved.} & Tests that the contructed object can be submitted and retrieved. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +the class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{68 } & \multirow{2}{5cm}{Tests that the constructor properly applies history to the conn+Id constructor.} & Tests that the constructor properly applies history to the conn+Id +constructor. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{70 } & \multirow{2}{5cm}{Tests that the constructor properly applies history to the +plist() constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for collection/collection.} +\label{tab:collection_collection} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf collection/copy} &&& \\ \hline +\endhead + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline +\caption{Unit tests for collection/copy.} +\label{tab:collection_copy} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf collection/loadobj} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check the shape of the loaded objects. & pass \\ \hline +\caption{Unit tests for collection/loadobj.} +\label{tab:collection_loadobj} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf filterbank/copy} &&& \\ \hline +\endhead + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline +\caption{Unit tests for filterbank/copy.} +\label{tab:filterbank_copy} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf filterbank/filterbank} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [filterbank/filterbank] method works with a vector of objects as input.} & Test that the [filterbank/filterbank] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [filterbank/filterbank] method works with a matrix of objects as input.} & Test that the [filterbank/filterbank] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [filterbank/filterbank] method works with a list of objects as input.} & Test that the [filterbank/filterbank] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [filterbank/filterbank] method works with a mix of different arrays of objects as input.} & Tests that the [filterbank/filterbank] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [filterbank/filterbank] method properly applies history.} & Test that the result of applying the [filterbank/filterbank] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[filterbank/filterbank]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{60 } & \multirow{2}{5cm}{Tests that the constructor method doesn't apply history to the read +MAT-file constructor.} & Tests that the constructor method doesn't apply history to the read +MAT-file constructor. & pass \\ \cline{3-4} + & & 1) Check that the history is the same as the history of the saved +object. Because save and load shouldn't add a history step. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{61 } & \multirow{2}{5cm}{Tests that the constructor properly applies history to the read +XML-file constructor.} & Tests that the constructor properly applies history to the read +XML-file constructor. & pass \\ \cline{3-4} + & & 1) Check that the history is the same as the history of the saved +object. Because save and load shouldn't add a history step. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{62 } & \multirow{2}{5cm}{Tests that the constructor properly applies history in the struct constructor.} & Tests that the constructor properly applies history in the struct constructor. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to the class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{64 } & \multirow{2}{5cm}{Tests that the contructor properly applies history to the +plist(filename) constructor.} & Tests that the contructor properly applies history to the +plist(filename) constructor. & pass \\ \cline{3-4} + & & 1) Check that the save method doesn't change the input object +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{65 } & \multirow{2}{5cm}{Tests that the contructed object can be submitted and retrieved.} & Tests that the contructed object can be submitted and retrieved. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +the class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{68 } & \multirow{2}{5cm}{Tests that the constructor properly applies history to the conn+Id constructor.} & Tests that the constructor properly applies history to the conn+Id +constructor. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for filterbank/filterbank.} +\label{tab:filterbank_filterbank} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf filterbank/loadobj} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check the shape of the loaded objects. & pass \\ \hline +\caption{Unit tests for filterbank/loadobj.} +\label{tab:filterbank_loadobj} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf matrix/char} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the char method works with a vector of MATRIX objects as input.} & Test that the char method works for a vector of MATRIX objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least the character set +(char-method) of all inner object & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the char method works with a matrix of MATRIX objects as input.} & Test that the char method works for a matrix of MATRIX objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least the character set +(char-method) of all inner object & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the char method works with a list of MATRIX objects as input.} & Test that the char method works for a list of MATRIX objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least the character set +(char-method) of all inner object & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the char method works with a mix of different shaped MATRIX +objects as input.} & Test that the char method works with an input of matrices and vectors +and single MATRIX objects. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least the character set +(char-method) of all inner object & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the char method properly applies history.} & The method char doesn't change the data, thus it is not possible to +check the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for matrix/char.} +\label{tab:matrix_char} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf matrix/copy} &&& \\ \hline +\endhead + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline +\caption{Unit tests for matrix/copy.} +\label{tab:matrix_copy} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf matrix/ctranspose} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the ctranspose method works with a vector of MATRICES as input.} & Test that the ctranspose method works for a vector of MATRICES as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mav' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the ctranspose method works with a matrix of MATRICES as input.} & Test that the ctranspose method works for a matrix of MATRICES as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mam' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the ctranspose method works with a list of MATRICES as input.} & Test that the ctranspose method works for a list of MATRICES as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the ctranspose method works with a mix of different shaped +MATRICES as input.} & Test that the ctranspose method works with an input of matrices and +vectors and single MATRICES. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the ctranspose method properly applies history.} & Test that the result of applying the ctranspose method can be +processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'ctranspose'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the ctranspose method can modify the input MATRIX.} & Test that the ctranspose method can modify the input MATRIX by calling +with no output. & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'obj\_eq' are now different. +2) Check that 'obj\_eq' is not changed +3) Check that the modified input is the ctranspose value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the ctranspose method accepts plist as an input.} & Tests that the ctranspose method accepts plist as an input. & pass \\ \cline{3-4} + & & 1) Check that the correct data +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [matrix/ctranspose] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for matrix/ctranspose.} +\label{tab:matrix_ctranspose} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf matrix/display} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the display method works with a vector of MATRIX objects as +input.} & Test that the display method works for a vector of MATRIX objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the display method works with a matrix of MATRIX objects as +input.} & Test that the display method works for a matrix of MATRIX objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the display method works with a list of MATRIX objects as +input.} & Test that the display method works for a list of MATRIX objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the display method works with a mix of different shaped +MATRIX objects as input.} & Test that the display method works with an input of matrices and +vectors and single MATRIX objects as. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the display method properly applies history.} & The method display doesn't change the data, thus it is not possible +to check the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for matrix/display.} +\label{tab:matrix_display} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf matrix/loadobj} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check the shape of the loaded objects. & pass \\ \hline +\caption{Unit tests for matrix/loadobj.} +\label{tab:matrix_loadobj} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf matrix/matrix} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [matrix/matrix] method works with a vector of objects as input.} & Test that the [matrix/matrix] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [matrix/matrix] method works with a matrix of objects as input.} & Test that the [matrix/matrix] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [matrix/matrix] method works with a list of objects as input.} & Test that the [matrix/matrix] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [matrix/matrix] method works with a mix of different arrays of objects as input.} & Tests that the [matrix/matrix] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [matrix/matrix] method properly applies history.} & Test that the result of applying the [matrix/matrix] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[matrix/matrix]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the matrix method properly applies history to the +constructor with different numbers of inputs.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'matrix'. +2) Check that the rebuilt objects are the same & pass \\ \hline + \multirow{2}{3cm}{60 } & \multirow{2}{5cm}{Tests that the constructor method doesn't apply history to the read +MAT-file constructor.} & Tests that the constructor method doesn't apply history to the read +MAT-file constructor. & pass \\ \cline{3-4} + & & 1) Check that the history is the same as the history of the saved +object. Because save and load shouldn't add a history step. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{61 } & \multirow{2}{5cm}{Tests that the constructor properly applies history to the read +XML-file constructor.} & Tests that the constructor properly applies history to the read +XML-file constructor. & pass \\ \cline{3-4} + & & 1) Check that the history is the same as the history of the saved +object. Because save and load shouldn't add a history step. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{62 } & \multirow{2}{5cm}{Tests that the constructor properly applies history in the struct constructor.} & Tests that the constructor properly applies history in the struct constructor. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to the class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{64 } & \multirow{2}{5cm}{Tests that the contructor properly applies history to the +plist(filename) constructor.} & Tests that the contructor properly applies history to the +plist(filename) constructor. & pass \\ \cline{3-4} + & & 1) Check that the save method doesn't change the input object +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{65 } & \multirow{2}{5cm}{Tests that the contructed object can be submitted and retrieved.} & Tests that the contructed object can be submitted and retrieved. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +the class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{68 } & \multirow{2}{5cm}{Tests that the constructor properly applies history to the conn+Id constructor.} & Tests that the constructor properly applies history to the conn+Id +constructor. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{70 } & \multirow{2}{5cm}{Tests that the constructor properly applies history to the +plist() constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for matrix/matrix.} +\label{tab:matrix_matrix} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf matrix/ncols} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the ncols method works with a vector of MATRICES as input.} & The ncols method doesn't work with a vector of MATRICES. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the ncols method works with a matrix of MATRICES as input.} & The ncols method doesn't work with a matrix of MATRICES. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the ncols method works with a list of MATRICES as input.} & The ncols method doesn't work with a list of MATRICES. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the ncols method works with a mix of different shaped +MATRICES as input.} & The ncols method can only return the ncols values of one MATRIX. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the ncols method properly applies history.} & The ncols method doesn't change the MATRIX, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the ncols method returns the number of columns of the inner +objects.} & Tests that the ncols method returns the number of columns of the inner +objects. & pass \\ \cline{3-4} + & & 1) Check that n1 and n2 are correct. & pass \\ \hline +\caption{Unit tests for matrix/ncols.} +\label{tab:matrix_ncols} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf matrix/nrows} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the nrows method works with a vector of MATRICES as input.} & The nrows method doesn't work with a vector of MATRICES. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the nrows method works with a matrix of MATRICES as input.} & The nrows method doesn't work with a matrix of MATRICES. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the nrows method works with a list of MATRICES as input.} & The nrows method doesn't work with a list of MATRICES. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the nrows method works with a mix of different shaped +MATRICES as input.} & The nrows method can only return the nrows values of one MATRIX. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the nrows method properly applies history.} & The nrows method doesn't change the MATRIX, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the nrows method returns the number of columns of the inner +objects.} & Tests that the nrows method returns the number of columns of the inner +objects. & pass \\ \cline{3-4} + & & 1) Check that n1 and n2 are correct. & pass \\ \hline +\caption{Unit tests for matrix/nrows.} +\label{tab:matrix_nrows} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf matrix/osize} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the osize method works with a vector of MATRICES as input.} & The osize method doesn't work with a vector of MATRICES. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the osize method works with a matrix of MATRICES as input.} & The osize method doesn't work with a matrix of MATRICES. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the osize method works with a list of MATRICES as input.} & The osize method doesn't work with a list of MATRICES. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the osize method works with a mix of different shaped +MATRICES as input.} & The osize method can only return the osize values of one MATRIX. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the osize method properly applies history.} & The osize method doesn't change the MATRIX, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the osize method returns the number of columns of the inner +objects.} & Tests that the osize method returns the number of columns of the inner +objects. & pass \\ \cline{3-4} + & & 1) Check that n1 and n2 are correct. & pass \\ \hline +\caption{Unit tests for matrix/osize.} +\label{tab:matrix_osize} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf matrix/setObjs} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [matrix/setObjs] method works with a vector of objects as input.} & Test that the [matrix/setObjs] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [matrix/setObjs] method works with a matrix of objects as input.} & Test that the [matrix/setObjs] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [matrix/setObjs] method works with a list of objects as input.} & Test that the [matrix/setObjs] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [matrix/setObjs] method works with a mix of different arrays of objects as input.} & Tests that the [matrix/setObjs] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [matrix/setObjs] method properly applies history.} & Test that the result of applying the [matrix/setObjs] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[matrix/setObjs]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setObjs method can modify the input MATRIX.} & Test that the setObjs method can modify the input MATRIX by calling +with no output. & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'obj\_eq' are now different. +2) Check that 'obj\_eq' is not changed +3) Check that the modified input is the setObjs value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setObjs method can set the property without a plist.} & Test that the setObjs method can modify the property 'objs' +without a plist. & pass \\ \cline{3-4} + & & 1) Check that 'out' has the correct objs field +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setObjs method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [matrix/setObjs] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for matrix/setObjs.} +\label{tab:matrix_setObjs} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf matrix/transpose} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the transpose method works with a vector of MATRICES as input.} & Test that the transpose method works for a vector of MATRICES as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mav' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the transpose method works with a matrix of MATRICES as input.} & Test that the transpose method works for a matrix of MATRICES as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mam' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the transpose method works with a list of MATRICES as input.} & Test that the transpose method works for a list of MATRICES as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the transpose method works with a mix of different shaped +MATRICES as input.} & Test that the transpose method works with an input of matrices and +vectors and single MATRICES. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the transpose method properly applies history.} & Test that the result of applying the transpose method can be +processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'transpose'. +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the transpose method can modify the input MATRIX.} & Test that the transpose method can modify the input MATRIX by calling +with no output. & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'obj\_eq' are now different. +2) Check that 'obj\_eq' is not changed +3) Check that the modified input is the transpose value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the transpose method accepts plist as an input.} & Tests that the transpose method accepts plist as an input. & pass \\ \cline{3-4} + & & 1) Check that the correct data +2) Check that the re-built object is the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the [matrix/transpose] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the same plotinfo plist & pass \\ \hline +\caption{Unit tests for matrix/transpose.} +\label{tab:matrix_transpose} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/char} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the char method works with a vector of MFIR objects as input.} & Test that the char method works for a vector of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the char method works with a matrix of MFIR objects as input.} & Test that the char method works for a matrix of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the char method works with a list of MFIR objects as input.} & Test that the char method works for a list of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the char method works with a mix of different shaped MFIR objects +as input.} & Test that the char method works with an input of matrices and vectors +and single MFIR objects. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the char method properly applies history.} & The method char doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for mfir/char.} +\label{tab:mfir_char} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/copy} &&& \\ \hline +\endhead + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline +\caption{Unit tests for mfir/copy.} +\label{tab:mfir_copy} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/created} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the created method works with a vector of MFIR objects as +input.} & Test that the created method works for a vector of MFIR objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'firv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the created method works with a matrix of MFIR objects as +input.} & Test that the created method works for a matrix of MFIR objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'firm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the created method works with a list of MFIR objects as +input.} & Test that the created method works for a list of MFIR objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the created method works with a mix of different shaped +MFIR objects as input.} & Test that the created method works with an input of matrices and +vectors and single MFIR objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the created method properly applies history} & This method doesn't change the input object, thus no history is added +to the object. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the created method can be used with the modify command.} & Tests that the created method can be used with the modify command. & pass \\ \cline{3-4} + & & 1) Check the single object +2) Check the matrix object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the created method retruns always a well defined time object +even for an empty input object.} & Test that the created method with an empty 'MFIR object & pass \\ \cline{3-4} + & & 1) Check that the output is a time object with a ell defined time. & pass \\ \hline +\caption{Unit tests for mfir/created.} +\label{tab:mfir_created} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/creator} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the creator method works with a vector of MFIR objects as +input.} & Test that the creator method works for a vector of MFIR objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'firv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the creator method works with a matrix of MFIR objects as +input.} & Test that the creator method works for a matrix of MFIR objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'firm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the creator method works with a list of MFIR objects as +input.} & The creator method doesn't work for a list of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the creator method works with a mix of different shaped +MFIR objects as input.} & The creator method doesn't work with different shaped input objects. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the creator method properly applies history} & This method doesn't change the input object, thus no history is added +to the object. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the creator method can be used with the modify command.} & Tests that the creator method can be used with the modify command. & pass \\ \cline{3-4} + & & 1) Check the single object +2) Check the matrix object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the creator method retruns all creator(s)/modifier(s) which +are in the history.} & Test that the creator method uses the option 'all' direct or in a +plist. The test file must have the modifier 'first', 'second' and +'third' & pass \\ \cline{3-4} + & & 1) Check that out1 contains only one creator +2) Check that out2 contain more creator/modifier & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests the negative case for the option 'all'.} & Test that the creator method throws an error if the option 'all' is +used in connection with a matrix/vector of MFIR objects. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline +\caption{Unit tests for mfir/creator.} +\label{tab:mfir_creator} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/display} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the display method works with a vector of MFIR objects as input.} & Test that the display method works for a vector of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the display method works with a matrix of MFIR objects as input.} & Test that the display method works for a matrix of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the display method works with a list of MFIR objects as input.} & Test that the display method works for a list of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the display method works with a mix of different shaped +MFIR objects as input.} & Test that the display method works with an input of matrices and vectors +and single MFIR objects as. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the display method properly applies history.} & The method display doesn't change the data, thus it is not possible to +check the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for mfir/display.} +\label{tab:mfir_display} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/eq} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the eq method works with a vector of MFIR objects as input.} & Test that the eq method works for a vector of MFIR objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the eq function. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the eq method works with a matrix of MFIR objects as input.} & Test that the eq method works for a matrix of MFIR objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the eq function. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the eq method works with a list of MFIR objects as input.} & The eq method doesn't works for a list of MFIR objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the eq method works with a mix of different shaped MFIR objects +as input.} & The eq method doesn't works for a list of MFIR objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the eq method properly applies history.} & The eq method doesn't change the MFIR object, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'name'. Use the option 'internal' to +suppress the history. It is necessary to add 'created' to the exception +list because fir is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'histout'. Use the option 'internal' to +suppress the history. It is necessary to add 'created' to the exception +list because fir is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'iunits'. Use the option 'internal' +to suppress the history. It is necessary to add 'created' to the exception +list because fir is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'ounits'. Use the option 'internal' +to suppress the history. It is necessary to add 'created' to the exception +list because fir is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Test the eq method with an exception list which is in a plist.} & Test that the eq method uses the exception list in a plist. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline +\caption{Unit tests for mfir/eq.} +\label{tab:mfir_eq} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/get} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests the get method of the mfir class.} & Test that the get returns returns the value of the specified +property. Do this for all properties of the MFIR object. & pass \\ \cline{3-4} + & & 1) Check the correct value of the output & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the get method works with a plist.} & Test that the get returns returns the value of the specified +property which is defined in a plist. & pass \\ \cline{3-4} + & & 1) Check the correct value of the output & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests the get method of the mfir class.} & Test that the get throws an error if the input are more than +one MFIR object. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline +\caption{Unit tests for mfir/get.} +\label{tab:mfir_get} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/index} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the index method works with a vector of MFIR objects as +input.} & Test that the index method works for a vector of MFIR objects as +input. The following indexing should work: +I = [ 1 2 3 ] or (I/J) = [(1,1), (1,2), (1,3)] & pass \\ \cline{3-4} + & & 1) Check that the index method selects the correct object. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the index method works with a matrix of MFIR objects as +input.} & Test that the index method works for a matrix of MFIR objects as +input. The following indexing should work: +I = [ 1 3 5 ] or (I/J) = [(1,1), (1,2), (1,3)] +[ 2 4 6 ] [(2,1), (2,2), (2,3)] & pass \\ \cline{3-4} + & & 1) Check that the index method selects the correct object. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the index method works with a list of MFIR objects as +input.} & The index method doesn't work for a list of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the index method properly applies history.} & Test that the result of index have an additional history step. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds +to 'index'. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the index method works for the modifier command.} & Tests that the index method works for the modifier command. & pass \\ \cline{3-4} + & & 1) Check that the history-plist contains the used indices. +2) Check that the index method selects the correct object & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the index method can be controled with a plist. & pass \\ \cline{3-4} + & & 1) Check that the history-plist contains the used indices. +2) Check that the index method selects the correct object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the index method selects more objects if I have more indices.} & Test that the index method selects more objects if I have more indices. & pass \\ \cline{3-4} + & & 1) Check that the history-plist contains the used indices. +2) Check that the index method selects the correct object & pass \\ \hline +\caption{Unit tests for mfir/index.} +\label{tab:mfir_index} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/isprop} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the isprop method works with a vector of MFIR objects as input.} & Test that the isprop method works for a vector of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'firv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the isprop method works with a matrix of MFIR objects as input.} & Test that the isprop method works for a matrix of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'firm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the isprop method works with a list of MFIR objects as input.} & Test that the isprop method works for a list of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the isprop method works with a mix of different shaped +MFIR objects as input.} & Test that the isprop method works with an input of matrices and vectors +and single MFIR objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the isprop method properly applies history.} & The method isprop doesn't change the object, thus it is not necessary to +apply history. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the isprop method works for each property.} & Test that the isprop method works for the properties: +'gd', 'ntaps', 'fs', 'infile', 'a', 'histout', +'iunits', 'ounits', 'hist', 'name' & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the negative case and the not function command.} & Test that the isprop method retrun false for a unknown property and for +methods of the object. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline +\caption{Unit tests for mfir/isprop.} +\label{tab:mfir_isprop} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/loadobj} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check the shape of the loaded objects. & pass \\ \hline +\caption{Unit tests for mfir/loadobj.} +\label{tab:mfir_loadobj} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/mfir} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the mfir method works with a vector of MFIR objects as input.} & Test that the mfir method works with a vector of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output MFIRs is the same as the input shape. +2) Check that each output MFIR is a copy of the input MFIR. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the mfir method works with a matrix of MFIR objects as input.} & Test that the mfir method works with a matrix of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output MFIRs is the same as the input shape. +2) Check that each output MFIR is a copy of the input MFIR. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the mfir method works with a list of MFIR objects as input.} & Test that the mfir method works with a list of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same of the +number in the input. +2) Check that each output MFIR is a copy of the input MFIR. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the mfir method works with a mix of different shaped MFIRs as +input.} & Test that the mfir method works with a mix of different shaped MFIRs as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same of the +number in the input. +2) Check that each output MFIR is a copy of the input MFIR. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the mfir method properly applies history.} & Test that the result of applying the mfir method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'mfir'. +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the mfir method properly applies history to the copy constructor.} & Test that the output can be processed back with the 'rebuild' method. +Test the constructor with a different number of inputs. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'mfir'. +2) Check that the original objects are not changed by the setter function +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the mfir method properly applies history to the read +MAT-file constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to 'mfir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests that the mfir method properly applies history to the read +XML-file constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check the shape +2) Check that the last entry in the history of 'out' +corresponds to 'mfir'. +3) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Tests that the mfir method properly applies history to the AO constructor.} & Test that the output can be processed back with the 'rebuild' method. Use +the default values (method = 'frequency-sampling'). & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to 'mfir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Tests that the mfir method properly applies history to the struct constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to 'mfir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Tests that the mfir method properly applies history to the pzmodel constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to 'mfir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Tests that the mfir method properly applies history to the +plist(filename) constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the save method doesn't change the input object +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{14 } & \multirow{2}{5cm}{Tests that the MFIR method properly applies history to the +plist(conn) constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'mfir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{15 } & \multirow{2}{5cm}{Tests that the MFIR method properly applies history to the +plist(type) constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'mfir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{16 } & \multirow{2}{5cm}{Tests that the MFIR method properly applies history to the +plist(pzmodel) constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'mfir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{17 } & \multirow{2}{5cm}{Tests that the MFIR method properly applies history to the +plist() constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'mfir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{18 } & \multirow{2}{5cm}{Tests that the MFIR method properly applies history to the a constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'mfir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{19 } & \multirow{2}{5cm}{Tests that the mfir method properly applies history to the plist(AO) constructor.} & Test that the output can be processed back with the 'rebuild' method. Use +the method 'frequency-sampling'. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to 'mfir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{20 } & \multirow{2}{5cm}{Tests that the mfir method properly applies history to the plist(AO) constructor.} & Test that the output can be processed back with the 'rebuild' method. Use +the method 'least-squares'. & pass \\ \cline{3-4} + & & 1) At the moment throws this method an error. & pass \\ \hline + \multirow{2}{3cm}{21 } & \multirow{2}{5cm}{Tests that the mfir method properly applies history to the plist(AO) constructor.} & Test that the output can be processed back with the 'rebuild' method. Use +the method 'Parks-McClellan'. & pass \\ \cline{3-4} + & & 1) At the moment throws this method an error. & pass \\ \hline + \multirow{2}{3cm}{22 } & \multirow{2}{5cm}{Tests that the mfir method properly applies history to the AO + plist constructor.} & Test that the output can be processed back with the 'rebuild' method. Use +the method 'frequency-sampling'. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to 'mfir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{23 } & \multirow{2}{5cm}{Tests that the MFIR method properly applies history to the conn+Id constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'mfir'. +2) Check that re-running the 'test.m' file produces the same object +as 'out'. & pass \\ \hline + \multirow{2}{3cm}{24 } & \multirow{2}{5cm}{Tests that the MFIR method properly applies history to the +pole/zero model + plist object constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'mfir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{25 } & \multirow{2}{5cm}{Tests that the MFIR method properly applies history to the +a + fs object constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'mfir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for mfir/mfir.} +\label{tab:mfir_mfir} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/ne} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the ne method works with a vector of MFIR objects as input.} & Test that the ne method works for a vector of MFIR objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the ne function. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the ne method works with a matrix of MFIR objects as input.} & Test that the ne method works for a matrix of MFIR objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the ne function. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the ne method works with a list of MFIR objects as input.} & The ne method doesn't works for a list of MFIR objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the ne method works with a mix of different shaped MFIR objects +as input.} & The ne method doesn't works for a list of MFIR objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the ne method properly applies history.} & The ne method doesn't change the MFIR object, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the ne method with an exception list. +The function mfir/ne use the function mfir/eq so it is not necessary to check +all possibilities of the exception list.} & Test the ne method with the exception 'name'. Use the option 'internal' to +suppress the history. It is necessary to add 'created' to the exception +list because fir is created at an other time. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the ne method with an exception list which is in a plist.} & Test that the ne method uses the exception list in a plist. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline +\caption{Unit tests for mfir/ne.} +\label{tab:mfir_ne} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/rebuild} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the rebuild method works with a vector of MFIR objects as input.} & Test that the rebuild method works for a vector of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the rebuild method works with a matrix of MFIR objects as input.} & Test that the rebuild method works for a matrix of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the rebuild method works with a list of MFIR objects as input.} & Test that the rebuild method works for a list of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the rebuild method works with a mix of different shaped MFIR objects +as input.} & Test that the rebuild method works with an input of matrices and vectors +and single MFIR objects. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the rebuild method properly applies history.} & The method rebuild doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Check that the rebuild method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for mfir/rebuild.} +\label{tab:mfir_rebuild} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/redesign} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the redesign method works with a vector of MFIR objects as input.} & Test that the redesign method works for a vector of MFIR objects as input. +To keep this UTP simple use for the vector only one filter object. The +different filters will be tested in an other UTP. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'firvec' +2) Check that each output MFIR contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the redesign method works with a matrix of MFIR objects as input.} & Test that the redesign method works for a matrix of MFIR objects as input. +To keep this UTP simple use for the matrix only one filter object. The +different filters will be tested in an other UTP. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'firmat' +2) Check that each output MFIR contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the redesign method works with a list of MFIR objects as input.} & Test that the redesign method works for a list of MFIR objects as input. +To keep this UTP simple use for the list only one filter object. The +different filters will be tested in an other UTP. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output MFIR contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the redesign method works with a mix of different shaped +MFIR objects as input.} & Test that the redesign method works with an input of matrices and vectors +and single MFIR objects. +To keep this UTP simple use for the vector only one filter object. The +different filters will be tested in an other UTP. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output MFIR contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the redesign method properly applies history.} & Test that the result of applying the redesign method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'redesign'. +2) Check that re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the redesign method redesigns a standard filter type.} & Tests that the redesign method redesigns a standard filter type. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check the rebuilt object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the redesign method redesigns a pzmodel filter type.} & Tests that the redesign method redesigns a pzmodel filter type. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check the rebuilt object & pass \\ \hline +\caption{Unit tests for mfir/redesign.} +\label{tab:mfir_redesign} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/resp} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the resp method works with a vector of MFIR objects as input.} & Test that the resp method works for a vector of MFIR objects as input. +Test the method with an output and with no output (a diagram must appear) & pass \\ \cline{3-4} + & & 1) Test the right number of lines in the diagram. +2) Check that the number of elements in 'out' is the same as in 'firv' +3) Check that each output MFIR contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the resp method works with a matrix of MFIR objects as input.} & Test that the resp method works for a matrix of MFIR objects as input. +Test the method with an output and with no output (a diagram must appear) & pass \\ \cline{3-4} + & & 1) Test the right number of lines in the diagram. +2) Check that the number of elements in 'out' is the same as in 'firmat' +3) Check that each output MFIR contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the resp method works with a list of MFIR objects as input.} & Test that the resp method works for a list of MFIR objects as input. +Test the method with an output and with no output (a diagram must appear) & pass \\ \cline{3-4} + & & 1) Test the right number of lines in the diagram. +2) Check that the number of elements in 'out' is the same as in 'firmat' +3) Check that each output MFIR contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the resp method works with a mix of different shaped MFIR +objects as input.} & Test that the resp method works with an input of matrices and vectors +and single MFIR objects. Test the method with an output and with no +output (a diagram must appear) & pass \\ \cline{3-4} + & & 1) Test the right number of lines in the diagram. +2) Check that the number of elements in 'out' is the same as in 'firmat' +3) Check that each output MFIR contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the resp method properly applies history.} & Test that the result of applying the resp method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'resp'. +2) Check that re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that modify command plots the response into a diagram.} & Tests that modify command plots the response into a diagram. & pass \\ \cline{3-4} + & & 1) Check the response diagram. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the output AO of the resp method keeps the shape of the used +input f vector. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the resp method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the resp method uses the x-data of an input AO for f-vector.} & Call the method with different method to pass an AO in. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the resp method uses the specified f-vector to compute the response.} & Call the method with different method to pass an f-vector in. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Check that the resp method uses the specified f1, f2, and nf to compute the response.} & Call the method with different method to pass f1, f2, and nf in. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Check that the resp method uses the specified f1, f2, and nf to compute the response.} & Call the method with different method to pass f1, f2, and nf in. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{14 } & \multirow{2}{5cm}{Check that the resp method the response of a serial filter bank.} & Check that the resp method the response of a serial filter bank. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{15 } & \multirow{2}{5cm}{Check that the resp method the response of a parallel filter bank.} & Check that the resp method the response of a parallel filter bank. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for mfir/resp.} +\label{tab:mfir_resp} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/save} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the save method works with a vector of MFIR objects as input.} & Test that the save method works for a vector of MFIR objects as input. +Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the same +as in 'firv' +2) Check that the loaded objects are the same as the saved objects. +3) The outputs 'out1' and 'out2' must be the same. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the save method works with a matrix of MFIR objects as input.} & Test that the save method works for a matrix of MFIR objects as input. +Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the same +as in 'firm' +2) Check that the loaded objects are the same as the saved objects. +3) The outputs 'out1' and 'out2' must be the same. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the save method works with a list of MFIR objects as input.} & Test that the save method works for a list of MFIR objects as input. +Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the same +as in the list +2) Check that the loaded objects are the same as the saved objects. +3) The outputs 'out1' and 'out2' must be the same. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the save method works with a mix of different shaped MFIR objects +as input.} & Test that the save method works with an input of matrices and vectors +and single MFIR objects. Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output MFIR object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the save method properly applies history.} & Test that the result of applying the save method can be processed back +to an m-file. Do this for both extensions 'mat' and 'xml' & pass \\ \cline{3-4} + & & 1) Check that the history applies to the output object. Check that +save doesn't add a history step to the input object. +2) Check that the read object doesn't contain the save + load history steps. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the save method works with the modify command.} & Use the save method with the modifier command. & pass \\ \cline{3-4} + & & 1) Check that the save method applies the history. +2) Check the output against the input. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the save method uses the filename which is stored in a plist. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the save method with standard MFIR objects.} & Save all standard MFIR objects with both extensions. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Test the save method with MFIR object which is created from a pole/zero model} & Save MFIR object which is created from a pzmodel. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Test the save method with MFIR object which is created from an analysis +model.} & Save MFIR object which is created from an analysis model. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline +\caption{Unit tests for mfir/save.} +\label{tab:mfir_save} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/setHistout} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setHistout method works with a vector of MFIR objects as input.} & The setHistout should set the output history (histout) of each input. & pass \\ \cline{3-4} + & & 1) Check the histout has the correct values & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setHistout method works with a matrix of MFIR objects as input.} & The setHistout should set the output history (histout) of each input. & pass \\ \cline{3-4} + & & 1) Check the histout has the correct values & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setHistout method works with a list of MFIR objects as input.} & The setHistout should set the output history (histout) of each input. & pass \\ \cline{3-4} + & & 1) Check the histout has the correct values & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setHistout method works with a mix of different shaped MFIR +objects as input.} & The setHistout method is not designed for this call, for that reason must +this call fail. & pass \\ \cline{3-4} + & & 1) Check the histout has the correct values & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setHistout method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setHistout method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setHistout'. +2) Check that the last entry in the history of 'out2' NOT corresponds to +'setHistout'. +3) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setHistout method can modify the input MFIR object.} & Test that the setHistout method can modify the input MFIR object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'firhp' and 'ain' are now different. +2) Check that 'ain' has the correct histout field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setHistout method can set the property with a plist.} & Test that the setHistout method can modify the property 'histout' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct histout field +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for mfir/setHistout.} +\label{tab:mfir_setHistout} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/setIunits} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setIunits method works with a vector of MFIR objects as input.} & Test that the setIunits method works for a vector of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'firv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setIunits method works with a matrix of MFIR objects as input.} & Test that the setIunits method works for a matrix of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'firm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setIunits method works with a list of MFIR objects as input.} & Test that the setIunits method works for a list of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setIunits method works with a mix of different shaped MFIR +objects as input.} & Test that the setIunits method works with an input of matrices and vectors +and single MFIR objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setIunits method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setIunits method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setIunits'. +2) Check that the last entry in the history of 'out2' NOT corresponds to +'setIunits'. +3) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setIunits method can modify the input MFIR object.} & Test that the setIunits method can modify the input MFIR object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'firhp' and 'ain' are now different. +2) Check that 'ain' has the correct iunits field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setIunits method can set the property with a plist.} & Test that the setIunits method can modify the property 'iunits' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct iunits field +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setIunits method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for mfir/setIunits.} +\label{tab:mfir_setIunits} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/setName} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setName method works with a vector of MFIR objects as input.} & Test that the setName method works for a vector of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'firv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setName method works with a matrix of MFIR objects as input.} & Test that the setName method works for a matrix of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'firm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setName method works with a list of MFIR objects as input.} & Test that the setName method works for a list of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setName method works with a mix of different shaped MFIR +objects as input.} & Test that the setName method works with an input of matrices and vectors +and single MFIR objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setName method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setName method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setName'. +2) Check that the last entry in the history of 'out2' NOT corresponds to +'setName'. +3) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setName method can modify the input MFIR object.} & Test that the setName method can modify the input MFIR object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'firhp' and 'ain' are now different. +2) Check that 'ain' has the correct name field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setName method can set the property with a plist.} & Test that the setName method can modify the property 'name' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct name field +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setName method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for mfir/setName.} +\label{tab:mfir_setName} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/setOunits} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setOunits method works with a vector of MFIR objects as input.} & Test that the setOunits method works for a vector of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'firv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setOunits method works with a matrix of MFIR objects as input.} & Test that the setOunits method works for a matrix of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'firm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setOunits method works with a list of MFIR objects as input.} & Test that the setOunits method works for a list of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setOunits method works with a mix of different shaped MFIR +objects as input.} & Test that the setOunits method works with an input of matrices and vectors +and single MFIR objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setOunits method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setOunits method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setOunits'. +2) Check that the last entry in the history of 'out2' NOT corresponds to +'setOunits'. +3) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setOunits method can modify the input MFIR object.} & Test that the setOunits method can modify the input MFIR object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'firhp' and 'ain' are now different. +2) Check that 'ain' has the correct ounits field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setOunits method can set the property with a plist.} & Test that the setOunits method can modify the property 'ounits' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct ounits field +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setOunits method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for mfir/setOunits.} +\label{tab:mfir_setOunits} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/string} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the string method works with a vector of MFIR objects as input.} & Test that the string method works for a vector of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the string method works with a matrix of MFIR objects as input.} & Test that the string method works for a matrix of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the string method works with a list of MFIR objects as input.} & Test that the string method works for a list of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the string method works with a mix of different shaped MFIR objects +as input.} & Test that the string method works with an input of matrices and vectors +and single MFIR objects. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the string method properly applies history.} & The method string doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the string method doesn't work if the MFIR object have more +than one history step.} & The method string throws an error because the input object have more than +one history step. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for mfir/string.} +\label{tab:mfir_string} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf mfir/type} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the type method works with a vector of MFIR objects as input.} & Test that the type method works for a vector of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the type method works with a matrix of MFIR objects as input.} & Test that the type method works for a matrix of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the type method works with a list of MFIR objects as input.} & Test that the type method works for a list of MFIR objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the type method works with a mix of different shaped MFIR objects +as input.} & Test that the type method works with an input of matrices and vectors +and single MFIR objects. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the type method properly applies history.} & The method type doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for mfir/type.} +\label{tab:mfir_type} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/char} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the char method works with a vector of MIIR objects as input.} & Test that the char method works for a vector of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the char method works with a matrix of MIIR objects as input.} & Test that the char method works for a matrix of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the char method works with a list of MIIR objects as input.} & Test that the char method works for a list of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the char method works with a mix of different shaped MIIR objects +as input.} & Test that the char method works with an input of matrices and vectors +and single MIIR objects. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the char method properly applies history.} & The method char doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for miir/char.} +\label{tab:miir_char} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/copy} &&& \\ \hline +\endhead + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline +\caption{Unit tests for miir/copy.} +\label{tab:miir_copy} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/created} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the created method works with a vector of MIIR objects as +input.} & Test that the created method works for a vector of MIIR objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'iirv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the created method works with a matrix of MIIR objects as +input.} & Test that the created method works for a matrix of MIIR objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'iirm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the created method works with a list of MIIR objects as +input.} & Test that the created method works for a list of MIIR objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the created method works with a mix of different shaped +MIIR objects as input.} & Test that the created method works with an input of matrices and +vectors and single MIIR objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the created method properly applies history} & This method doesn't change the input object, thus no history is added +to the object. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the created method can be used with the modify command.} & Tests that the created method can be used with the modify command. & pass \\ \cline{3-4} + & & 1) Check the single object +2) Check the matrix object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the created method retruns always a well defined time object +even for an empty input object.} & Test that the created method with an empty 'MIIR object & pass \\ \cline{3-4} + & & 1) Check that the output is a time object with a ell defined time. & pass \\ \hline +\caption{Unit tests for miir/created.} +\label{tab:miir_created} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/creator} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the creator method works with a vector of MIIR objects as +input.} & Test that the creator method works for a vector of MIIR objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'iirv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the creator method works with a matrix of MIIR objects as +input.} & Test that the creator method works for a matrix of MIIR objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'iirm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the creator method works with a list of MIIR objects as +input.} & The creator method doesn't work for a list of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the creator method works with a mix of different shaped +MIIR objects as input.} & The creator method doesn't work with different shaped input objects. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the creator method properly applies history} & This method doesn't change the input object, thus no history is added +to the object. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the creator method can be used with the modify command.} & Tests that the creator method can be used with the modify command. & pass \\ \cline{3-4} + & & 1) Check the single object +2) Check the matrix object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the creator method retruns all creator(s)/modifier(s) which +are in the history.} & Test that the creator method uses the option 'all' direct or in a +plist. The test file must have the modifier 'first', 'second' and +'third' & pass \\ \cline{3-4} + & & 1) Check that out1 contains only one creator +2) Check that out2 contain more creator/modifier & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests the negative case for the option 'all'.} & Test that the creator method throws an error if the option 'all' is +used in connection with a matrix/vector of MIIR objects. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline +\caption{Unit tests for miir/creator.} +\label{tab:miir_creator} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/display} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the display method works with a vector of MIIR objects as +input.} & Test that the display method works for a vector of MIIR objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the display method works with a matrix of MIIR objects as +input.} & Test that the display method works for a matrix of MIIR objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the display method works with a list of MIIR objects as +input.} & Test that the display method works for a list of MIIR objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the display method works with a mix of different shaped +MIIR objects as input.} & Test that the display method works with an input of matrices and +vectors and single MIIR objects as. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the display method properly applies history.} & The method display doesn't change the data, thus it is not possible +to check the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for miir/display.} +\label{tab:miir_display} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/eq} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the eq method works with a vector of MIIR objects as input.} & Test that the eq method works for a vector of MIIR objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the eq function. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the eq method works with a matrix of MIIR objects as input.} & Test that the eq method works for a matrix of MIIR objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the eq function. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the eq method works with a list of MIIR objects as input.} & The eq method doesn't works for a list of MIIR objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the eq method works with a mix of different shaped MIIR objects +as input.} & The eq method doesn't works for a list of MIIR objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the eq method properly applies history.} & The eq method doesn't change the MIIR object, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'name'. Use the option 'internal' to +suppress the history. It is necessary to add 'created' to the exception +list because iir is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'histin'. Use the option 'internal' to +suppress the history. It is necessary to add 'created' to the exception +list because iir is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'histout'. Use the option 'internal' +to suppress the history. It is necessary to add 'created' to the exception +list because iir is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'iunits'. Use the option 'internal' +to suppress the history. It is necessary to add 'created' to the exception +list because iir is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'ounits'. Use the option 'internal' +to suppress the history. It is necessary to add 'created' to the exception +list because iir is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Test the eq method with an exception list which is in a plist.} & Test that the eq method uses the exception list in a plist. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline +\caption{Unit tests for miir/eq.} +\label{tab:miir_eq} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/get} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests the get method of the miir class.} & Test that the get returns returns the value of the specified +property. Do this for all properties of the MIIR object. & pass \\ \cline{3-4} + & & 1) Check the correct value of the output & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the get method works with a plist.} & Test that the get returns returns the value of the specified +property which is defined in a plist. & pass \\ \cline{3-4} + & & 1) Check the correct value of the output & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests the get method of the miir class.} & Test that the get throws an error if the input are more than +one MIIR object. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline +\caption{Unit tests for miir/get.} +\label{tab:miir_get} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/index} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the index method works with a vector of MIIR objects as +input.} & Test that the index method works for a vector of MIIR objects as +input. The following indexing should work: +I = [ 1 2 3 ] or (I/J) = [(1,1), (1,2), (1,3)] & pass \\ \cline{3-4} + & & 1) Check that the index method selects the correct object. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the index method works with a matrix of MIIR objects as +input.} & Test that the index method works for a matrix of MIIR objects as +input. The following indexing should work: +I = [ 1 3 5 ] or (I/J) = [(1,1), (1,2), (1,3)] +[ 2 4 6 ] [(2,1), (2,2), (2,3)] & pass \\ \cline{3-4} + & & 1) Check that the index method selects the correct object. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the index method works with a list of MIIR objects as +input.} & The index method doesn't work for a list of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the index method properly applies history.} & Test that the result of index have an additional history step. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds +to 'index'. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the index method works for the modifier command.} & Tests that the index method works for the modifier command. & pass \\ \cline{3-4} + & & 1) Check that the history-plist contains the used indices. +2) Check that the index method selects the correct object & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the index method can be controled with a plist. & pass \\ \cline{3-4} + & & 1) Check that the history-plist contains the used indices. +2) Check that the index method selects the correct object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the index method selects more objects if I have more indices.} & Test that the index method selects more objects if I have more indices. & pass \\ \cline{3-4} + & & 1) Check that the history-plist contains the used indices. +2) Check that the index method selects the correct object & pass \\ \hline +\caption{Unit tests for miir/index.} +\label{tab:miir_index} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/isprop} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the isprop method works with a vector of MIIR objects as +input.} & Test that the isprop method works for a vector of MIIR objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'iirv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the isprop method works with a matrix of MIIR objects as +input.} & Test that the isprop method works for a matrix of MIIR objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'iirm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the isprop method works with a list of MIIR objects as +input.} & Test that the isprop method works for a list of MIIR objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the isprop method works with a mix of different shaped +MIIR objects as input.} & Test that the isprop method works with an input of matrices and +vectors and single MIIR objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the isprop method properly applies history.} & The method isprop doesn't change the object, thus it is not necessary +to apply history. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the isprop method works for each property.} & Test that the isprop method works for the properties: +'b', 'histin', 'ntaps', 'fs', 'infile', 'a', 'histout', +'iunits', 'ounits', 'hist', 'name' & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the negative case and the not function command.} & Test that the isprop method retrun false for a unknown property and for +methods of the object. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline +\caption{Unit tests for miir/isprop.} +\label{tab:miir_isprop} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/loadobj} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check the shape of the loaded objects. & pass \\ \hline +\caption{Unit tests for miir/loadobj.} +\label{tab:miir_loadobj} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/miir} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the miir method works with a vector of MIIR objects as input.} & Test that the miir method works with a vector of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output MIIRs is the same as the input shape. +2) Check that each output MIIR is a copy of the input MIIR. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the miir method works with a matrix of MIIR objects as input.} & Test that the miir method works with a matrix of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output MIIRs is the same as the input shape. +2) Check that each output MIIR is a copy of the input MIIR. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the miir method works with a list of MIIR objects as input.} & Test that the miir method works with a list of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same of the +number in the input. +2) Check that each output MIIR is a copy of the input MIIR. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the miir method works with a mix of different shaped MIIRs as +input.} & Test that the miir method works with a mix of different shaped MIIRs as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same of the +number in the input. +2) Check that each output MIIR is a copy of the input MIIR. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the miir method properly applies history.} & Test that the result of applying the miir method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'miir'. +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the miir method properly applies history to the copy constructor.} & Test that the output can be processed back with the 'rebuild' method. +Test the constructor with a different number of inputs. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'miir'. +2) Check that the original objects are not changed by the setter function +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the miir method properly applies history to the read +MAT-file constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the history is the same as the history of the saved +object. Because save and load shouldn't add a history step. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests that the miir method properly applies history to the read +XML-file constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the history is the same as the history of the saved +object. Because save and load shouldn't add a history step. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Tests that the miir method properly applies history to the read +FIL-file constructor.} & Read the FIL file which is created from LISO. +Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to 'miir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Tests that the miir method properly applies history to the struct constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to 'miir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Tests that the miir method properly applies history to the parfrac constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to 'miir'. +2) Check the correct number of outputs. +3) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Tests that the miir method properly applies history to the pzmodel constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to 'miir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{14 } & \multirow{2}{5cm}{Tests that the miir method properly applies history to the +plist(filename) constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the save method doesn't change the input object +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{15 } & \multirow{2}{5cm}{Tests that the MIIR method properly applies history to the +plist(conn) constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'miir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{16 } & \multirow{2}{5cm}{Tests that the MIIR method properly applies history to the +plist(type) constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'miir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{17 } & \multirow{2}{5cm}{Tests that the MIIR method properly applies history to the +plist(pzmodel) constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'miir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{18 } & \multirow{2}{5cm}{Tests that the MIIR method properly applies history to the +plist(parfrac) constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'miir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{19 } & \multirow{2}{5cm}{Tests that the MIIR method properly applies history to the +plist() constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'miir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{20 } & \multirow{2}{5cm}{Tests that the MIIR method properly applies history to the a,b constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'miir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{21 } & \multirow{2}{5cm}{Tests that the MIIR method properly applies history to the +pole/zero model + plist object constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'miir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{22 } & \multirow{2}{5cm}{Tests that the MIIR method properly applies history to the +partial fraction model + plist object constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'miir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{23 } & \multirow{2}{5cm}{Tests that the MIIR method properly applies history to the conn+Id constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'miir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{24 } & \multirow{2}{5cm}{Tests that the MIIR method properly applies history to the +a + b + fs object constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'miir'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for miir/miir.} +\label{tab:miir_miir} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/ne} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the ne method works with a vector of MIIR objects as input.} & Test that the ne method works for a vector of MIIR objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the ne function. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the ne method works with a matrix of MIIR objects as input.} & Test that the ne method works for a matrix of MIIR objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the ne function. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the ne method works with a list of MIIR objects as input.} & The ne method doesn't works for a list of MIIR objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the ne method works with a mix of different shaped MIIR objects +as input.} & The ne method doesn't works for a list of MIIR objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the ne method properly applies history.} & The ne method doesn't change the MIIR object, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the ne method with an exception list. +The function miir/ne use the function miir/eq so it is not necessary to check +all possibilities of the exception list.} & Test the ne method with the exception 'name'. Use the option 'internal' to +suppress the history. It is necessary to add 'created' to the exception +list because iir is created at an other time. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the ne method with an exception list which is in a plist.} & Test that the ne method uses the exception list in a plist. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline +\caption{Unit tests for miir/ne.} +\label{tab:miir_ne} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/rebuild} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the rebuild method works with a vector of MIIR objects as input.} & Test that the rebuild method works for a vector of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the rebuild method works with a matrix of MIIR objects as input.} & Test that the rebuild method works for a matrix of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the rebuild method works with a list of MIIR objects as input.} & Test that the rebuild method works for a list of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the rebuild method works with a mix of different shaped MIIR objects +as input.} & Test that the rebuild method works with an input of matrices and vectors +and single MIIR objects. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the rebuild method properly applies history.} & The method rebuild doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Check that the rebuild method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for miir/rebuild.} +\label{tab:miir_rebuild} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/redesign} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the redesign method works with a vector of MIIR objects as input.} & Test that the redesign method works for a vector of MIIR objects as input. +To keep this UTP simple use for the vector only one filter object. The +different filters will be tested in an other UTP. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'iirvec' +2) Check that each output MIIR contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the redesign method works with a matrix of MIIR objects as input.} & Test that the redesign method works for a matrix of MIIR objects as input. +To keep this UTP simple use for the matrix only one filter object. The +different filters will be tested in an other UTP. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'iirmat' +2) Check that each output MIIR contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the redesign method works with a list of MIIR objects as input.} & Test that the redesign method works for a list of MIIR objects as input. +To keep this UTP simple use for the list only one filter object. The +different filters will be tested in an other UTP. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output MIIR contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the redesign method works with a mix of different shaped +MIIR objects as input.} & Test that the redesign method works with an input of matrices and vectors +and single MIIR objects. +To keep this UTP simple use for the vector only one filter object. The +different filters will be tested in an other UTP. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output MIIR contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the redesign method properly applies history.} & Test that the result of applying the redesign method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'redesign'. +2) Check that re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the redesign method redesigns a standard filter type.} & Tests that the redesign method redesigns a standard filter type. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check the rebuilt object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the redesign method redesigns a pzmodel filter type.} & Tests that the redesign method redesigns a pzmodel filter type. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check the rebuilt object & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests that the redesign method redesigns a parfrac filter type.} & Tests that the redesign method redesigns a parfrac filter type. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check the rebuilt object & pass \\ \hline +\caption{Unit tests for miir/redesign.} +\label{tab:miir_redesign} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/resp} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the resp method works with a vector of MIIR objects as input.} & Test that the resp method works for a vector of MIIR objects as input. +Test the method with an output and with no output (a diagram must appear) & pass \\ \cline{3-4} + & & 1) Test the right number of lines in the diagram. +2) Check that the number of elements in 'out' is the same as in 'iirv' +3) Check that each output MIIR contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the resp method works with a matrix of MIIR objects as input.} & Test that the resp method works for a matrix of MIIR objects as input. +Test the method with an output and with no output (a diagram must appear) & pass \\ \cline{3-4} + & & 1) Test the right number of lines in the diagram. +2) Check that the number of elements in 'out' is the same as in 'iirmat' +3) Check that each output MIIR contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the resp method works with a list of MIIR objects as input.} & Test that the resp method works for a list of MIIR objects as input. +Test the method with an output and with no output (a diagram must appear) & pass \\ \cline{3-4} + & & 1) Test the right number of lines in the diagram. +2) Check that the number of elements in 'out' is the same as in 'iirmat' +3) Check that each output MIIR contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the resp method works with a mix of different shaped MIIR +objects as input.} & Test that the resp method works with an input of matrices and vectors +and single MIIR objects. Test the method with an output and with no +output (a diagram must appear) & pass \\ \cline{3-4} + & & 1) Test the right number of lines in the diagram. +2) Check that the number of elements in 'out' is the same as in 'iirmat' +3) Check that each output MIIR contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the resp method properly applies history.} & Test that the result of applying the resp method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'resp'. +2) Check that re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that modify command plots the response into a diagram.} & Tests that modify command plots the response into a diagram. & pass \\ \cline{3-4} + & & 1) Check the response diagram. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the output AO of the resp method keeps the shape of the used +input f vector. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the resp method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the resp method uses the x-data of an input AO for f-vector.} & Call the method with different method to pass an AO in. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the resp method uses the specified f-vector to compute the response.} & Call the method with different method to pass an f-vector in. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Check that the resp method uses the specified f1, f2, and nf to compute the response.} & Call the method with different method to pass f1, f2, and nf in. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Check that the resp method uses the specified f1, f2, and nf to compute the response.} & Call the method with different method to pass f1, f2, and nf in. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{14 } & \multirow{2}{5cm}{Check that the resp method the response of a serial filter bank.} & Check that the resp method the response of a serial filter bank. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{15 } & \multirow{2}{5cm}{Check that the resp method the response of a parallel filter bank.} & Check that the resp method the response of a parallel filter bank. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for miir/resp.} +\label{tab:miir_resp} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/save} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the save method works with a vector of MIIR objects as input.} & Test that the save method works for a vector of MIIR objects as input. +Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the same +as in 'iirv' +2) Check that the loaded objects are the same as the saved objects. +3) The outputs 'out1' and 'out2' must be the same. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the save method works with a matrix of MIIR objects as input.} & Test that the save method works for a matrix of MIIR objects as input. +Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the same +as in 'iirm' +2) Check that the loaded objects are the same as the saved objects. +3) The outputs 'out1' and 'out2' must be the same. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the save method works with a list of MIIR objects as input.} & Test that the save method works for a list of MIIR objects as input. +Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the same +as in the list +2) Check that the loaded objects are the same as the saved objects. +3) The outputs 'out1' and 'out2' must be the same. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the save method works with a mix of different shaped MIIR objects +as input.} & Test that the save method works with an input of matrices and vectors +and single MIIR objects. Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output MIIR object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the save method properly applies history.} & Test that the result of applying the save method can be processed back +to an m-file. Do this for both extensions 'mat' and 'xml' & pass \\ \cline{3-4} + & & 1) Check that the history applies to the output object. Check that +save doesn't add a history step to the input object. +2) Check that the read object doesn't contain the save + load history steps. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the save method works with the modify command.} & Use the save method with the modifier command. & pass \\ \cline{3-4} + & & 1) Check that the save method doesn't apply the history. +2) Check the output against the input. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the save method uses the filename which is stored in a plist. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the save method with standard MIIR objects.} & Save all standard MIIR objects with both extensions. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Test the save method with MIIR object which is created from a pole/zero model} & Save MIIR object which is created from a pzmodel. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline +\caption{Unit tests for miir/save.} +\label{tab:miir_save} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/setHistin} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setHistin method works with a vector of MIIR objects as input.} & The setHistin method is not designed for vectors, for that reason must +this call fail. & pass \\ \cline{3-4} + & & 1) Nothing to check & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setHistin method works with a matrix of MIIR objects as input.} & The setHistin method is not designed for matrices, for that reason must +this call fail. & pass \\ \cline{3-4} + & & 1) Nothing to check & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setHistin method works with a list of MIIR objects as input.} & The setHistin method is not designed for input lists, for that reason must +this call fail. & pass \\ \cline{3-4} + & & 1) Nothing to check & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setHistin method works with a mix of different shaped MIIR +objects as input.} & The setHistin method is not designed for this call, for that reason must +this call fail. & pass \\ \cline{3-4} + & & 1) Nothing to check & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setHistin method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setHistin method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setHistin'. +2) Check that the last entry in the history of 'out2' NOT corresponds to +'setHistin'. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setHistin method can modify the input MIIR object.} & Test that the setHistin method can modify the input MIIR object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'iirhp' and 'ain' are now different. +2) Check that 'ain' has the correct histin field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setHistin method can set the property with a plist.} & Test that the setHistin method can modify the property 'histin' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct histin field +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for miir/setHistin.} +\label{tab:miir_setHistin} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/setHistout} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setHistout method works with a vector of MIIR objects as input.} & The setHistout should set the output history (histout) of each input. & pass \\ \cline{3-4} + & & 1) Check the histout has the correct values & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setHistout method works with a matrix of MIIR objects as input.} & The setHistout should set the output history (histout) of each input. & pass \\ \cline{3-4} + & & 1) Check the histout has the correct values & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setHistout method works with a list of MIIR objects as input.} & The setHistout should set the output history (histout) of each input. & pass \\ \cline{3-4} + & & 1) Check the histout has the correct values & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setHistout method works with a mix of different shaped MIIR +objects as input.} & The setHistout method is not designed for this call, for that reason must +this call fail. & pass \\ \cline{3-4} + & & 1) Check the histout has the correct values & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setHistout method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setHistout method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setHistout'. +2) Check that the last entry in the history of 'out2' NOT corresponds to +'setHistout'. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setHistout method can modify the input MIIR object.} & Test that the setHistout method can modify the input MIIR object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'iirhp' and 'ain' are now different. +2) Check that 'ain' has the correct histout field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setHistout method can set the property with a plist.} & Test that the setHistout method can modify the property 'histout' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct histout field +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for miir/setHistout.} +\label{tab:miir_setHistout} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/setIunits} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setIunits method works with a vector of MIIR objects as input.} & Test that the setIunits method works for a vector of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'iirv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setIunits method works with a matrix of MIIR objects as input.} & Test that the setIunits method works for a matrix of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'iirm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setIunits method works with a list of MIIR objects as input.} & Test that the setIunits method works for a list of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setIunits method works with a mix of different shaped MIIR +objects as input.} & Test that the setIunits method works with an input of matrices and vectors +and single MIIR objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setIunits method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setIunits method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setIunits'. +2) Check that the last entry in the history of 'out2' NOT corresponds to +'setIunits'. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setIunits method can modify the input MIIR object.} & Test that the setIunits method can modify the input MIIR object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'iirhp' and 'ain' are now different. +2) Check that 'ain' has the correct iunits field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setIunits method can set the property with a plist.} & Test that the setIunits method can modify the property 'iunits' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct iunits field +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setIunits method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for miir/setIunits.} +\label{tab:miir_setIunits} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/setName} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setName method works with a vector of MIIR objects as input.} & Test that the setName method works for a vector of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'iirv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setName method works with a matrix of MIIR objects as input.} & Test that the setName method works for a matrix of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'iirm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setName method works with a list of MIIR objects as input.} & Test that the setName method works for a list of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setName method works with a mix of different shaped MIIR +objects as input.} & Test that the setName method works with an input of matrices and vectors +and single MIIR objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setName method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setName method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setName'. +2) Check that the last entry in the history of 'out2' NOT corresponds to +'setName'. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setName method can modify the input MIIR object.} & Test that the setName method can modify the input MIIR object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'iirhp' and 'ain' are now different. +2) Check that 'ain' has the correct name field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setName method can set the property with a plist.} & Test that the setName method can modify the property 'name' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct name field +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setName method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for miir/setName.} +\label{tab:miir_setName} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/setOunits} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setOunits method works with a vector of MIIR objects as input.} & Test that the setOunits method works for a vector of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'iirv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setOunits method works with a matrix of MIIR objects as input.} & Test that the setOunits method works for a matrix of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'iirm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setOunits method works with a list of MIIR objects as input.} & Test that the setOunits method works for a list of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setOunits method works with a mix of different shaped MIIR +objects as input.} & Test that the setOunits method works with an input of matrices and vectors +and single MIIR objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setOunits method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setOunits method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setOunits'. +2) Check that the last entry in the history of 'out2' NOT corresponds to +'setOunits'. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setOunits method can modify the input MIIR object.} & Test that the setOunits method can modify the input MIIR object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'iirhp' and 'ain' are now different. +2) Check that 'ain' has the correct ounits field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setOunits method can set the property with a plist.} & Test that the setOunits method can modify the property 'ounits' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct ounits field +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setOunits method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for miir/setOunits.} +\label{tab:miir_setOunits} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/string} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the string method works with a vector of MIIR objects as input.} & Test that the string method works for a vector of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the string method works with a matrix of MIIR objects as input.} & Test that the string method works for a matrix of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the string method works with a list of MIIR objects as input.} & Test that the string method works for a list of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the string method works with a mix of different shaped MIIR objects +as input.} & Test that the string method works with an input of matrices and vectors +and single MIIR objects. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the string method properly applies history.} & The method string doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the string method doesn't work if the MIIR object have more +than one history step.} & The method string throws an error because the input object have more than +one history step. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for miir/string.} +\label{tab:miir_string} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf miir/type} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the type method works with a vector of MIIR objects as input.} & Test that the type method works for a vector of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the type method works with a matrix of MIIR objects as input.} & Test that the type method works for a matrix of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the type method works with a list of MIIR objects as input.} & Test that the type method works for a list of MIIR objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the type method works with a mix of different shaped MIIR objects +as input.} & Test that the type method works with an input of matrices and vectors +and single MIIR objects. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the type method properly applies history.} & The method type doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for miir/type.} +\label{tab:miir_type} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/char} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the char method works with a vector of PARFRAC objects as input.} & Test that the char method works for a vector of PARFRAC objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the char method works with a matrix of PARFRAC objects as input.} & Test that the char method works for a matrix of PARFRAC objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the char method works with a list of PARFRAC objects as input.} & Test that the char method works for a list of PARFRAC objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the char method works with a mix of different shaped PARFRAC objects +as input.} & Test that the char method works with an input of matrices and vectors +and single PARFRAC objects. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the char method properly applies history.} & The method char doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for parfrac/char.} +\label{tab:parfrac_char} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/copy} &&& \\ \hline +\endhead + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline +\caption{Unit tests for parfrac/copy.} +\label{tab:parfrac_copy} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/created} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the created method works with a vector of PARFRAC objects as +input.} & Test that the created method works for a vector of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pfv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the created method works with a matrix of PARFRAC objects as +input.} & Test that the created method works for a matrix of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pfm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the created method works with a list of PARFRAC objects as +input.} & Test that the created method works for a list of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the created method works with a mix of different shaped +PARFRAC objects as input.} & Test that the created method works with an input of matrices and +vectors and single PARFRAC objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the created method properly applies history} & This method doesn't change the input object, thus no history is added +to the object. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the created method can be used with the modify command.} & Tests that the created method can be used with the modify command. & pass \\ \cline{3-4} + & & 1) Check the single object +2) Check the matrix object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the created method retruns always a well defined time object +even for an empty input object.} & Test that the created method with an empty 'PARFRAC object & pass \\ \cline{3-4} + & & 1) Check that the output is a time object with a ell defined time. & pass \\ \hline +\caption{Unit tests for parfrac/created.} +\label{tab:parfrac_created} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/creator} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the creator method works with a vector of PARFRAC objects as +input.} & Test that the creator method works for a vector of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pfv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the creator method works with a matrix of PARFRAC objects as +input.} & Test that the creator method works for a matrix of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pfm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the creator method works with a list of PARFRAC objects as +input.} & The creator method doesn't work for a list of PARFRAC objects as input. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the creator method works with a mix of different shaped +PARFRAC objects as input.} & The creator method doesn't work with different shaped input objects. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the creator method properly applies history} & This method doesn't change the input object, thus no history is added +to the object. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the creator method can be used with the modify command.} & Tests that the creator method can be used with the modify command. & pass \\ \cline{3-4} + & & 1) Check the single object +2) Check the matrix object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the creator method retruns all creator(s)/modifier(s) which +are in the history.} & Test that the creator method uses the option 'all' direct or in a +plist. The test file must have the modifier 'first', 'second' and +'third' & pass \\ \cline{3-4} + & & 1) Check that out1 contains only one creator +2) Check that out2 contain more creator/modifier & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests the negative case for the option 'all'.} & Test that the creator method throws an error if the option 'all' is +used in connection with a matrix/vector of PARFRAC objects. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline +\caption{Unit tests for parfrac/creator.} +\label{tab:parfrac_creator} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/display} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the display method works with a vector of PARFRAC objects as +input.} & Test that the display method works for a vector of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the display method works with a matrix of PARFRAC objects as +input.} & Test that the display method works for a matrix of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the display method works with a list of PARFRAC objects as +input.} & Test that the display method works for a list of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the display method works with a mix of different shaped +PARFRAC objects as input.} & Test that the display method works with an input of matrices and +vectors and single PARFRAC objects as. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the display method properly applies history.} & The method display doesn't change the data, thus it is not possible +to check the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for parfrac/display.} +\label{tab:parfrac_display} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/eq} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the eq method works with a vector of PARFRAC objects as input.} & Test that the eq method works for a vector of PARFRAC objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the eq function. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the eq method works with a matrix of PARFRAC objects as input.} & Test that the eq method works for a matrix of PARFRAC objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the eq function. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the eq method works with a list of PARFRAC objects as input.} & The eq method doesn't works for a list of PARFRAC objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the eq method works with a mix of different shaped PARFRAC objects +as input.} & The eq method doesn't works for a list of PARFRAC objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the eq method properly applies history.} & The eq method doesn't change the PARFRAC object, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception +list with properties where a public set method exist.} & Test the eq method with the exception 'name'. Use the option +'internal' to suppress the history. It is necessary to add 'created' +to the exception list because 'pa' is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'iunits'. Use the option 'internal' +to suppress the history. It is necessary to add 'created' to the exception +list because 'pa' is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception +list with properties where a public set method exist.} & Test the eq method with the exception 'ounits'. Use the option +'internal' to suppress the history. It is necessary to add 'created' +to the exception list because 'pa' is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Test the eq method with an exception list which is in a plist.} & Test that the eq method uses the exception list in a plist. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline +\caption{Unit tests for parfrac/eq.} +\label{tab:parfrac_eq} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/get} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests the get method of the parfrac class.} & Test that the get returns returns the value of the specified +property. Do this for all properties of the PARFRAC object. & pass \\ \cline{3-4} + & & 1) Check the correct value of the output & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the get method works with a plist.} & Test that the get returns returns the value of the specified +property which is defined in a plist. & pass \\ \cline{3-4} + & & 1) Check the correct value of the output & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests the get method of the parfrac class.} & Test that the get throws an error if the input are more than +one PARFRAC object. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline +\caption{Unit tests for parfrac/get.} +\label{tab:parfrac_get} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/getlowerFreq} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests the getlowerFreq method of the parfrac class.} & Test that the getlowerFreq returns the lowest frequence of the pole +in the parfrac object. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests the getlowerFreq method of the parfrac class.} & Test that the getlowerFreq throws an error if the input are more than +one parfrac. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline +\caption{Unit tests for parfrac/getlowerFreq.} +\label{tab:parfrac_getlowerFreq} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/getupperFreq} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests the getupperFreq method of the parfrac class.} & Test that the getupperFreq returns the lowest frequence of the pole +in the parfrac object. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests the getupperFreq method of the parfrac class.} & Test that the getupperFreq throws an error if the input are more than +one parfrac. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline +\caption{Unit tests for parfrac/getupperFreq.} +\label{tab:parfrac_getupperFreq} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/index} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the index method works with a vector of PARFRAC objects as +input.} & Test that the index method works for a vector of PARFRAC objects as +input. The following indexing should work: +I = [ 1 2 3 ] or (I/J) = [(1,1), (1,2), (1,3)] & pass \\ \cline{3-4} + & & 1) Check that the index method selects the correct object. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the index method works with a matrix of PARFRAC objects as +input.} & Test that the index method works for a matrix of PARFRAC objects as +input. The following indexing should work: +I = [ 1 3 5 ] or (I/J) = [(1,1), (1,2), (1,3)] +[ 2 4 6 ] [(2,1), (2,2), (2,3)] & pass \\ \cline{3-4} + & & 1) Check that the index method selects the correct object. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the index method works with a list of PARFRAC objects as +input.} & The index method doesn't work for a list of PARFRAC objects as input. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the index method properly applies history.} & Test that the result of index have an additional history step. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds +to 'index'. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the index method works for the modifier command.} & Tests that the index method works for the modifier command. & pass \\ \cline{3-4} + & & 1) Check that the history-plist contains the used indices. +2) Check that the index method selects the correct object & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the index method can be controled with a plist. & pass \\ \cline{3-4} + & & 1) Check that the history-plist contains the used indices. +2) Check that the index method selects the correct object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the index method selects more objects if I have more indices.} & Test that the index method selects more objects if I have more indices. & pass \\ \cline{3-4} + & & 1) Check that the history-plist contains the used indices. +2) Check that the index method selects the correct object & pass \\ \hline +\caption{Unit tests for parfrac/index.} +\label{tab:parfrac_index} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/isprop} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the isprop method works with a vector of PARFRAC objects as +input.} & Test that the isprop method works for a vector of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pfv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the isprop method works with a matrix of PARFRAC objects as +input.} & Test that the isprop method works for a matrix of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pfm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the isprop method works with a list of PARFRAC objects as +input.} & Test that the isprop method works for a list of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the isprop method works with a mix of different shaped +PARFRAC objects as input.} & Test that the isprop method works with an input of matrices and +vectors and single PARFRAC objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the isprop method properly applies history.} & The method isprop doesn't change the object, thus it is not necessary +to apply history. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the isprop method works for each property.} & Test that the isprop method works for the properties: +'res', 'poles', 'pmul', 'dir', 'iunits', 'ounits', 'hist', +'name' & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the negative case and the not function command.} & Test that the isprop method retrun false for a unknown property and +for methods of the object. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline +\caption{Unit tests for parfrac/isprop.} +\label{tab:parfrac_isprop} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/loadobj} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check the shape of the loaded objects. & pass \\ \hline +\caption{Unit tests for parfrac/loadobj.} +\label{tab:parfrac_loadobj} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/ne} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the ne method works with a vector of PARFRAC objects as input.} & Test that the ne method works for a vector of PARFRAC objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the ne function. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the ne method works with a matrix of PARFRAC objects as input.} & Test that the ne method works for a matrix of PARFRAC objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the ne function. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the ne method works with a list of PARFRAC objects as input.} & The ne method doesn't works for a list of PARFRAC objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the ne method works with a mix of different shaped PARFRAC +objects as input.} & The ne method doesn't works for a list of PARFRAC objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the ne method properly applies history.} & The ne method doesn't change the PARFRAC object, thus will no history +added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the ne method with an exception list. +The function parfrac/ne use the function parfrac/eq so it is not +necessary to check all possibilities of the exception list.} & Test the ne method with the exception 'name'. Use the option +'internal' to suppress the history. It is necessary to add 'created' +to the exception list because pf is created at an other time. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the ne method with an exception list which is in a plist.} & Test that the ne method uses the exception list in a plist. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline +\caption{Unit tests for parfrac/ne.} +\label{tab:parfrac_ne} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/parfrac} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the parfrac method works with a vector of PARFRAC objects as +input.} & Test that the parfrac method works with a vector of PARFRAC objects +as input. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output PARFRACs is the same as the +input shape. +2) Check that each output PARFRAC is a copy of the input PARFRAC. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the parfrac method works with a matrix of PARFRAC objects as +input.} & Test that the parfrac method works with a matrix of PARFRAC objects +as input. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output PARFRACs is the same as the +input shape. +2) Check that each output PARFRAC is a copy of the input PARFRAC. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the parfrac method works with a list of PARFRAC objects as +input.} & Test that the parfrac method works with a list of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same of the +number in the input. +2) Check that each output PARFRAC is a copy of the input PARFRAC. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the parfrac method works with a mix of different shaped +PARFRACs as input.} & Test that the parfrac method works with a mix of different shaped +PARFRACs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same of the +number in the input. +2) Check that each output PARFRAC is a copy of the input PARFRAC. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the parfrac method properly applies history.} & Test that the result of applying the parfrac method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'parfrac'. +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the parfrac method properly applies history to the copy +constructor.} & Test that the output can be processed back with the 'rebuild' method. +Test the constructor with a different number of inputs. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'parfrac'. +2) Check that the original objects are not changed by the setter +function +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the parfrac method properly applies history to the read +MAT-file constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the loaded object is the same as the saved object. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests that the parfrac method properly applies history to the read +XML-file constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the loaded object is the same as the saved object. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Tests that the parfrac method properly doesn't apply history to the +struct constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to 'parfrac'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Tests that the parfrac method properly applies history to the rational +constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'parfrac'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Tests that the parfrac method properly applies history to the pzmodel +constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'parfrac'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Tests that the parfrac method properly applies history to the +plist(filename) constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the save method doesn't change the input object +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{14 } & \multirow{2}{5cm}{Tests that the PARFRAC method properly applies history to the +plist(conn) constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'parfrac'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{15 } & \multirow{2}{5cm}{Tests that the PARFRAC method properly applies history to the +plist(res || poles || dir) constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'parfrac'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{16 } & \multirow{2}{5cm}{Tests that the PARFRAC method properly applies history to the +plist(pzmodel) constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'parfrac'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{17 } & \multirow{2}{5cm}{Tests that the PARFRAC method properly applies history to the +plist(parfrac) constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'parfrac'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{18 } & \multirow{2}{5cm}{Tests that the PARFRAC method properly applies history to the +plist() constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'parfrac'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{19 } & \multirow{2}{5cm}{Tests that the PARFRAC method properly applies history to the conn+Id +constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'parfrac'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{20 } & \multirow{2}{5cm}{Tests that the PARFRAC method properly applies history to the +res + poles + direct terms object constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'parfrac'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{21 } & \multirow{2}{5cm}{Tests that the PARFRAC method properly applies history to the +res + poles + direct terms + name object constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'parfrac'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{22 } & \multirow{2}{5cm}{Tests that the PARFRAC method properly applies history to the +res + poles + direct terms + name + iunits + ounits object constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'parfrac'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for parfrac/parfrac.} +\label{tab:parfrac_parfrac} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/rebuild} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the rebuild method works with a vector of PARFRAC objects as +input.} & Test that the rebuild method works for a vector of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the rebuild method works with a matrix of PARFRAC objects as +input.} & Test that the rebuild method works for a matrix of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the rebuild method works with a list of PARFRAC objects as +input.} & Test that the rebuild method works for a list of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the rebuild method works with a mix of different shaped +PARFRAC objects as input.} & Test that the rebuild method works with an input of matrices and +vectors and single PARFRAC objects. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the rebuild method properly applies history.} & The method rebuild doesn't change the data, thus it is not possible +to check the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Check that the rebuild method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for parfrac/rebuild.} +\label{tab:parfrac_rebuild} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/resp} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the resp method works with a vector of PARFRAC objects as +input.} & Test that the resp method works for a vector of PARFRAC objects as +input. Test the method with an output and with no output +(a diagram must appear) & pass \\ \cline{3-4} + & & 1) Test the right number of lines in the diagram. +2) Check that the number of elements in 'out' is the same as in 'pfv' +3) Check that each output PARFRAC contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the resp method works with a matrix of PARFRAC objects as +input.} & Tests that the resp method works with a matrix of PARFRAC objects as +input. Test the method with an output and with no output +(a diagram must appear) & pass \\ \cline{3-4} + & & 1) Test the right number of lines in the diagram. +2) Check that the number of elements in 'out' is the same as in 'pfm' +3) Check that each output PARFRAC contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the resp method works with a list of PARFRAC objects as +input.} & Tests that the resp method works with a list of PARFRAC objects as +input. Test the method with an output and with no output +(a diagram must appear) & pass \\ \cline{3-4} + & & 1) Test the right number of lines in the diagram. +2) Check that the number of elements in 'out' is the same as in 'rain' +3) Check that each output PARFRAC contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the resp method works with a mix of different shaped +PARFRAC objects as input.} & Tests that the resp method works with a mix of different shaped +PARFRAC objects as input. Test the method with an output and with no +output (a diagram must appear) & pass \\ \cline{3-4} + & & 1) Test the right number of lines in the diagram. +2) Check that the number of elements in 'out' is the same as in 'rain' +3) Check that each output PARFRAC contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the resp method properly applies history.} & Test that the result of applying the resp method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'resp'. +2) Check that re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that modify command plots the response into a diagram.} & Tests that modify command plots the response into a diagram. & pass \\ \cline{3-4} + & & 1) Check the response diagram. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the output AO of the resp method keeps the shape of the used +input f vector. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the resp method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single +output variable. Additionaly check that the rebuild method works on +the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the resp method uses the x-data of an input AO for f-vector.} & Call the method with different method to pass an AO in. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the resp method uses the specified f-vector to compute the +response.} & Call the method with different method to pass an f-vector in. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Check that the resp method uses the specified f1, f2, and nf to compute the response.} & Call the method with different method to pass f1, f2, and nf in. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Check that the resp method uses the specified f1, f2, and nf to compute +the response.} & Call the method with different method to pass f1, f2, and nf in. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for parfrac/resp.} +\label{tab:parfrac_resp} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/save} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the save method works with a vector of PARFRAC objects as input.} & Test that the save method works for a vector of PARFRAC objects as input. +Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the +same as in 'pfv' +2) Check that the loaded objects are the same as the saved objects. +3) The outputs 'out1' and 'out2' must be the same. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the save method works with a matrix of PARFRAC objects as +input.} & Test that the save method works for a matrix of PARFRAC objects as +input. Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the +same as in 'pfm' +2) Check that the loaded objects are the same as the saved objects. +3) The outputs 'out1' and 'out2' must be the same. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the save method works with a list of PARFRAC objects as input.} & Test that the save method works for a list of PARFRAC objects as input. +Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the +same as in the list +2) Check that the loaded objects are the same as the saved objects. +3) The outputs 'out1' and 'out2' must be the same. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the save method works with a mix of different shaped PARFRAC +objects as input.} & Test that the save method works with an input of matrices and vectors +and single PARFRAC objects. Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output PARFRAC object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the save method properly applies history.} & Test that the result of applying the save method can be processed back +to an m-file. Do this for both extensions 'mat' and 'xml' & pass \\ \cline{3-4} + & & 1) Check that the history applies to the output object. Check that +save doesn't add a history step to the input object. +2) Check that the read object doesn't contain the save + load history steps. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the save method works with the modify command.} & Use the save method with the modifier command. & pass \\ \cline{3-4} + & & 1) Check that the save method doesn't apply the history. +2) Check the output against the input. +3) Check the history of the output against the input. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the save method uses the filename which is stored in a plist. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the save method with different complex PARFRAC objects} & Test the save method with different complex PARFRAC objects & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline +\caption{Unit tests for parfrac/save.} +\label{tab:parfrac_save} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/setIunits} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setIunits method works with a vector of PARFRAC objects +as input.} & Test that the setIunits method works for a vector of PARFRAC objects +as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pfv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setIunits method works with a matrix of PARFRAC objects +as input.} & Test that the setIunits method works for a matrix of PARFRAC objects +as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pfm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setIunits method works with a list of PARFRAC objects as +input.} & Test that the setIunits method works for a list of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setIunits method works with a mix of different shaped +PARFRAC objects as input.} & Test that the setIunits method works with an input of matrices and +vectors and single PARFRAC objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setIunits method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setIunits method can be +processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setIunits'. +2) Check that the last entry in the history of 'out2' NOT corresponds to +'setIunits'. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setIunits method can modify the input PARFRAC object.} & Test that the setIunits method can modify the input PARFRAC object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'pf3' and 'ain' are now different. +2) Check that 'ain' has the correct iunits field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setIunits method can set the property with a plist.} & Test that the setIunits method can modify the property 'iunits' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct iunits field +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setIunits method pass back the output objects to a list +of output variables or to a single variable.} & Call the method with a list of output variables and with a single +output variable. Additionaly check that the rebuild method works on +the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for parfrac/setIunits.} +\label{tab:parfrac_setIunits} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/setName} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setName method works with a vector of PARFRAC objects as +input.} & Test that the setName method works for a vector of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pfv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setName method works with a matrix of PARFRAC objects as +input.} & Test that the setName method works for a matrix of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pfm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setName method works with a list of PARFRAC objects as +input.} & Test that the setName method works for a list of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setName method works with a mix of different shaped +PARFRAC objects as input.} & Test that the setName method works with an input of matrices and +vectors and single PARFRAC objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setName method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setName method can be processed +back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setName'. +2) Check that the last entry in the history of 'out2' NOT corresponds to +'setName'. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setName method can modify the input PARFRAC object.} & Test that the setName method can modify the input PARFRAC object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'pf3' and 'ain' are now different. +2) Check that 'ain' has the correct name field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setName method can set the property with a plist.} & Test that the setName method can modify the property 'name' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct name field +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setName method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single +output variable. Additionaly check that the rebuild method works on +the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for parfrac/setName.} +\label{tab:parfrac_setName} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/setOunits} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setOunits method works with a vector of PARFRAC objects +as input.} & Test that the setOunits method works for a vector of PARFRAC objects +as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pfv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setOunits method works with a matrix of PARFRAC objects +as input.} & Test that the setOunits method works for a matrix of PARFRAC objects +as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pfm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setOunits method works with a list of PARFRAC objects as +input.} & Test that the setOunits method works for a list of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setOunits method works with a mix of different shaped +PARFRAC objects as input.} & Test that the setOunits method works with an input of matrices and +vectors and single PARFRAC objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setOunits method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setOunits method can be +processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setOunits'. +2) Check that the last entry in the history of 'out2' NOT corresponds to +'setOunits'. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setOunits method can modify the input PARFRAC object.} & Test that the setOunits method can modify the input PARFRAC object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'pf3' and 'ain' are now different. +2) Check that 'ain' has the correct ounits field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setOunits method can set the property with a plist.} & Test that the setOunits method can modify the property 'ounits' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct ounits field +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setOunits method pass back the output objects to a list +of output variables or to a single variable.} & Call the method with a list of output variables and with a single +output variable. Additionaly check that the rebuild method works on +the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for parfrac/setOunits.} +\label{tab:parfrac_setOunits} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/string} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the string method works with a vector of PARFRAC objects as +input.} & Test that the string method works for a vector of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the string method works with a matrix of PARFRAC objects as +input.} & Test that the string method works for a matrix of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the string method works with a list of PARFRAC objects as +input.} & Test that the string method works for a list of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the string method works with a mix of different shaped +PARFRAC objects as input.} & Test that the string method works with an input of matrices and +vectors and single PARFRAC objects. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the string method properly applies history.} & The method string doesn't change the data, thus it is not possible to +check the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the string method doesn't work if the PARFRAC object have +more than one history step.} & The method string throws an error because the input object have more +than one history step. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for parfrac/string.} +\label{tab:parfrac_string} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf parfrac/type} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the type method works with a vector of PARFRAC objects as +input.} & Test that the type method works for a vector of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the type method works with a matrix of PARFRAC objects as +input.} & Test that the type method works for a matrix of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the type method works with a list of PARFRAC objects as +input.} & Test that the type method works for a list of PARFRAC objects as +input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the type method works with a mix of different shaped PARFRAC +objects as input.} & Test that the type method works with an input of matrices and vectors +and single PARFRAC objects. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the type method properly applies history.} & The method type doesn't change the data, thus it is not possible to +check the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for parfrac/type.} +\label{tab:parfrac_type} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pest/copy} &&& \\ \hline +\endhead + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline +\caption{Unit tests for pest/copy.} +\label{tab:pest_copy} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pest/loadobj} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check the shape of the loaded objects. & pass \\ \hline +\caption{Unit tests for pest/loadobj.} +\label{tab:pest_loadobj} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pest/pest} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [pest/pest] method works with a vector of objects as input.} & Test that the [pest/pest] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [pest/pest] method works with a matrix of objects as input.} & Test that the [pest/pest] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [pest/pest] method works with a list of objects as input.} & Test that the [pest/pest] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [pest/pest] method works with a mix of different arrays of objects as input.} & Tests that the [pest/pest] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [pest/pest] method properly applies history.} & Test that the result of applying the [pest/pest] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[pest/pest]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{60 } & \multirow{2}{5cm}{Tests that the constructor method doesn't apply history to the read +MAT-file constructor.} & Tests that the constructor method doesn't apply history to the read +MAT-file constructor. & pass \\ \cline{3-4} + & & 1) Check that the history is the same as the history of the saved +object. Because save and load shouldn't add a history step. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{61 } & \multirow{2}{5cm}{Tests that the constructor properly applies history to the read +XML-file constructor.} & Tests that the constructor properly applies history to the read +XML-file constructor. & pass \\ \cline{3-4} + & & 1) Check that the history is the same as the history of the saved +object. Because save and load shouldn't add a history step. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{62 } & \multirow{2}{5cm}{Tests that the constructor properly applies history in the struct constructor.} & Tests that the constructor properly applies history in the struct constructor. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to the class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{64 } & \multirow{2}{5cm}{Tests that the contructor properly applies history to the +plist(filename) constructor.} & Tests that the contructor properly applies history to the +plist(filename) constructor. & pass \\ \cline{3-4} + & & 1) Check that the save method doesn't change the input object +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{65 } & \multirow{2}{5cm}{Tests that the contructed object can be submitted and retrieved.} & Tests that the contructed object can be submitted and retrieved. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +the class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{68 } & \multirow{2}{5cm}{Tests that the constructor properly applies history to the conn+Id constructor.} & Tests that the constructor properly applies history to the conn+Id +constructor. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for pest/pest.} +\label{tab:pest_pest} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pest/setChain} &&& \\ \hline +\endhead + \multirow{2}{3cm}{minfo } & \multirow{2}{5cm}{Tests that the getInfo call works for this a general setter method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setChain] method works for a list of objects as input.} & Tests that the [pest/setChain] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setChain] method works for a list of objects as input.} & Tests that the [pest/setChain] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setChain] method works for a list of objects as input.} & Tests that the [pest/setChain] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [pest/setChain] method properly applies history.} & Test that the result of applying the [pest/setChain] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[pest/setChain]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [pest/setChain] method can modify the input AO.} & Test that the [pest/setChain] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [pest/setChain] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for pest/setChain.} +\label{tab:pest_setChain} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pest/setChi2} &&& \\ \hline +\endhead + \multirow{2}{3cm}{minfo } & \multirow{2}{5cm}{Tests that the getInfo call works for this a general setter method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setChi2] method works for a list of objects as input.} & Tests that the [pest/setChi2] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setChi2] method works for a list of objects as input.} & Tests that the [pest/setChi2] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setChi2] method works for a list of objects as input.} & Tests that the [pest/setChi2] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [pest/setChi2] method properly applies history.} & Test that the result of applying the [pest/setChi2] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[pest/setChi2]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [pest/setChi2] method can modify the input AO.} & Test that the [pest/setChi2] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [pest/setChi2] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for pest/setChi2.} +\label{tab:pest_setChi2} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pest/setCorr} &&& \\ \hline +\endhead + \multirow{2}{3cm}{minfo } & \multirow{2}{5cm}{Tests that the getInfo call works for this a general setter method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setCorr] method works for a list of objects as input.} & Tests that the [pest/setCorr] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setCorr] method works for a list of objects as input.} & Tests that the [pest/setCorr] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setCorr] method works for a list of objects as input.} & Tests that the [pest/setCorr] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [pest/setCorr] method properly applies history.} & Test that the result of applying the [pest/setCorr] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[pest/setCorr]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [pest/setCorr] method can modify the input AO.} & Test that the [pest/setCorr] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [pest/setCorr] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for pest/setCorr.} +\label{tab:pest_setCorr} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pest/setCov} &&& \\ \hline +\endhead + \multirow{2}{3cm}{minfo } & \multirow{2}{5cm}{Tests that the getInfo call works for this a general setter method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setCov] method works for a list of objects as input.} & Tests that the [pest/setCov] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setCov] method works for a list of objects as input.} & Tests that the [pest/setCov] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setCov] method works for a list of objects as input.} & Tests that the [pest/setCov] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [pest/setCov] method properly applies history.} & Test that the result of applying the [pest/setCov] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[pest/setCov]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [pest/setCov] method can modify the input AO.} & Test that the [pest/setCov] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [pest/setCov] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for pest/setCov.} +\label{tab:pest_setCov} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pest/setDof} &&& \\ \hline +\endhead + \multirow{2}{3cm}{minfo } & \multirow{2}{5cm}{Tests that the getInfo call works for this a general setter method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setDof] method works for a list of objects as input.} & Tests that the [pest/setDof] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setDof] method works for a list of objects as input.} & Tests that the [pest/setDof] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setDof] method works for a list of objects as input.} & Tests that the [pest/setDof] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [pest/setDof] method properly applies history.} & Test that the result of applying the [pest/setDof] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[pest/setDof]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [pest/setDof] method can modify the input AO.} & Test that the [pest/setDof] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [pest/setDof] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for pest/setDof.} +\label{tab:pest_setDof} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pest/setDy} &&& \\ \hline +\endhead + \multirow{2}{3cm}{minfo } & \multirow{2}{5cm}{Tests that the getInfo call works for this a general setter method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setDy] method works for a list of objects as input.} & Tests that the [pest/setDy] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setDy] method works for a list of objects as input.} & Tests that the [pest/setDy] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setDy] method works for a list of objects as input.} & Tests that the [pest/setDy] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [pest/setDy] method properly applies history.} & Test that the result of applying the [pest/setDy] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[pest/setDy]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [pest/setDy] method can modify the input AO.} & Test that the [pest/setDy] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [pest/setDy] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for pest/setDy.} +\label{tab:pest_setDy} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pest/setModels} &&& \\ \hline +\endhead + \multirow{2}{3cm}{minfo } & \multirow{2}{5cm}{Tests that the getInfo call works for this a general setter method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setModels] method works for a list of objects as input.} & Tests that the [pest/setModels] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setModels] method works for a list of objects as input.} & Tests that the [pest/setModels] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setModels] method works for a list of objects as input.} & Tests that the [pest/setModels] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [pest/setModels] method properly applies history.} & Test that the result of applying the [pest/setModels] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[pest/setModels]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [pest/setModels] method can modify the input AO.} & Test that the [pest/setModels] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [pest/setModels] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for pest/setModels.} +\label{tab:pest_setModels} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pest/setNames} &&& \\ \hline +\endhead + \multirow{2}{3cm}{minfo } & \multirow{2}{5cm}{Tests that the getInfo call works for this a general setter method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setNames] method works for a list of objects as input.} & Tests that the [pest/setNames] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setNames] method works for a list of objects as input.} & Tests that the [pest/setNames] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setNames] method works for a list of objects as input.} & Tests that the [pest/setNames] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [pest/setNames] method properly applies history.} & Test that the result of applying the [pest/setNames] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[pest/setNames]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [pest/setNames] method can modify the input AO.} & Test that the [pest/setNames] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [pest/setNames] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for pest/setNames.} +\label{tab:pest_setNames} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pest/setPdf} &&& \\ \hline +\endhead + \multirow{2}{3cm}{minfo } & \multirow{2}{5cm}{Tests that the getInfo call works for this a general setter method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setPdf] method works for a list of objects as input.} & Tests that the [pest/setPdf] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setPdf] method works for a list of objects as input.} & Tests that the [pest/setPdf] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setPdf] method works for a list of objects as input.} & Tests that the [pest/setPdf] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [pest/setPdf] method properly applies history.} & Test that the result of applying the [pest/setPdf] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[pest/setPdf]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [pest/setPdf] method can modify the input AO.} & Test that the [pest/setPdf] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [pest/setPdf] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for pest/setPdf.} +\label{tab:pest_setPdf} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pest/setY} &&& \\ \hline +\endhead + \multirow{2}{3cm}{minfo } & \multirow{2}{5cm}{Tests that the getInfo call works for this a general setter method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setY] method works for a list of objects as input.} & Tests that the [pest/setY] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setY] method works for a list of objects as input.} & Tests that the [pest/setY] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setY] method works for a list of objects as input.} & Tests that the [pest/setY] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [pest/setY] method properly applies history.} & Test that the result of applying the [pest/setY] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[pest/setY]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [pest/setY] method can modify the input AO.} & Test that the [pest/setY] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [pest/setY] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for pest/setY.} +\label{tab:pest_setY} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pest/setYunits} &&& \\ \hline +\endhead + \multirow{2}{3cm}{minfo } & \multirow{2}{5cm}{Tests that the getInfo call works for this a general setter method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShapeInternal } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setYunits] method works for a list of objects as input.} & Tests that the [pest/setYunits] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setYunits] method works for a list of objects as input.} & Tests that the [pest/setYunits] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [pest/setYunits] method works for a list of objects as input.} & Tests that the [pest/setYunits] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [pest/setYunits] method properly applies history.} & Test that the result of applying the [pest/setYunits] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[pest/setYunits]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [pest/setYunits] method can modify the input AO.} & Test that the [pest/setYunits] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [pest/setYunits] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for pest/setYunits.} +\label{tab:pest_setYunits} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf plist/append} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the append method works with a vector of PLIST objects as input.} & Test that the append method appends all input PLIST objects to one object. & pass \\ \cline{3-4} + & & 1) Check that the output is one PLIST object. +2) Check that the output PLIST contains all key/value pairs. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the append method works with a matrix of PLIST objects as input.} & Test that the append method appends all input PLIST objects to one object. & pass \\ \cline{3-4} + & & 1) Check that the output is one PLIST object. +2) Check that the output PLIST contains all key/value pairs. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the append method works with a list of PLIST objects as input.} & Test that the append method appends all input PLIST objects to one object. & pass \\ \cline{3-4} + & & 1) Check that the output is one PLIST object. +2) Check that the output PLIST contains all key/value pairs. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the append method works with a mix of different shaped PLIST +objects as input.} & Test that the append method appends all input PLIST objects to one object. & pass \\ \cline{3-4} + & & 1) Check that the output is one PLIST object. +2) Check that the output PLIST contains all key/value pairs. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the append method applies the modify command} & Test that the append method can modify the input PLIST by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'pl1' and 'plin' are now different. +2) Check that 'ain' append the key/value pair. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the append method with different input variants for the key/value pair.} & Test that the append method accepts plists-objects, param-objects or +direct key/value pairs as an input. & pass \\ \cline{3-4} + & & 1) Check that the output have all key/value pairs. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the append method appends the key always in capital letter} & Test that the append method appends the key always in capital letter & pass \\ \cline{3-4} + & & 1) Check that the key is in capital letters & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the append method in a negative case.} & The append method throwns an error if a user tries to append a key +which already exist. & pass \\ \cline{3-4} + & & 1) Check that the negative case doesn't change the input object. & pass \\ \hline +\caption{Unit tests for plist/append.} +\label{tab:plist_append} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf plist/char} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the char method works with a vector of PLIST objects as input.} & Test that the char method works for a vector of PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the char method works with a matrix of PLIST objects as input.} & Test that the char method works for a matrix of PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the char method works with a list of PLIST objects as input.} & Test that the char method works for a list of PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the char method works with a mix of different shaped PLIST objects +as input.} & Test that the char method works with an input of matrices and vectors +and single PLIST objects. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline +\caption{Unit tests for plist/char.} +\label{tab:plist_char} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf plist/combine} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the combine method works with a vector of PLIST objects as input.} & Test that the combine method combines all input PLIST objects to one object. & pass \\ \cline{3-4} + & & 1) Check that the output is one PLIST object. +2) Check that the output PLIST contains all key/value pairs. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the combine method works with a matrix of PLIST objects as input.} & Test that the combine method combines all input PLIST objects to one object. & pass \\ \cline{3-4} + & & 1) Check that the output is one PLIST object. +2) Check that the output PLIST contains all key/value pairs. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the combine method works with a list of PLIST objects as input.} & Test that the combine method combines all input PLIST objects to one object. & pass \\ \cline{3-4} + & & 1) Check that the output is one PLIST object. +2) Check that the output PLIST contains all key/value pairs. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the combine method works with a mix of different shaped PLIST +objects as input.} & Test that the combine method combines all input PLIST objects to one object. & pass \\ \cline{3-4} + & & 1) Check that the output is one PLIST object. +2) Check that the output PLIST contains all key/value pairs. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the combine method applies the modify command} & Test that the combine method can modify the input PLIST by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'pl1' and 'plin' are now different. +2) Check that 'ain' combine the key/value pair. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the combine method doen't overwrite existing keys.} & Duplicate parameters which are given priority in the order in which +they appear in the input. & pass \\ \cline{3-4} + & & 1) Check that the output have all key/value pairs in the order they +appear. & pass \\ \hline +\caption{Unit tests for plist/combine.} +\label{tab:plist_combine} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf plist/copy} &&& \\ \hline +\endhead + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline +\caption{Unit tests for plist/copy.} +\label{tab:plist_copy} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf plist/display} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the display method works with a vector of PLIST objects as input.} & Test that the display method works for a vector of PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the display method works with a matrix of PLIST objects as input.} & Test that the display method works for a matrix of PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the display method works with a list of PLIST objects as input.} & Test that the display method works for a list of PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the display method works with a mix of different shaped +PLIST objects as input.} & Test that the display method works with an input of matrices and vectors +and single PLIST objects as. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline +\caption{Unit tests for plist/display.} +\label{tab:plist_display} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf plist/eq} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the eq method works with a vector of PLIST objects as input.} & Test that the eq method works for a vector of PLIST objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the eq function. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the eq method works with a matrix of PLIST objects as input.} & Test that the eq method works for a matrix of PLIST objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the eq function. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the eq method works with a list of PLIST objects as input.} & The eq method doesn't works for a list of PLIST objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the eq method works with a mix of different shaped PLIST objects +as input.} & The eq method doesn't works for a list of PLIST objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'name'. It is necessary to add +'created' to the exception list because pl is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the eq method with an exception list which is in a plist.} & Test that the eq method uses the exception list in a plist. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline +\caption{Unit tests for plist/eq.} +\label{tab:plist_eq} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf plist/find} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the find method applies the modify command.} & Test that it is possible to use modify command and show that this +method ignoring case. & pass \\ \cline{3-4} + & & 1) Check that out1..3 have all the same object. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Test that the find method accepts a plist.} & Test that the find method take the 'key' from a 'search' plist. & pass \\ \cline{3-4} + & & 1) Check that the output have the correct value. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Test the find method returns an empty array if the 'key' doesn't +exist in the PLIST.} & Test the find method returns an empty array if the 'key' doesn't +exist in the PLIST. & pass \\ \cline{3-4} + & & 1) Check that the output is an empty array. & pass \\ \hline +\caption{Unit tests for plist/find.} +\label{tab:plist_find} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf plist/get} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests the get method of the plist class.} & Test that the get returns returns the value of the specified +property. Do this for all properties of the PLIST object. & pass \\ \cline{3-4} + & & 1) Check the correct value of the output & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the get method works with a plist.} & Test that the get returns returns the value of the specified +property which is defined in a plist. & pass \\ \cline{3-4} + & & 1) Check the correct value of the output & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests the get method of the plist class.} & Test that the get throws an error if the input are more than +one PLIST object. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline +\caption{Unit tests for plist/get.} +\label{tab:plist_get} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf plist/isparam} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the isparam method works with a vector of PLIST objects as input.} & Tests that the isparam method works with a vector of PLIST objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the output have the same size as the input. +2) Check the output. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the isparam method works with a matrix of PLIST objects as +input.} & Tests that the isparam method works with a matrix of PLIST objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the output have the same size as the input. +2) Check the output. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the isparam method works with a list of PLIST objects as +input.} & Tests that the isparam method works with a list of PLIST objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the output have the same size as the input. +2) Check the output. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the isparam method works with a mix of different shaped PLIST +objects as input.} & Tests that the isparam method works with a mix of different shaped +PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output have the same size as the input. +2) Check the output. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the isparam method applies the modify command} & Test that the isparam method can used in the modifier form. & pass \\ \cline{3-4} + & & 1) Test that plin doesn't change. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the isparam method with a positiv match.} & Test the isparam method with different input. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline +\caption{Unit tests for plist/isparam.} +\label{tab:plist_isparam} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf plist/isprop} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the isprop method works with a vector of PLIST objects as input.} & Test that the isprop method works for a vector of PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'plv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the isprop method works with a matrix of PLIST objects as input.} & Test that the isprop method works for a matrix of PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'plm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the isprop method works with a list of PLIST objects as input.} & Test that the isprop method works for a list of PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the isprop method works with a mix of different shaped +PLIST objects as input.} & Test that the isprop method works with an input of matrices and vectors +and single PLIST objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the isprop method works for each property.} & Test that the isprop method works for the properties: +'params', 'created', 'creator', 'name' & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the negative case and the not function command.} & Test that the isprop method retrun false for a unknown property and for +methods of the object. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline +\caption{Unit tests for plist/isprop.} +\label{tab:plist_isprop} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf plist/loadobj} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check the shape of the loaded objects. & pass \\ \hline +\caption{Unit tests for plist/loadobj.} +\label{tab:plist_loadobj} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf plist/ne} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the ne method works with a vector of PLIST objects as input.} & Test that the ne method works for a vector of PLIST objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the ne function. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the ne method works with a matrix of PLIST objects as input.} & Test that the ne method works for a matrix of PLIST objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the ne function. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the ne method works with a list of PLIST objects as input.} & The ne method doesn't works for a list of PLIST objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the ne method works with a mix of different shaped PLIST objects +as input.} & The ne method doesn't works for a list of PLIST objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the ne method properly applies history.} & The ne method doesn't change the PLIST object, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the ne method with an exception list. +The function plist/ne use the function plist/eq so it is not necessary to check +all possibilities of the exception list.} & Test the ne method with the exception 'name'. It is necessary to add +'created' to the exception list because pl is created at an other time. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the ne method with an exception list which is in a plist.} & Test that the ne method uses the exception list in a plist. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline +\caption{Unit tests for plist/ne.} +\label{tab:plist_ne} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf plist/nparams} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the nparams method works with a vector of PLIST objects as input.} & Test that the nparams method returns the number of PARAM objects in +the PLIST objects. & pass \\ \cline{3-4} + & & 1) Check that the number of outputs is the same as the number of +input PLIST objects. +2) Check the output. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the nparams method works with a vector of PLIST objects as input.} & Test that the nparams method returns the number of PARAM objects in +the PLIST objects. & pass \\ \cline{3-4} + & & 1) Check that the number of outputs is the same as the number of +input PLIST objects. +2) Check the output. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the nparams method works with a list of PLIST objects as input.} & Test that the nparams method returns the number of PARAM objects in +the PLIST objects. & pass \\ \cline{3-4} + & & 1) Check that the number of outputs is the same as the number of +input PLIST objects. +2) Check the output. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the nparams method works with a mix of different shaped PLIST +objects as input.} & Test that the nparams method returns the number of PARAM objects in +the PLIST objects. & pass \\ \cline{3-4} + & & 1) Check that the number of outputs is the same as the number of +input PLIST objects. +2) Check the output. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the nparams method applies the modify command} & Test that the nparams method can used in the modifier style. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline +\caption{Unit tests for plist/nparams.} +\label{tab:plist_nparams} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf plist/parse} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the parse method works with a vector of PLIST objects as input.} & The parse method is an internal method and it doesn't work for vector +of PLIST objects as an input. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the parse method works with a matrix of PLIST objects as input.} & The parse method is an internal method and it doesn't work for matrix +of PLIST objects as an input. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the parse method works with a list of PLIST objects as input.} & The parse method is an internal method and it doesn't work for list +of PLIST objects as an input. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the parse method works with a mix of different shaped PLIST +objects as input.} & The parse method is an internal method and it doesn't work for +different shaped PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the parse method with non-dependent elements.} & Test that the parse method can convert non-dependent elements. & pass \\ \cline{3-4} + & & 1) Check the right number of parameter in out. +2) Check that the correct values are converted. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the parse method with dependent elements.} & Test that the parse method can convert dependent elements. & pass \\ \cline{3-4} + & & 1) Check the right number of parameter in out. +2) Check that the correct values are converted. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that upper/lower case doesn't matter in the parse method.} & Tests that upper/lower case doesn't matter in the parse method. & pass \\ \cline{3-4} + & & 1) Check the right number of parameter in out. +2) Check that the correct values are converted. & pass \\ \hline +\caption{Unit tests for plist/parse.} +\label{tab:plist_parse} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf plist/plist} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the plist method works with a vector of PLIST objects as input.} & Test that the plist method works with a vector of PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output PLISTs is the same as the input shape. +2) Check that each output PLIST is a copy of the input PLIST. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the plist method works with a matrix of PLIST objects as input.} & Test that the plist method works with a matrix of PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output PLISTs is the same as the input shape. +2) Check that each output PLIST is a copy of the input PLIST. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the plist method works with a list of PLIST objects as input.} & Test that the plist method works with a list of PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same of the +number in the input. +2) Check that each output PLIST is a copy of the input PLIST. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the plist method works with a mix of different shaped PLISTs as +input.} & Test that the plist method works with a mix of different shaped PLISTs as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same of the +number in the input. +2) Check that each output PLIST is a copy of the input PLIST. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests the MAT-file constructor.} & Tests the MAT-file constructor. & pass \\ \cline{3-4} + & & 1) Check that the saved object is the same as the loaded object. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests the XML-file constructor.} & Tests the XML-file constructor. & pass \\ \cline{3-4} + & & 1) Check that the saved object is the same as the loaded object. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the plist method for a struct as an input.} & Tests that the plist method for a struct as an input. & pass \\ \cline{3-4} + & & 2) Check the built object. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests the param constructor.} & Tests the param constructor. & pass \\ \cline{3-4} + & & 1) Check that the output contains the input parameter objects & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Tests the plist(filename) constructor.} & Tests the plist(filename) constructor. & pass \\ \cline{3-4} + & & 1) Check that the loaded object is the same as the saved object & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Tests the plist(conn) constructor.} & Tests the plist(conn) constructor. & pass \\ \cline{3-4} + & & 1) Check the retrieved object against the submitted object. & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Tests the conn+Id constructor.} & Tests the conn+Id constructor. & pass \\ \cline{3-4} + & & 1) Check the retrieved object against the submitted object. & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Tests the key/value constructor} & Tests the key/value constructor & pass \\ \cline{3-4} + & & 1) Check the right number of parameter in the PLIST object +2) Check the parameter in the PLIST object +3) Check that the key is in capital letter. & pass \\ \hline +\caption{Unit tests for plist/plist.} +\label{tab:plist_plist} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf plist/plist2cmds} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the plist2cmds method works with a vector of PLIST objects as input.} & The plist2cmds method doesn't works for a vector of PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the plist2cmds method works with a matrix of PLIST objects as input.} & The plist2cmds method doesn't works for a matrix of PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the plist2cmds method works with a list of PLIST objects as input.} & The plist2cmds method doesn't works for a list of PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the plist2cmds method works with a mix of different shaped +PLIST objects as input.} & The plist2cmds method doesn't works with an input of matrices and vectors +and single PLIST objects. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the plist2cmds method accepts different objects for the 'val' property.} & Create a plist with all possible objects for the 'val' property. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable plist2cmds & pass \\ \hline +\caption{Unit tests for plist/plist2cmds.} +\label{tab:plist_plist2cmds} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf plist/pset} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the pset method works with a vector of PLIST objects as input.} & Test that the pset method set or add a key/value pair to all PLIST +objects in the vector. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output is the same as the shape of the input +2) Check that the output PLIST contains the new key/value pair. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the pset method works with a matrix of PLIST objects as input.} & Test that the pset method set or add a key/value pair to all PLIST +objects in the matrix. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output is the same as the shape of the input +2) Check that the output PLIST contains the new key/value pair. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the pset method works with a list of PLIST objects as input.} & Test that the pset method set or add a key/value pair to all PLIST +objects in the input. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output is the same as the shape of the input +2) Check that the output PLIST contains the new key/value pair. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the pset method works with a mix of different shaped PLIST +objects as input.} & Test that the pset method set or add a key/value pair to all PLIST +objects in the input. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output is the same as the shape of the input +2) Check that the output PLIST contains the new key/value pair. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the pset method applies the modify command} & Test that the pset method can modify the input PLIST by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'pleq' are now different. +2) Check that 'plmo' and 'out' are the same. +3) Check that 'out' and 'plmo' have the new key/value pair +4) Check that pleq don't have the new key/value pair & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the pset method works for different input variants for the key/value +pair.} & Test that the pset method accepts param-objects or direct key/value +pairs as an input. & pass \\ \cline{3-4} + & & 1) Check that the output have all key/value pairs. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the pset method in the setting and appending case.} & Create an example where the pset method set a key to a new value and +an example where pset append the new key/value pair & pass \\ \cline{3-4} + & & 1) Check the number of parametes in the output. +2) Check the new key/value pair & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test that the pset method sets the key always in capital letter} & Test that the pset method sets the key always in capital letter & pass \\ \cline{3-4} + & & 1) Check that the key is in capital letters & pass \\ \hline +\caption{Unit tests for plist/pset.} +\label{tab:plist_pset} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf plist/remove} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the remove method works with a vector of PLIST objects as input.} & Test that the remove method remove the 'key' from all PLIST objects +in the vector. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output is the same as the shape of the input +2) Check that the output PLIST doesn't contains the key. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the remove method works with a matrix of PLIST objects as input.} & Test that the remove method remove the 'key' from all PLIST objects +in the matrix. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output is the same as the shape of the input +2) Check that the output PLIST doesn't contains the key. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the remove method works with a list of PLIST objects as input.} & Test that the remove method remove the 'key' from all PLIST objects +of the input. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output is the same as the shape of the input +2) Check that the output PLIST doesn't contains the key. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the remove method works with a mix of different shaped PLIST +objects as input.} & Test that the remove method remove the 'key' from all PLIST objects +of the input. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output is the same as the shape of the input +2) Check that the output PLIST doesn't contains the key. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the remove method applies the modify command} & Test that the remove method can modify the input PLIST by calling with no +output and that the method doesn't change the input of the function +notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'pleq' are now different. +2) Check that 'plmo' and 'out' are the same. +3) Check that 'out' and 'plmo' don't have the key +4) Check that pleq doesn't have the key & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the remove method that it removes the parameter which is defined +as an index or as a key} & Test the remove method that it removes the parameter which is defined +as an index or as a key & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the remove method in a negative case that the key is not in the +paramter list.} & The remove method doesn't throwns an error if the key doesn't exist +in the parameter list. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline +\caption{Unit tests for plist/remove.} +\label{tab:plist_remove} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf plist/save} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the save method works with a vector of PLIST objects as input.} & Test that the save method works for a vector of PLIST objects as input. +Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the same +as in 'plv' +2) Check that the loaded objects are the same as the saved objects. +3) The outputs 'out1' and 'out2' must be the same. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the save method works with a matrix of PLIST objects as input.} & Test that the save method works for a matrix of PLIST objects as input. +Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the same +as in 'plm' +2) Check that the loaded objects are the same as the saved objects. +3) The outputs 'out1' and 'out2' must be the same. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the save method works with a list of PLIST objects as input.} & Test that the save method works for a list of PLIST objects as input. +Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the same +as in the list +2) Check that the loaded objects are the same as the saved objects. +3) The outputs 'out1' and 'out2' must be the same. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the save method works with a mix of different shaped PLIST objects +as input.} & Test that the save method works with an input of matrices and vectors +and single PLIST objects. Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output PLIST object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the save method works with the modify command.} & Use the save method with the modifier command. & pass \\ \cline{3-4} + & & 1) Check that the save method doesn't change the input PLIST object. +2) Check the output against the input except. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the save method uses the filename which is stored in a plist. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline +\caption{Unit tests for plist/save.} +\label{tab:plist_save} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf plist/setName} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setName method works with a vector of PLIST objects as input.} & Test that the setName method works for a vector of PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'plv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setName method works with a matrix of PLIST objects as input.} & Test that the setName method works for a matrix of PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'plm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setName method works with a list of PLIST objects as input.} & Test that the setName method works for a list of PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setName method works with a mix of different shaped PLIST +objects as input.} & Test that the setName method works with an input of matrices and vectors +and single PLIST objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setName method can modify the input PLIST object.} & Test that the setName method can modify the input PLIST object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'pl2' and 'ain' are now different. +2) Check that 'ain' has the correct name field & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setName method can set the property with a plist.} & Test that the setName method can modify the property 'name' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct name field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Check that the setName method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects & pass \\ \hline +\caption{Unit tests for plist/setName.} +\label{tab:plist_setName} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf plist/string} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the string method works with a vector of PLIST objects as input.} & Test that the string method works for a vector of PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the string method works with a matrix of PLIST objects as input.} & Test that the string method works for a matrix of PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the string method works with a list of PLIST objects as input.} & Test that the string method works for a list of PLIST objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the string method works with a mix of different shaped PLIST objects +as input.} & Test that the string method works with an input of matrices and vectors +and single PLIST objects. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the string method doesn't work if the PLIST object have more +than one history step.} & The method string throws an error because the input object have more than +one history step. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the string method accepts different objects for the 'val' property.} & Create a plist with all possible objects for the 'val' property. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string & pass \\ \hline +\caption{Unit tests for plist/string.} +\label{tab:plist_string} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/char} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the char method works with a vector of PZMODEL objects as input.} & Test that the char method works for a vector of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the char method works with a matrix of PZMODEL objects as input.} & Test that the char method works for a matrix of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the char method works with a list of PZMODEL objects as input.} & Test that the char method works for a list of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the char method works with a mix of different shaped PZMODEL objects +as input.} & Test that the char method works with an input of matrices and vectors +and single PZMODEL objects. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the char method properly applies history.} & The method char doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for pzmodel/char.} +\label{tab:pzmodel_char} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/copy} &&& \\ \hline +\endhead + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline +\caption{Unit tests for pzmodel/copy.} +\label{tab:pzmodel_copy} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/created} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the created method works with a vector of PZMODEL objects as +input.} & Test that the created method works for a vector of PZMODEL objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pzv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the created method works with a matrix of PZMODEL objects as +input.} & Test that the created method works for a matrix of PZMODEL objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pzm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the created method works with a list of PZMODEL objects as +input.} & Test that the created method works for a list of PZMODEL objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the created method works with a mix of different shaped +PZMODEL objects as input.} & Test that the created method works with an input of matrices and +vectors and single PZMODEL objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the created method properly applies history} & This method doesn't change the input object, thus no history is added +to the object. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the created method can be used with the modify command.} & Tests that the created method can be used with the modify command. & pass \\ \cline{3-4} + & & 1) Check the single object +2) Check the matrix object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the created method retruns always a well defined time object +even for an empty input object.} & Test that the created method with an empty 'PZMODEL object & pass \\ \cline{3-4} + & & 1) Check that the output is a time object with a ell defined time. & pass \\ \hline +\caption{Unit tests for pzmodel/created.} +\label{tab:pzmodel_created} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/creator} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the creator method works with a vector of PZMODEL objects as +input.} & Test that the creator method works for a vector of PZMODEL objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pzv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the creator method works with a matrix of PZMODEL objects as +input.} & Test that the creator method works for a matrix of PZMODEL objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pzm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the creator method works with a list of PZMODEL objects as +input.} & The creator method doesn't work for a list of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the creator method works with a mix of different shaped +PZMODEL objects as input.} & The creator method doesn't work with different shaped input objects. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the creator method properly applies history} & This method doesn't change the input object, thus no history is added +to the object. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the creator method can be used with the modify command.} & Tests that the creator method can be used with the modify command. & pass \\ \cline{3-4} + & & 1) Check the single object +2) Check the matrix object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the creator method retruns all creator(s)/modifier(s) which +are in the history.} & Test that the creator method uses the option 'all' direct or in a +plist. The test file must have the modifier 'first', 'second' and +'third' & pass \\ \cline{3-4} + & & 1) Check that out1 contains only one creator +2) Check that out2 contain more creator/modifier & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests the negative case for the option 'all'.} & Test that the creator method throws an error if the option 'all' is +used in connection with a matrix/vector of PZMODEL objects. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline +\caption{Unit tests for pzmodel/creator.} +\label{tab:pzmodel_creator} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/display} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the display method works with a vector of PZMODEL objects as input.} & Test that the display method works for a vector of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the display method works with a matrix of PZMODEL objects as input.} & Test that the display method works for a matrix of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the display method works with a list of PZMODEL objects as input.} & Test that the display method works for a list of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the display method works with a mix of different shaped +PZMODEL objects as input.} & Test that the display method works with an input of matrices and vectors +and single PZMODEL objects as. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the display method properly applies history.} & The method display doesn't change the data, thus it is not possible to +check the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for pzmodel/display.} +\label{tab:pzmodel_display} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/eq} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the eq method works with a vector of PZMODEL objects as input.} & Test that the eq method works for a vector of PZMODEL objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the eq function. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the eq method works with a matrix of PZMODEL objects as input.} & Test that the eq method works for a matrix of PZMODEL objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the eq function. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the eq method works with a list of PZMODEL objects as input.} & The eq method doesn't works for a list of PZMODEL objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the eq method works with a mix of different shaped PZMODEL objects +as input.} & The eq method doesn't works for a list of PZMODEL objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the eq method properly applies history.} & The eq method doesn't change the PZMODEL object, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'name'. Use the option 'internal' to +suppress the history. It is necessary to add 'created' to the exception +list because pzm is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'iunits'. Use the option 'internal' +to suppress the history. It is necessary to add 'created' to the exception +list because pzm is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'ounits'. Use the option 'internal' +to suppress the history. It is necessary to add 'created' to the exception +list because pzm is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Test the eq method with an exception list which is in a plist.} & Test that the eq method uses the exception list in a plist. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline +\caption{Unit tests for pzmodel/eq.} +\label{tab:pzmodel_eq} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/get} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests the get method of the pzmodel class.} & Test that the get returns returns the value of the specified +property. Do this for all properties of the PZMODEL object. & pass \\ \cline{3-4} + & & 1) Check the correct value of the output & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the get method works with a plist.} & Test that the get returns returns the value of the specified +property which is defined in a plist. & pass \\ \cline{3-4} + & & 1) Check the correct value of the output & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests the get method of the pzmodel class.} & Test that the get throws an error if the input are more than +one PZMODEL object. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline +\caption{Unit tests for pzmodel/get.} +\label{tab:pzmodel_get} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/getlowerFreq} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests the getlowerFreq method of the pzmodel class.} & Test that the getlowerFreq returns the lowest frequence of the lowest +pole or zero in the model. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests the getlowerFreq method of the pzmodel class.} & Test that the getlowerFreq throws an error if the input are more than one +pzmodel. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline +\caption{Unit tests for pzmodel/getlowerFreq.} +\label{tab:pzmodel_getlowerFreq} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/getupperFreq} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests the getupperFreq method of the pzmodel class.} & Test that the getupperFreq returns the lowest frequence of the lowest +pole or zero in the model. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests the getupperFreq method of the pzmodel class.} & Test that the getupperFreq throws an error if the input are more than one +pzmodel. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline +\caption{Unit tests for pzmodel/getupperFreq.} +\label{tab:pzmodel_getupperFreq} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/index} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the index method works with a vector of PZMODEL objects as +input.} & Test that the index method works for a vector of PZMODEL objects as +input. The following indexing should work: +I = [ 1 2 3 ] or (I/J) = [(1,1), (1,2), (1,3)] & pass \\ \cline{3-4} + & & 1) Check that the index method selects the correct object. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the index method works with a matrix of PZMODEL objects as +input.} & Test that the index method works for a matrix of PZMODEL objects as +input. The following indexing should work: +I = [ 1 3 5 ] or (I/J) = [(1,1), (1,2), (1,3)] +[ 2 4 6 ] [(2,1), (2,2), (2,3)] & pass \\ \cline{3-4} + & & 1) Check that the index method selects the correct object. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the index method works with a list of PZMODEL objects as +input.} & The index method doesn't work for a list of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the index method properly applies history.} & Test that the result of index have an additional history step. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds +to 'index'. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the index method works for the modifier command.} & Tests that the index method works for the modifier command. & pass \\ \cline{3-4} + & & 1) Check that the history-plist contains the used indices. +2) Check that the index method selects the correct object & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the index method can be controled with a plist. & pass \\ \cline{3-4} + & & 1) Check that the history-plist contains the used indices. +2) Check that the index method selects the correct object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the index method selects more objects if I have more indices.} & Test that the index method selects more objects if I have more indices. & pass \\ \cline{3-4} + & & 1) Check that the history-plist contains the used indices. +2) Check that the index method selects the correct object & pass \\ \hline +\caption{Unit tests for pzmodel/index.} +\label{tab:pzmodel_index} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/isprop} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the isprop method works with a vector of PZMODEL objects as input.} & Test that the isprop method works for a vector of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pzv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the isprop method works with a matrix of PZMODEL objects as input.} & Test that the isprop method works for a matrix of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pzm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the isprop method works with a list of PZMODEL objects as input.} & Test that the isprop method works for a list of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the isprop method works with a mix of different shaped +PZMODEL objects as input.} & Test that the isprop method works with an input of matrices and vectors +and single PZMODEL objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the isprop method properly applies history.} & The method isprop doesn't change the object, thus it is not necessary to +apply history. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the isprop method works for each property.} & Test that the isprop method works for the properties: +'gain', 'poles', 'zeros', 'iunits', 'ounits', 'hist', +'name' & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the negative case and the not function command.} & Test that the isprop method retrun false for a unknown property and for +methods of the object. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline +\caption{Unit tests for pzmodel/isprop.} +\label{tab:pzmodel_isprop} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/loadobj} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check the shape of the loaded objects. & pass \\ \hline +\caption{Unit tests for pzmodel/loadobj.} +\label{tab:pzmodel_loadobj} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/mrdivide} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the mrdivide method works with a vector of PZMODELs as input.} & Test that the mrdivide method works for a vector of PZMODELs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one PZMODEL object. +2) Check the gain of the output +3) Check the poles of the output +4) Check the zeros of the output & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the mrdivide method works with a matrix of PZMODELs as input.} & Tests that the rdivie method works with a matrix of PZMODELs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one PZMODEL object. +2) Check the gain of the output +3) Check the poles of the output +4) Check the zeros of the output & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the mrdivide method works with a list of PZMODELs as input.} & Tests that the mrdivide method works with a list of PZMODELs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one PZMODEL object. +2) Check the gain of the output +3) Check the poles of the output +4) Check the zeros of the output & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the mrdivide method works with a mix of different shaped +PZMODELs as input.} & Tests that the mrdivide method works with a mix of different shaped +PZMODELs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one PZMODEL object. +2) Check the gain of the output +3) Check the poles of the output +4) Check the zeros of the output +5) Check the rebuilt object & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the mrdivide method properly applies history.} & Test that the result of applying the mrdivide method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'mrdivide'. +2) Check that re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Check that the mrdivide method only divide PZMODELs with the same output +units.} & Check that the mrdivide method only divide PZMODELs with the same +output units. Check also the negative case. & pass \\ \cline{3-4} + & & 1) Check the I-/O-units & pass \\ \hline +\caption{Unit tests for pzmodel/mrdivide.} +\label{tab:pzmodel_mrdivide} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/mtimes} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the mtimes method works with a vector of PZMODELs as input.} & Test that the mtimes method works for a vector of PZMODELs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one PZMODEL object. +2) Check the gain of the output +3) Check the poles of the output +4) Check the zeros of the output & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the mtimes method works with a matrix of PZMODELs as input.} & Tests that the mtimes method works with a matrix of PZMODELs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one PZMODEL object. +2) Check the gain of the output +3) Check the poles of the output +4) Check the zeros of the output & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the mtimes method works with a list of PZMODELs as input.} & Tests that the mtimes method works with a list of PZMODELs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one PZMODEL object. +2) Check the gain of the output +3) Check the poles of the output +4) Check the zeros of the output & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the mtimes method works with a mix of different shaped +PZMODELs as input.} & Tests that the mtimes method works with a mix of different shaped +PZMODELs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one PZMODEL object. +2) Check the gain of the output +3) Check the poles of the output +4) Check the zeros of the output +5) Check the rebuilt object & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the mtimes method properly applies history.} & Test that the result of applying the mtimes method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'times'. +2) Check that re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Check that the mtimes method only multiply PZMODELs with the same output +units.} & Check that the mtimes method only multiply PZMODELs with the same +output units. Check also the negative case. & pass \\ \cline{3-4} + & & 1) Check the I-/O-units & pass \\ \hline +\caption{Unit tests for pzmodel/mtimes.} +\label{tab:pzmodel_mtimes} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/ne} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the ne method works with a vector of PZMODEL objects as input.} & Test that the ne method works for a vector of PZMODEL objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the ne function. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the ne method works with a matrix of PZMODEL objects as input.} & Test that the ne method works for a matrix of PZMODEL objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the ne function. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the ne method works with a list of PZMODEL objects as input.} & The ne method doesn't works for a list of PZMODEL objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the ne method works with a mix of different shaped PZMODEL objects +as input.} & The ne method doesn't works for a list of PZMODEL objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the ne method properly applies history.} & The ne method doesn't change the PZMODEL object, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the ne method with an exception list. +The function pzmodel/ne use the function pzmodel/eq so it is not necessary to check +all possibilities of the exception list.} & Test the ne method with the exception 'name'. Use the option 'internal' to +suppress the history. It is necessary to add 'created' to the exception +list because pzm is created at an other time. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the ne method with an exception list which is in a plist.} & Test that the ne method uses the exception list in a plist. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline +\caption{Unit tests for pzmodel/ne.} +\label{tab:pzmodel_ne} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/pzmodel} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the pzmodel method works with a vector of PZMODEL objects as input.} & Test that the pzmodel method works with a vector of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output PZMODELs is the same as the input shape. +2) Check that each output PZMODEL is a copy of the input PZMODEL. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the pzmodel method works with a matrix of PZMODEL objects as input.} & Test that the pzmodel method works with a matrix of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output PZMODELs is the same as the input shape. +2) Check that each output PZMODEL is a copy of the input PZMODEL. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the pzmodel method works with a list of PZMODEL objects as input.} & Test that the pzmodel method works with a list of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same of the +number in the input. +2) Check that each output PZMODEL is a copy of the input PZMODEL. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the pzmodel method works with a mix of different shaped PZMODELs as +input.} & Test that the pzmodel method works with a mix of different shaped PZMODELs as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same of the +number in the input. +2) Check that each output PZMODEL is a copy of the input PZMODEL. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the pzmodel method properly applies history.} & Test that the result of applying the pzmodel method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'pzmodel'. +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the pzmodel method properly applies history to the copy constructor.} & Test that the output can be processed back with the 'rebuild' method. +Test the constructor with a different number of inputs. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'pzmodel'. +2) Check that the original objects are not changed by the setter function +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the pzmodel method properly applies history to the read +MAT-file constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the loaded object is the same as the saved object. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests that the pzmodel method properly applies history to the read +XML-file constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the loaded object is the same as the saved object. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Tests that the pzmodel method properly applies history to the read +FIL-file constructor.} & Read the FIL file which is created from LISO. +Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to 'pzmodel'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Tests that the pzmodel method properly applies history to the struct constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to 'pzmodel'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Tests that the pzmodel from a constant properly applies history.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to 'pzmodel'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Tests that the pzmodel method properly applies history to the rational constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to 'pzmodel'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{14 } & \multirow{2}{5cm}{Tests that the pzmodel method properly applies history to the +plist(filename) constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the save method doesn't change the input object +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{15 } & \multirow{2}{5cm}{Tests that the PZMODEL method properly applies history to the +plist(conn) constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'pzmodel'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{16 } & \multirow{2}{5cm}{Tests that the PZMODEL method properly applies history to the +plist(rational) constructor} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'pzmodel'. +2) Check the algorithm +3) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{17 } & \multirow{2}{5cm}{Tests that the PZMODEL method properly applies history to the +plist(gain|poles|zeros) constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'pzmodel'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{18 } & \multirow{2}{5cm}{Tests that the PZMODEL method properly applies history to the +plist() constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'pzmodel'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{19 } & \multirow{2}{5cm}{Tests that the PZMODEL method properly applies history to the conn+Id constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'pzmodel'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{20 } & \multirow{2}{5cm}{Tests that the PZMODEL method properly applies history to the +gain + poles + zeros constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'pzmodel'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{21 } & \multirow{2}{5cm}{Tests that the PZMODEL method properly applies history to the +gain + poles + zeros + name constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'pzmodel'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{22 } & \multirow{2}{5cm}{Tests that the PZMODEL method properly applies history to the +gain + poles + zeros + iunits + ounits constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'pzmodel'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for pzmodel/pzmodel.} +\label{tab:pzmodel_pzmodel} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/rdivide} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the rdivide method works with a vector of PZMODELs as input.} & Test that the rdivide method works for a vector of PZMODELs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one PZMODEL object. +2) Check the gain of the output +3) Check the poles of the output +4) Check the zeros of the output & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the rdivide method works with a matrix of PZMODELs as input.} & Tests that the rdivie method works with a matrix of PZMODELs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one PZMODEL object. +2) Check the gain of the output +3) Check the poles of the output +4) Check the zeros of the output & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the rdivide method works with a list of PZMODELs as input.} & Tests that the rdivide method works with a list of PZMODELs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one PZMODEL object. +2) Check the gain of the output +3) Check the poles of the output +4) Check the zeros of the output & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the rdivide method works with a mix of different shaped +PZMODELs as input.} & Tests that the rdivide method works with a mix of different shaped +PZMODELs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one PZMODEL object. +2) Check the gain of the output +3) Check the poles of the output +4) Check the zeros of the output +5) Check the rebuilt object & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the rdivide method properly applies history.} & Test that the result of applying the rdivide method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'rdivide'. +2) Check that re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Check that the rdivide method only divide PZMODELs with the same output +units.} & Check that the rdivide method only divide PZMODELs with the same +output units. Check also the negative case. & pass \\ \cline{3-4} + & & 1) Check the I-/O-units & pass \\ \hline +\caption{Unit tests for pzmodel/rdivide.} +\label{tab:pzmodel_rdivide} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/rebuild} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the rebuild method works with a vector of PZMODEL objects as input.} & Test that the rebuild method works for a vector of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the rebuild method works with a matrix of PZMODEL objects as input.} & Test that the rebuild method works for a matrix of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the rebuild method works with a list of PZMODEL objects as input.} & Test that the rebuild method works for a list of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the rebuild method works with a mix of different shaped PZMODEL objects +as input.} & Test that the rebuild method works with an input of matrices and vectors +and single PZMODEL objects. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the rebuild method properly applies history.} & The method rebuild doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Check that the rebuild method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for pzmodel/rebuild.} +\label{tab:pzmodel_rebuild} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/resp} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the resp method works with a vector of PZMODEL objects as input.} & Test that the resp method works for a vector of PZMODEL objects as input. +Test the method with an output and with no output (a diagram must appear) & pass \\ \cline{3-4} + & & 1) Test the right number of lines in the diagram. +2) Check that the number of elements in 'out' is the same as in 'pzv' +3) Check that each output PZMODEL contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the resp method works with a matrix of PZMODEL objects as input.} & Test that the resp method works for a matrix of PZMODEL objects as input. +Test the method with an output and with no output (a diagram must appear) & pass \\ \cline{3-4} + & & 1) Test the right number of lines in the diagram. +2) Check that the number of elements in 'out' is the same as in 'pzmat' +3) Check that each output PZMODEL contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the pzmat method works with a list of PZMODEL objects as input.} & Test that the resp method works for a list of PZMODEL objects as input. +Test the method with an output and with no output (a diagram must appear) & pass \\ \cline{3-4} + & & 1) Test the right number of lines in the diagram. +2) Check that the number of elements in 'out' is the same as in 'pzmat' +3) Check that each output PZMODEL contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the resp method works with a mix of different shaped PZMODEL +objects as input.} & Test that the resp method works with an input of matrices and vectors +and single PZMODEL objects. Test the method with an output and with no +output (a diagram must appear) & pass \\ \cline{3-4} + & & 1) Test the right number of lines in the diagram. +2) Check that the number of elements in 'out' is the same as in 'pzmat' +3) Check that each output PZMODEL contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the resp method properly applies history.} & Test that the result of applying the resp method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'resp'. +2) Check that re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that modify command plots the response into a diagram.} & Tests that modify command plots the response into a diagram. & pass \\ \cline{3-4} + & & 1) Check the response diagram. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the output AO of the resp method keeps the shape of the used +input f vector. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the resp method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the resp method uses the x-data of an input AO for f-vector.} & Call the method with different method to pass an AO in. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the resp method uses the specified f-vector to compute the response.} & Call the method with different method to pass an f-vector in. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Check that the resp method uses the specified f1, f2, and nf to compute the response.} & Call the method with different method to pass f1, f2, and nf in. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Check that the resp method uses the specified f1, f2, and nf to compute the response.} & Call the method with different method to pass f1, f2, and nf in. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for pzmodel/resp.} +\label{tab:pzmodel_resp} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/save} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the save method works with a vector of PZMODEL objects as input.} & Test that the save method works for a vector of PZMODEL objects as input. +Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the same +as in 'pzv' +2) Check that the loaded objects are the same as the saved objects. +3) The outputs 'out1' and 'out2' must be the same. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the save method works with a matrix of PZMODEL objects as input.} & Test that the save method works for a matrix of PZMODEL objects as input. +Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the same +as in 'pzm' +2) Check that the loaded objects are the same as the saved objects. +3) The outputs 'out1' and 'out2' must be the same. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the save method works with a list of PZMODEL objects as input.} & Test that the save method works for a list of PZMODEL objects as input. +Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the same +as in the list +2) Check that the loaded objects are the same as the saved objects. +3) The outputs 'out1' and 'out2' must be the same. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the save method works with a mix of different shaped PZMODEL objects +as input.} & Test that the save method works with an input of matrices and vectors +and single PZMODEL objects. Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output PZMODEL object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the save method properly applies history.} & Test that the result of applying the save method can be processed back +to an m-file. Do this for both extensions 'mat' and 'xml' & pass \\ \cline{3-4} + & & 1) Check that the history applies to the output object. Check that +save doesn't add a history step to the input object. +2) Check that the read object doesn't contain the save + load history steps. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the save method works with the modify command.} & Use the save method with the modifier command. & pass \\ \cline{3-4} + & & 1) Check that the save method doesn't apply the history. +2) Check the output against the input. +3) Check the history of the output against the input. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the save method uses the filename which is stored in a plist. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the save method with common PZMODEL objects.} & Save all common PZMODEL objects with both extensions. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline +\caption{Unit tests for pzmodel/save.} +\label{tab:pzmodel_save} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/setDelay} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setDelay method works with a vector of PZMODEL objects as input.} & Test that the setDelay method works for a vector of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pzv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setDelay method works with a matrix of PZMODEL objects as input.} & Test that the setDelay method works for a matrix of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pzm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setDelay method works with a list of PZMODEL objects as input.} & Test that the setDelay method works for a list of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setDelay method works with a mix of different shaped PZMODEL +objects as input.} & Test that the setDelay method works with an input of matrices and vectors +and single PZMODEL objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setDelay method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setDelay method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setDelay'. +2) Check that the last entry in the history of 'out2' NOT corresponds to +'setDelay'. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setDelay method can modify the input PZMODEL object.} & Test that the setDelay method can modify the input PZMODEL object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'pz5' and 'ain' are now different. +2) Check that 'ain' has the correct delay field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setDelay method can set the property with a plist.} & Test that the setDelay method can modify the property 'delay' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct delay field +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setDelay method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for pzmodel/setDelay.} +\label{tab:pzmodel_setDelay} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/setIunits} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setIunits method works with a vector of PZMODEL objects as input.} & Test that the setIunits method works for a vector of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pzv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setIunits method works with a matrix of PZMODEL objects as input.} & Test that the setIunits method works for a matrix of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pzm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setIunits method works with a list of PZMODEL objects as input.} & Test that the setIunits method works for a list of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setIunits method works with a mix of different shaped PZMODEL +objects as input.} & Test that the setIunits method works with an input of matrices and vectors +and single PZMODEL objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setIunits method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setIunits method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setIunits'. +2) Check that the last entry in the history of 'out2' NOT corresponds to +'setIunits'. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setIunits method can modify the input PZMODEL object.} & Test that the setIunits method can modify the input PZMODEL object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'pz5' and 'ain' are now different. +2) Check that 'ain' has the correct iunits field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setIunits method can set the property with a plist.} & Test that the setIunits method can modify the property 'iunits' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct iunits field +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setIunits method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for pzmodel/setIunits.} +\label{tab:pzmodel_setIunits} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/setName} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setName method works with a vector of PZMODEL objects as input.} & Test that the setName method works for a vector of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pzv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setName method works with a matrix of PZMODEL objects as input.} & Test that the setName method works for a matrix of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pzm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setName method works with a list of PZMODEL objects as input.} & Test that the setName method works for a list of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setName method works with a mix of different shaped PZMODEL +objects as input.} & Test that the setName method works with an input of matrices and vectors +and single PZMODEL objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setName method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setName method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setName'. +2) Check that the last entry in the history of 'out2' NOT corresponds to +'setName'. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setName method can modify the input PZMODEL object.} & Test that the setName method can modify the input PZMODEL object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'pz5' and 'ain' are now different. +2) Check that 'ain' has the correct name field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setName method can set the property with a plist.} & Test that the setName method can modify the property 'name' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct name field +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setName method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for pzmodel/setName.} +\label{tab:pzmodel_setName} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/setOunits} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setOunits method works with a vector of PZMODEL objects as input.} & Test that the setOunits method works for a vector of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pzv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setOunits method works with a matrix of PZMODEL objects as input.} & Test that the setOunits method works for a matrix of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pzm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setOunits method works with a list of PZMODEL objects as input.} & Test that the setOunits method works for a list of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setOunits method works with a mix of different shaped PZMODEL +objects as input.} & Test that the setOunits method works with an input of matrices and vectors +and single PZMODEL objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setOunits method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setOunits method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setOunits'. +2) Check that the last entry in the history of 'out2' NOT corresponds to +'setOunits'. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setOunits method can modify the input PZMODEL object.} & Test that the setOunits method can modify the input PZMODEL object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'pz5' and 'ain' are now different. +2) Check that 'ain' has the correct ounits field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setOunits method can set the property with a plist.} & Test that the setOunits method can modify the property 'ounits' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct ounits field +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setOunits method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for pzmodel/setOunits.} +\label{tab:pzmodel_setOunits} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/simplify} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the simplify method works with a vector of PZMODELs as input.} & Test that the simplify method works for a vector of PZMODELs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pzv' +2) Check the poles of the output +3) Check the zeros of the output & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the simplify method works with a matrix of PZMODELs as input.} & Tests that the simplify method works with a matrix of PZMODELs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pzm' +2) Check the poles of the output +3) Check the zeros of the output & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the simplify method works with a list of PZMODELs as input.} & Tests that the simplify method works with a list of PZMODELs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in the input +2) Check the poles of the output +3) Check the zeros of the output & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the simplify method works with a mix of different shaped +PZMODELs as input.} & Tests that the simplify method works with a mix of different shaped +PZMODELs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in the input +2) Check the poles of the output +3) Check the zeros of the output +4) Check the re-built object & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the simplify method properly applies history.} & Test that the result of applying the simplify method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'simplify'. +2) Check that re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the simplify method can modify the input PZMODEL.} & Test that the simplify method can modify the input PZMODEL by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that 'out' and 'aeq' are now different. +2) Check that 'aeq' is not changed +3) Check that the modified input is the simplified value of the copy +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Check that the simplify method cancle poles/zeros at different +positions.} & Check that the simplify method cancle poles/zeros at different +positions. & pass \\ \cline{3-4} + & & 1) Check the poles and peros of the output. & pass \\ \hline +\caption{Unit tests for pzmodel/simplify.} +\label{tab:pzmodel_simplify} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/string} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the string method works with a vector of PZMODEL objects as input.} & Test that the string method works for a vector of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the string method works with a matrix of PZMODEL objects as input.} & Test that the string method works for a matrix of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the string method works with a list of PZMODEL objects as input.} & Test that the string method works for a list of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the string method works with a mix of different shaped PZMODEL objects +as input.} & Test that the string method works with an input of matrices and vectors +and single PZMODEL objects. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the string method properly applies history.} & The method string doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the string method doesn't work if the PZMODEL object have more +than one history step.} & The method string throws an error because the input object have more than +one history step. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for pzmodel/string.} +\label{tab:pzmodel_string} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/times} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the times method works with a vector of PZMODELs as input.} & Test that the times method works for a vector of PZMODELs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one PZMODEL object. +2) Check the gain of the output +3) Check the poles of the output +4) Check the zeros of the output & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the times method works with a matrix of PZMODELs as input.} & Tests that the times method works with a matrix of PZMODELs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one PZMODEL object. +2) Check the gain of the output +3) Check the poles of the output +4) Check the zeros of the output & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the times method works with a list of PZMODELs as input.} & Tests that the times method works with a list of PZMODELs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one PZMODEL object. +2) Check the gain of the output +3) Check the poles of the output +4) Check the zeros of the output & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the times method works with a mix of different shaped +PZMODELs as input.} & Tests that the times method works with a mix of different shaped +PZMODELs as input. & pass \\ \cline{3-4} + & & 1) Check that the output is exact one PZMODEL object. +2) Check the gain of the output +3) Check the poles of the output +4) Check the zeros of the output +5) Check the rebuilt object & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the times method properly applies history.} & Test that the result of applying the times method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'times'. +2) Check that re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Check that the times method only multiply PZMODELs with the same output +units.} & Check that the times method only multiply PZMODELs with the same +output units. Check also the negative case. & pass \\ \cline{3-4} + & & 1) Check the I-/O-units & pass \\ \hline +\caption{Unit tests for pzmodel/times.} +\label{tab:pzmodel_times} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/tomfir} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the tomfir method works with a vector of PZMODEL objects as input.} & Test that the tomfir method works for a vector of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pzv' +2) Check that each output PZMODEL object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the tomfir method works with a matrix of PZMODEL objects as input.} & Test that the tomfir method works for a matrix of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pzm' +2) Check that each output PZMODEL object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the tomfir method works with a list of PZMODEL objects as input.} & Test that the tomfir method works for a list of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output PZMODEL object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the tomfir method works with a mix of different shaped PZMODEL objects as +input.} & Test that the tomfir method works with an input of matrices and vectors +and single PZMODEL objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output PZMODEL object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the tomfir method properly applies history.} & Test that the result of applying the tomfir method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'tomfir'. +2) Check that re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the tomfir method can modify the input PZMODEL object.} & Test that the tomfir method can not modify the input PZMODEL object . +The method must throw an error for the modifier call. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the tomfir method use the different values in a plist. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check the re-built object & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the tomfir method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for pzmodel/tomfir.} +\label{tab:pzmodel_tomfir} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/tomiir} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the tomiir method works with a vector of PZMODEL objects as input.} & Test that the tomiir method works for a vector of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pzv' & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the tomiir method works with a matrix of PZMODEL objects as input.} & Test that the tomiir method works for a matrix of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'pzm' & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the tomiir method works with a list of PZMODEL objects as input.} & Test that the tomiir method works for a list of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output PZMODEL object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the tomiir method works with a mix of different shaped PZMODEL objects as +input.} & Test that the tomiir method works with an input of matrices and vectors +and single PZMODEL objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output PZMODEL object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the tomiir method properly applies history.} & Test that the result of applying the tomiir method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'tomiir'. +2) Check that re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the tomiir method can modify the input PZMODEL object.} & Test that the tomiir method can not modify the input PZMODEL object . +The method must throw an error for the modifier call. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the tomiir method use the different values in a plist. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check the re-built object & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the tomiir method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check indirect the protected 'pzm2ab' method because tomiir uses this +method to get the a and b of the iir object.} & Create some special pole/zero models to test the 'pzm2ab' method +indirect with the tomiir method. Test with complex pole/zero pairs. +This UTP define a simple method to get the a-, and b-value from a +complex pole/zero pair. +It uses the following code: +function [a,b] = utp\_cpz2ab(pf, pq, zf, zq, fs) +wp = pf*2*pi; +wp2 = wp\^2; +wz = zf*2*pi; +wz2 = wz\^2; +k = 4*fs*fs + 2*wp*fs/pq + wp2; +a(1) = (4*fs*fs + 2*wz*fs/zq + wz2)/k; +a(2) = (2*wz2 - 8*fs*fs)/k; +a(3) = (4*fs*fs - 2*wz*fs/zq + wz2)/k; +b(1) = 1; +b(2) = (2*wp2 - 8*fs*fs)/k; +b(3) = (wp2 + 4*fs*fs - 2*wp*fs/pq)/k; +g = sum(a) / sum(b); +a = a / g; +end & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check indirect the protected 'pzm2ab' method because tomiir uses this +method to get the a and b of the iir object.} & Create some special pole/zero models to test the 'pzm2ab' method indirect +with the tomiir method. Test with complex poles. +This UTPs define a simple method to get the a-, and b-value from a +complex pole. It uses the following code: +function [a,b] = utp\_cp2iir(pf, pq, fs) +w0 = pf*2*pi; +w02 = w0\^2; +k = (pq*w02 + 4*pq*fs*fs + 2*w0*fs) / (pq*w02); +b(1) = 1; +b(2) = (2*w02-8*fs*fs) / (k*w02); +b(3) = (pq*w02 + 4*pq*fs*fs - 2*w0*fs) / (k*pq*w02); +a(1) = 1/k; +a(2) = -2/k; +a(3) = -1/k; +a = a*-2; +end & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Check indirect the protected 'pzm2ab' method because tomiir uses this +method to get the a and b of the iir object.} & Create some special pole/zero models to test the 'pzm2ab' method indirect +with the tomiir method. Test with complex zeros. +This UTPs define a simple method to get the a-, and b-value from a +complex zero. It uses the following code: +function [a,b] = utp\_cz2iir(zf, zq, fs) +w0 = zf*2*pi; +w02 = w0\^2; +a(1) = (-zq*w02/2 - 2*zq*fs*fs - w0*fs) / (zq*w02); +a(2) = (-w02+4*fs*fs) / w02; +a(3) = (-zq*w02/2 - 2*zq*fs*fs + w0*fs) / (zq*w02); +b(1) = 1; +b(2) = -2; +b(3) = -1; +end & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Check indirect the protected 'pzm2ab' method because tomiir uses this +method to get the a and b of the iir object.} & Create some special pole/zero models to test the 'pzm2ab' method indirect +with the tomiir method. Test with real poles. +This UTPs define a simple method to get the a-, and b-value from a +real pole. It uses the following code: +function [a,b] = utp\_rp2iir(pf, fs) +w0 = pf*2*pi; +a(1) = w0 / (2*fs + w0); +a(2) = a(1); +b(1) = 1; +b(2) = (w0-2*fs) / (w0+2*fs); +end & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{14 } & \multirow{2}{5cm}{Check indirect the protected 'pzm2ab' method because tomiir uses this +method to get the a and b of the iir object.} & Create some special pole/zero models to test the 'pzm2ab' method indirect +with the tomiir method. Test with real zeros. +This UTPs define a simple method to get the a-, and b-value from a +real zero. It uses the following code: +function [a,b] = utp\_rp2iir(zf, fs) +w0 = zf*2*pi; +a(1) = (2*fs + w0) / w0; +a(2) = (-2*fs + w0) / w0; +b(1) = 1; +b(2) = 1; +end & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for pzmodel/tomiir.} +\label{tab:pzmodel_tomiir} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf pzmodel/type} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the type method works with a vector of PZMODEL objects as input.} & Test that the type method works for a vector of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the type method works with a matrix of PZMODEL objects as input.} & Test that the type method works for a matrix of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the type method works with a list of PZMODEL objects as input.} & Test that the type method works for a list of PZMODEL objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the type method works with a mix of different shaped PZMODEL objects +as input.} & Test that the type method works with an input of matrices and vectors +and single PZMODEL objects. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the type method properly applies history.} & The method type doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for pzmodel/type.} +\label{tab:pzmodel_type} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/char} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the char method works with a vector of RATIONAL objects as input.} & Test that the char method works for a vector of RATIONAL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the char method works with a matrix of RATIONAL objects as input.} & Test that the char method works for a matrix of RATIONAL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the char method works with a list of RATIONAL objects as input.} & Test that the char method works for a list of RATIONAL objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the char method works with a mix of different shaped RATIONAL objects +as input.} & Test that the char method works with an input of matrices and vectors +and single RATIONAL objects. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the char method properly applies history.} & The method char doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for rational/char.} +\label{tab:rational_char} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/copy} &&& \\ \hline +\endhead + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline +\caption{Unit tests for rational/copy.} +\label{tab:rational_copy} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/created} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the created method works with a vector of RATIONAL objects as +input.} & Test that the created method works for a vector of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'rav' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the created method works with a matrix of RATIONAL objects as +input.} & Test that the created method works for a matrix of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'ram' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the created method works with a list of RATIONAL objects as +input.} & Test that the created method works for a list of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the created method works with a mix of different shaped +RATIONAL objects as input.} & Test that the created method works with an input of matrices and +vectors and single RATIONAL objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the created method properly applies history} & This method doesn't change the input object, thus no history is added +to the object. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the created method can be used with the modify command.} & Tests that the created method can be used with the modify command. & pass \\ \cline{3-4} + & & 1) Check the single object +2) Check the matrix object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the created method retruns always a well defined time object +even for an empty input object.} & Test that the created method with an empty 'RATIONAL object & pass \\ \cline{3-4} + & & 1) Check that the output is a time object with a ell defined time. & pass \\ \hline +\caption{Unit tests for rational/created.} +\label{tab:rational_created} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/creator} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the creator method works with a vector of RATIONAL objects as +input.} & Test that the creator method works for a vector of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'rav' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the creator method works with a matrix of RATIONAL objects as +input.} & Test that the creator method works for a matrix of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'ram' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the creator method works with a list of RATIONAL objects as +input.} & The creator method doesn't work for a list of RATIONAL objects as input. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the creator method works with a mix of different shaped +RATIONAL objects as input.} & The creator method doesn't work with different shaped input objects. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the creator method properly applies history} & This method doesn't change the input object, thus no history is added +to the object. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the creator method can be used with the modify command.} & Tests that the creator method can be used with the modify command. & pass \\ \cline{3-4} + & & 1) Check the single object +2) Check the matrix object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the creator method retruns all creator(s)/modifier(s) which +are in the history.} & Test that the creator method uses the option 'all' direct or in a +plist. The test file must have the modifier 'first', 'second' and +'third' & pass \\ \cline{3-4} + & & 1) Check that out1 contains only one creator +2) Check that out2 contain more creator/modifier & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests the negative case for the option 'all'.} & Test that the creator method throws an error if the option 'all' is +used in connection with a matrix/vector of RATIONAL objects. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline +\caption{Unit tests for rational/creator.} +\label{tab:rational_creator} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/display} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the display method works with a vector of RATIONAL objects +as input.} & Test that the display method works for a vector of RATIONAL objects +as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the display method works with a matrix of RATIONAL objects +as input.} & Test that the display method works for a matrix of RATIONAL objects +as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the display method works with a list of RATIONAL objects as +input.} & Test that the display method works for a list of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the display method works with a mix of different shaped +RATIONAL objects as input.} & Test that the display method works with an input of matrices and +vectors and single RATIONAL objects as. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the display method properly applies history.} & The method display doesn't change the data, thus it is not possible +to check the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for rational/display.} +\label{tab:rational_display} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/eq} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the eq method works with a vector of RATIONAL objects as input.} & Test that the eq method works for a vector of RATIONAL objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the eq function. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the eq method works with a matrix of RATIONAL objects as input.} & Test that the eq method works for a matrix of RATIONAL objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the eq function. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the eq method works with a list of RATIONAL objects as input.} & The eq method doesn't works for a list of RATIONAL objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the eq method works with a mix of different shaped RATIONAL objects +as input.} & The eq method doesn't works for a list of RATIONAL objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the eq method properly applies history.} & The eq method doesn't change the RATIONAL object, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception +list with properties where a public set method exist.} & Test the eq method with the exception 'name'. Use the option +'internal' to suppress the history. It is necessary to add 'created' +to the exception list because 'pa' is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'iunits'. Use the option 'internal' +to suppress the history. It is necessary to add 'created' to the exception +list because 'pa' is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception +list with properties where a public set method exist.} & Test the eq method with the exception 'ounits'. Use the option +'internal' to suppress the history. It is necessary to add 'created' +to the exception list because 'pa' is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Test the eq method with an exception list which is in a plist.} & Test that the eq method uses the exception list in a plist. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline +\caption{Unit tests for rational/eq.} +\label{tab:rational_eq} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/get} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests the get method of the rational class.} & Test that the get returns returns the value of the specified +property. Do this for all properties of the RATIONAL object. & pass \\ \cline{3-4} + & & 1) Check the correct value of the output & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the get method works with a plist.} & Test that the get returns returns the value of the specified +property which is defined in a plist. & pass \\ \cline{3-4} + & & 1) Check the correct value of the output & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests the get method of the rational class.} & Test that the get throws an error if the input are more than +one RATIONAL object. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline +\caption{Unit tests for rational/get.} +\label{tab:rational_get} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/getlowerFreq} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests the getlowerFreq method of the rational class.} & Test that the getlowerFreq returns the lowest frequence of the pole +in the rational object. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests the getlowerFreq method of the rational class.} & Test that the getlowerFreq throws an error if the input are more than +one rational. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline +\caption{Unit tests for rational/getlowerFreq.} +\label{tab:rational_getlowerFreq} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/getupperFreq} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests the getupperFreq method of the rational class.} & Test that the getupperFreq returns the lowest frequence in the +rational object. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests the getupperFreq method of the rational class.} & Test that the getupperFreq throws an error if the input are more than +one rational. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline +\caption{Unit tests for rational/getupperFreq.} +\label{tab:rational_getupperFreq} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/index} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the index method works with a vector of RATIONAL objects as +input.} & Test that the index method works for a vector of RATIONAL objects as +input. The following indexing should work: +I = [ 1 2 3 ] or (I/J) = [(1,1), (1,2), (1,3)] & pass \\ \cline{3-4} + & & 1) Check that the index method selects the correct object. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the index method works with a matrix of RATIONAL objects as +input.} & Test that the index method works for a matrix of RATIONAL objects as +input. The following indexing should work: +I = [ 1 3 5 ] or (I/J) = [(1,1), (1,2), (1,3)] +[ 2 4 6 ] [(2,1), (2,2), (2,3)] & pass \\ \cline{3-4} + & & 1) Check that the index method selects the correct object. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the index method works with a list of RATIONAL objects as +input.} & The index method doesn't work for a list of RATIONAL objects as input. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the index method properly applies history.} & Test that the result of index have an additional history step. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds +to 'index'. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the index method works for the modifier command.} & Tests that the index method works for the modifier command. & pass \\ \cline{3-4} + & & 1) Check that the history-plist contains the used indices. +2) Check that the index method selects the correct object & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the index method can be controled with a plist. & pass \\ \cline{3-4} + & & 1) Check that the history-plist contains the used indices. +2) Check that the index method selects the correct object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the index method selects more objects if I have more indices.} & Test that the index method selects more objects if I have more indices. & pass \\ \cline{3-4} + & & 1) Check that the history-plist contains the used indices. +2) Check that the index method selects the correct object & pass \\ \hline +\caption{Unit tests for rational/index.} +\label{tab:rational_index} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/isprop} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the isprop method works with a vector of RATIONAL objects as +input.} & Test that the isprop method works for a vector of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'rav' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the isprop method works with a matrix of RATIONAL objects as +input.} & Test that the isprop method works for a matrix of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'ram' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the isprop method works with a list of RATIONAL objects as +input.} & Test that the isprop method works for a list of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the isprop method works with a mix of different shaped +RATIONAL objects as input.} & Test that the isprop method works with an input of matrices and +vectors and single RATIONAL objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the isprop method properly applies history.} & The method isprop doesn't change the object, thus it is not necessary +to apply history. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the isprop method works for each property.} & Test that the isprop method works for the properties: +'num', 'den', 'iunits', 'ounits', 'hist', 'name' & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the negative case and the not function command.} & Test that the isprop method retrun false for a unknown property and +for methods of the object. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline +\caption{Unit tests for rational/isprop.} +\label{tab:rational_isprop} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/loadobj} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check the shape of the loaded objects. & pass \\ \hline +\caption{Unit tests for rational/loadobj.} +\label{tab:rational_loadobj} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/ne} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the ne method works with a vector of RATIONAL objects as input.} & Test that the ne method works for a vector of RATIONAL objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the ne function. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the ne method works with a matrix of RATIONAL objects as input.} & Test that the ne method works for a matrix of RATIONAL objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the ne function. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the ne method works with a list of RATIONAL objects as input.} & The ne method doesn't works for a list of RATIONAL objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the ne method works with a mix of different shaped RATIONAL +objects as input.} & The ne method doesn't works for a list of RATIONAL objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the ne method properly applies history.} & The ne method doesn't change the RATIONAL object, thus will no history +added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the ne method with an exception list. +The function rational/ne use the function rational/eq so it is not +necessary to check all possibilities of the exception list.} & Test the ne method with the exception 'name'. Use the option +'internal' to suppress the history. It is necessary to add 'created' +to the exception list because ra is created at an other time. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the ne method with an exception list which is in a plist.} & Test that the ne method uses the exception list in a plist. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline +\caption{Unit tests for rational/ne.} +\label{tab:rational_ne} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/rational} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the rational method works with a vector of RATIONAL objects +as input.} & Test that the rational method works with a vector of RATIONAL objects +as input. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output RATIONALs is the same as the +input shape. +2) Check that each output RATIONAL is a copy of the input RATIONAL. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the rational method works with a matrix of RATIONAL objects +as input.} & Test that the rational method works with a matrix of RATIONAL objects +as input. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output RATIONALs is the same as the +input shape. +2) Check that each output RATIONAL is a copy of the input RATIONAL. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the rational method works with a list of RATIONAL objects as +input.} & Test that the rational method works with a list of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same of the +number in the input. +2) Check that each output RATIONAL is a copy of the input RATIONAL. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the rational method works with a mix of different shaped +RATIONALs as input.} & Test that the rational method works with a mix of different shaped +RATIONALs as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same of the +number in the input. +2) Check that each output RATIONAL is a copy of the input RATIONAL. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the rational method properly applies history.} & Test that the result of applying the rational method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'rational'. +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the rational method properly applies history to the copy +constructor.} & Test that the output can be processed back with the 'rebuild' method. +Test the constructor with a different number of inputs. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'rational'. +2) Check that the original objects are not changed by the setter +function +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the rational method properly applies history to the read +MAT-file constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests that the rational method properly applies history to the read +XML-file constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Tests that the rational method properly doesn't apply history to the +struct constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to 'rational'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Tests that the rational method properly applies history to the parfrac +constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'rational'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Tests that the rational method properly applies history to the pzmodel +constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'rational'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Tests that the rational method properly applies history to the +plist(filename) constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the save method doesn't change the input object +2) Check that the last two entries in the history of 'out' +doesn't corresponds to 'rational' and 'save' +3) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{14 } & \multirow{2}{5cm}{Tests that the RATIONAL method properly applies history to the +plist(conn) constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'rational'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{15 } & \multirow{2}{5cm}{Tests that the RATIONAL method properly applies history to the +plist(den || num) constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'rational'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{16 } & \multirow{2}{5cm}{Tests that the RATIONAL method properly applies history to the +plist(pzmodel) constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'rational'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{17 } & \multirow{2}{5cm}{Tests that the RATIONAL method properly applies history to the +plist(rational) constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'rational'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{18 } & \multirow{2}{5cm}{Tests that the RATIONAL method properly applies history to the +plist() constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'rational'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{19 } & \multirow{2}{5cm}{Tests that the RATIONAL method properly applies history to the conn+Id +constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'rational'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{20 } & \multirow{2}{5cm}{Tests that the RATIONAL method properly applies history to the +num + den object constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'rational'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{21 } & \multirow{2}{5cm}{Tests that the RATIONAL method properly applies history to the +num + den + name object constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'rational'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{22 } & \multirow{2}{5cm}{Tests that the RATIONAL method properly applies history to the +num + den + name + iunits + ounits object constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'rational'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for rational/rational.} +\label{tab:rational_rational} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/rebuild} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the rebuild method works with a vector of RATIONAL objects as +input.} & Test that the rebuild method works for a vector of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the rebuild method works with a matrix of RATIONAL objects as +input.} & Test that the rebuild method works for a matrix of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the rebuild method works with a list of RATIONAL objects as +input.} & Test that the rebuild method works for a list of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the rebuild method works with a mix of different shaped +RATIONAL objects as input.} & Test that the rebuild method works with an input of matrices and +vectors and single RATIONAL objects. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the rebuild method properly applies history.} & The method rebuild doesn't change the data, thus it is not possible +to check the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Check that the rebuild method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single +output variable. Additionaly check that the rebuild method works on +the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for rational/rebuild.} +\label{tab:rational_rebuild} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/resp} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the resp method works with a vector of RATIONAL objects as +input.} & Test that the resp method works for a vector of RATIONAL objects as +input. Test the method with an output and with no output +(a diagram must appear) & pass \\ \cline{3-4} + & & 1) Test the right number of lines in the diagram. +2) Check that the number of elements in 'out' is the same as in 'rav' +3) Check that each output RATIONAL contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the resp method works with a matrix of RATIONAL objects as +input.} & Tests that the resp method works with a matrix of RATIONAL objects as +input. Test the method with an output and with no output +(a diagram must appear) & pass \\ \cline{3-4} + & & 1) Test the right number of lines in the diagram. +2) Check that the number of elements in 'out' is the same as in 'ram' +3) Check that each output RATIONAL contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the resp method works with a list of RATIONAL objects as +input.} & Tests that the resp method works with a list of RATIONAL objects as +input. Test the method with an output and with no output +(a diagram must appear) & pass \\ \cline{3-4} + & & 1) Test the right number of lines in the diagram. +2) Check that the number of elements in 'out' is the same as in 'rain' +3) Check that each output RATIONAL contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the resp method works with a mix of different shaped +RATIONAL objects as input.} & Tests that the resp method works with a mix of different shaped +RATIONAL objects as input. Test the method with an output and with no +output (a diagram must appear) & pass \\ \cline{3-4} + & & 1) Test the right number of lines in the diagram. +2) Check that the number of elements in 'out' is the same as in 'rain' +3) Check that each output RATIONAL contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the resp method properly applies history.} & Test that the result of applying the resp method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'resp'. +2) Check that re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that modify command plots the response into a diagram.} & Tests that modify command plots the response into a diagram. & pass \\ \cline{3-4} + & & 1) Check the response diagram. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the shape of the output.} & Test that the output AO of the resp method keeps the shape of the used +input f vector. & pass \\ \cline{3-4} + & & 1) Check that the shape of the data doesn't change. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the resp method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single +output variable. Additionaly check that the rebuild method works on +the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the resp method uses the x-data of an input AO for f-vector.} & Call the method with different method to pass an AO in. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Check that the resp method uses the specified f-vector to compute the +response.} & Call the method with different method to pass an f-vector in. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Check that the resp method uses the specified f1, f2, and nf to compute the response.} & Call the method with different method to pass f1, f2, and nf in. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Check that the resp method uses the specified f1, f2, and nf to compute +the response.} & Call the method with different method to pass f1, f2, and nf in. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for rational/resp.} +\label{tab:rational_resp} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/save} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the save method works with a vector of RATIONAL objects as input.} & Test that the save method works for a vector of RATIONAL objects as input. +Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the +same as in 'rav' +2) Check that the loaded objects are the same as the saved objects. +3) The outputs 'out1' and 'out2' must be the same. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the save method works with a matrix of RATIONAL objects as +input.} & Test that the save method works for a matrix of RATIONAL objects as +input. Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the +same as in 'ram' +2) Check that the loaded objects are the same as the saved objects. +3) The outputs 'out1' and 'out2' must be the same. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the save method works with a list of RATIONAL objects as input.} & Test that the save method works for a list of RATIONAL objects as input. +Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the +same as in the list +2) Check that the loaded objects are the same as the saved objects. +3) The outputs 'out1' and 'out2' must be the same. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the save method works with a mix of different shaped RATIONAL +objects as input.} & Test that the save method works with an input of matrices and vectors +and single RATIONAL objects. Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output RATIONAL object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the save method properly applies history.} & Test that the result of applying the save method can be processed back +to an m-file. Do this for both extensions 'mat' and 'xml' & pass \\ \cline{3-4} + & & 1) Check that the history applies to the output object. Check that +save doesn't add a history step to the input object. +2) Check that the read object doesn't contain the save + load history steps. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the save method works with the modify command.} & Use the save method with the modifier command. & pass \\ \cline{3-4} + & & 1) Check that the save method doesn't apply the history. +2) Check the output against the input. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the save method uses the filename which is stored in a plist. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the save method with different complex RATIONAL objects} & Test the save method with different complex RATIONAL objects & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline +\caption{Unit tests for rational/save.} +\label{tab:rational_save} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/setIunits} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setIunits method works with a vector of RATIONAL objects +as input.} & Test that the setIunits method works for a vector of RATIONAL objects +as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'rav' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setIunits method works with a matrix of RATIONAL objects +as input.} & Test that the setIunits method works for a matrix of RATIONAL objects +as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'ram' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setIunits method works with a list of RATIONAL objects as +input.} & Test that the setIunits method works for a list of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setIunits method works with a mix of different shaped +RATIONAL objects as input.} & Test that the setIunits method works with an input of matrices and +vectors and single RATIONAL objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setIunits method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setIunits method can be +processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setIunits'. +2) Check that the last entry in the history of 'out2' NOT corresponds to +'setIunits'. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setIunits method can modify the input RATIONAL object.} & Test that the setIunits method can modify the input RATIONAL object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'ra3' and 'ain' are now different. +2) Check that 'ain' has the correct iunits field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setIunits method can set the property with a plist.} & Test that the setIunits method can modify the property 'iunits' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct iunits field +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setIunits method pass back the output objects to a list +of output variables or to a single variable.} & Call the method with a list of output variables and with a single +output variable. Additionaly check that the rebuild method works on +the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for rational/setIunits.} +\label{tab:rational_setIunits} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/setName} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setName method works with a vector of RATIONAL objects +as input.} & Test that the setName method works for a vector of RATIONAL objects +as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'rav' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setName method works with a matrix of RATIONAL objects +as input.} & Test that the setName method works for a matrix of RATIONAL objects +as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'ram' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setName method works with a list of RATIONAL objects as +input.} & Test that the setName method works for a list of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setName method works with a mix of different shaped +RATIONAL objects as input.} & Test that the setName method works with an input of matrices and +vectors and single RATIONAL objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setName method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setName method can be processed +back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setName'. +2) Check that the last entry in the history of 'out2' NOT corresponds +to 'setName'. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setName method can modify the input RATIONAL object.} & Test that the setName method can modify the input RATIONAL object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'ra3' and 'ain' are now different. +2) Check that 'ain' has the correct name field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setName method can set the property with a plist.} & Test that the setName method can modify the property 'name' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct name field +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setName method pass back the output objects to a list +of output variables or to a single variable.} & Call the method with a list of output variables and with a single +output variable. Additionaly check that the rebuild method works on +the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for rational/setName.} +\label{tab:rational_setName} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/setOunits} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setOunits method works with a vector of RATIONAL objects +as input.} & Test that the setOunits method works for a vector of RATIONAL objects +as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'rav' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setOunits method works with a matrix of RATIONAL objects +as input.} & Test that the setOunits method works for a matrix of RATIONAL objects +as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'ram' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setOunits method works with a list of RATIONAL objects as +input.} & Test that the setOunits method works for a list of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setOunits method works with a mix of different shaped +RATIONAL objects as input.} & Test that the setOunits method works with an input of matrices and +vectors and single RATIONAL objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setOunits method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setOunits method can be +processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setOunits'. +2) Check that the last entry in the history of 'out2' NOT corresponds to +'setOunits'. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setOunits method can modify the input RATIONAL object.} & Test that the setOunits method can modify the input RATIONAL object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'ra3' and 'ain' are now different. +2) Check that 'ain' has the correct ounits field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setOunits method can set the property with a plist.} & Test that the setOunits method can modify the property 'ounits' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct ounits field +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setOunits method pass back the output objects to a list +of output variables or to a single variable.} & Call the method with a list of output variables and with a single +output variable. Additionaly check that the rebuild method works on +the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for rational/setOunits.} +\label{tab:rational_setOunits} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/string} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the string method works with a vector of RATIONAL objects as +input.} & Test that the string method works for a vector of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the string method works with a matrix of RATIONAL objects as +input.} & Test that the string method works for a matrix of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the string method works with a list of RATIONAL objects as +input.} & Test that the string method works for a list of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the string method works with a mix of different shaped +RATIONAL objects as input.} & Test that the string method works with an input of matrices and +vectors and single RATIONAL objects. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the string method properly applies history.} & The method string doesn't change the data, thus it is not possible to +check the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the string method doesn't work if the RATIONAL object have +more than one history step.} & The method string throws an error because the input object have more +than one history step. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for rational/string.} +\label{tab:rational_string} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf rational/type} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the type method works with a vector of RATIONAL objects as +input.} & Test that the type method works for a vector of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the type method works with a matrix of RATIONAL objects as +input.} & Test that the type method works for a matrix of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the type method works with a list of RATIONAL objects as +input.} & Test that the type method works for a list of RATIONAL objects as +input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the type method works with a mix of different shaped RATIONAL +objects as input.} & Test that the type method works with an input of matrices and vectors +and single RATIONAL objects. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the type method properly applies history.} & The method type doesn't change the data, thus it is not possible to +check the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for rational/type.} +\label{tab:rational_type} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf smodel/addAliases} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [smodel/addAliases] method works for a list of objects as input.} & Tests that the [smodel/addAliases] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [smodel/addAliases] method properly applies history.} & Test that the result of applying the [smodel/addAliases] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[smodel/addAliases]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [smodel/addAliases] method can modify the input AO.} & Test that the [smodel/addAliases] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [smodel/addAliases] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for smodel/addAliases.} +\label{tab:smodel_addAliases} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf smodel/addParameters} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/addParameters] method works with any shape of objects as input.} & Test that the [smodel/addParameters] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/addParameters] method works with any shape of objects as input.} & Test that the [smodel/addParameters] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/addParameters] method works with any shape of objects as input.} & Test that the [smodel/addParameters] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/addParameters] method works with any shape of objects as input.} & Test that the [smodel/addParameters] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/addParameters] method works with any shape of objects as input.} & Test that the [smodel/addParameters] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/addParameters] method works with any shape of objects as input.} & Test that the [smodel/addParameters] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/addParameters] method works with any shape of objects as input.} & Test that the [smodel/addParameters] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/addParameters] method works with any shape of objects as input.} & Test that the [smodel/addParameters] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [smodel/addParameters] method can modify the input AO.} & Test that the [smodel/addParameters] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [smodel/addParameters] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [smodel/addParameters] method works for a list of objects as input.} & Tests that the [smodel/addParameters] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [smodel/addParameters] method properly applies history.} & Test that the result of applying the [smodel/addParameters] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[smodel/addParameters]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline +\caption{Unit tests for smodel/addParameters.} +\label{tab:smodel_addParameters} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf smodel/clearAliases} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/clearAliases] method works with any shape of objects as input.} & Test that the [smodel/clearAliases] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [smodel/clearAliases] method works for a list of objects as input.} & Tests that the [smodel/clearAliases] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [smodel/clearAliases] method properly applies history.} & Test that the result of applying the [smodel/clearAliases] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[smodel/clearAliases]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [smodel/clearAliases] method can modify the input AO.} & Test that the [smodel/clearAliases] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [smodel/clearAliases] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for smodel/clearAliases.} +\label{tab:smodel_clearAliases} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf smodel/copy} &&& \\ \hline +\endhead + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline +\caption{Unit tests for smodel/copy.} +\label{tab:smodel_copy} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf smodel/loadobj} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check the shape of the loaded objects. & pass \\ \hline +\caption{Unit tests for smodel/loadobj.} +\label{tab:smodel_loadobj} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf smodel/setAliases} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [smodel/setAliases] method works for a list of objects as input.} & Tests that the [smodel/setAliases] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [smodel/setAliases] method properly applies history.} & Test that the result of applying the [smodel/setAliases] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[smodel/setAliases]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [smodel/setAliases] method can modify the input AO.} & Test that the [smodel/setAliases] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [smodel/setAliases] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for smodel/setAliases.} +\label{tab:smodel_setAliases} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf smodel/setParameters} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/setParameters] method works with any shape of objects as input.} & Test that the [smodel/setParameters] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/setParameters] method works with any shape of objects as input.} & Test that the [smodel/setParameters] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/setParameters] method works with any shape of objects as input.} & Test that the [smodel/setParameters] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/setParameters] method works with any shape of objects as input.} & Test that the [smodel/setParameters] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/setParameters] method works with any shape of objects as input.} & Test that the [smodel/setParameters] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/setParameters] method works with any shape of objects as input.} & Test that the [smodel/setParameters] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/setParameters] method works with any shape of objects as input.} & Test that the [smodel/setParameters] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/setParameters] method works with any shape of objects as input.} & Test that the [smodel/setParameters] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [smodel/setParameters] method can modify the input AO.} & Test that the [smodel/setParameters] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [smodel/setParameters] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [smodel/setParameters] method works for a list of objects as input.} & Tests that the [smodel/setParameters] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [smodel/setParameters] method properly applies history.} & Test that the result of applying the [smodel/setParameters] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[smodel/setParameters]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline +\caption{Unit tests for smodel/setParameters.} +\label{tab:smodel_setParameters} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf smodel/setParams} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/setParams] method works with any shape of objects as input.} & Test that the [smodel/setParams] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/setParams] method works with any shape of objects as input.} & Test that the [smodel/setParams] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/setParams] method works with any shape of objects as input.} & Test that the [smodel/setParams] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/setParams] method works with any shape of objects as input.} & Test that the [smodel/setParams] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/setParams] method works with any shape of objects as input.} & Test that the [smodel/setParams] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/setParams] method works with any shape of objects as input.} & Test that the [smodel/setParams] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/setParams] method works with any shape of objects as input.} & Test that the [smodel/setParams] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/setParams] method works with any shape of objects as input.} & Test that the [smodel/setParams] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{Tests that the [smodel/setParams] method works with any shape of objects as input.} & Test that the [smodel/setParams] method works for any shape of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. +3) Rebuild the object & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [smodel/setParams] method works for a list of objects as input.} & Tests that the [smodel/setParams] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [smodel/setParams] method properly applies history.} & Test that the result of applying the [smodel/setParams] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[smodel/setParams]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [smodel/setParams] method can modify the input AO.} & Test that the [smodel/setParams] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [smodel/setParams] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for smodel/setParams.} +\label{tab:smodel_setParams} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf smodel/setTrans} &&& \\ \hline +\endhead + \multirow{2}{3cm}{minfo } & \multirow{2}{5cm}{Tests that the getInfo call works for this a general setter method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [smodel/setTrans] method works for a list of objects as input.} & Tests that the [smodel/setTrans] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [smodel/setTrans] method works for a list of objects as input.} & Tests that the [smodel/setTrans] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [smodel/setTrans] method properly applies history.} & Test that the result of applying the [smodel/setTrans] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[smodel/setTrans]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [smodel/setTrans] method can modify the input AO.} & Test that the [smodel/setTrans] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [smodel/setTrans] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for smodel/setTrans.} +\label{tab:smodel_setTrans} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf smodel/setValues} &&& \\ \hline +\endhead + \multirow{2}{3cm}{minfo } & \multirow{2}{5cm}{Tests that the getInfo call works for this a general setter method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [smodel/setValues] method works for a list of objects as input.} & Tests that the [smodel/setValues] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [smodel/setValues] method works for a list of objects as input.} & Tests that the [smodel/setValues] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [smodel/setValues] method properly applies history.} & Test that the result of applying the [smodel/setValues] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[smodel/setValues]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [smodel/setValues] method can modify the input AO.} & Test that the [smodel/setValues] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [smodel/setValues] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for smodel/setValues.} +\label{tab:smodel_setValues} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf smodel/setXunits} &&& \\ \hline +\endhead + \multirow{2}{3cm}{minfo } & \multirow{2}{5cm}{Tests that the getInfo call works for this a general setter method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [smodel/setXunits] method works for a list of objects as input.} & Tests that the [smodel/setXunits] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [smodel/setXunits] method works for a list of objects as input.} & Tests that the [smodel/setXunits] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [smodel/setXunits] method properly applies history.} & Test that the result of applying the [smodel/setXunits] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[smodel/setXunits]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [smodel/setXunits] method can modify the input AO.} & Test that the [smodel/setXunits] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [smodel/setXunits] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for smodel/setXunits.} +\label{tab:smodel_setXunits} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf smodel/setXvals} &&& \\ \hline +\endhead + \multirow{2}{3cm}{minfo } & \multirow{2}{5cm}{Tests that the getInfo call works for this a general setter method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [smodel/setXvals] method works for a list of objects as input.} & Tests that the [smodel/setXvals] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [smodel/setXvals] method works for a list of objects as input.} & Tests that the [smodel/setXvals] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [smodel/setXvals] method properly applies history.} & Test that the result of applying the [smodel/setXvals] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[smodel/setXvals]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [smodel/setXvals] method can modify the input AO.} & Test that the [smodel/setXvals] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [smodel/setXvals] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for smodel/setXvals.} +\label{tab:smodel_setXvals} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf smodel/setXvar} &&& \\ \hline +\endhead + \multirow{2}{3cm}{minfo } & \multirow{2}{5cm}{Tests that the getInfo call works for this a general setter method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [smodel/setXvar] method works for a list of objects as input.} & Tests that the [smodel/setXvar] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [smodel/setXvar] method works for a list of objects as input.} & Tests that the [smodel/setXvar] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [smodel/setXvar] method properly applies history.} & Test that the result of applying the [smodel/setXvar] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[smodel/setXvar]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [smodel/setXvar] method can modify the input AO.} & Test that the [smodel/setXvar] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [smodel/setXvar] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for smodel/setXvar.} +\label{tab:smodel_setXvar} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf smodel/setYunits} &&& \\ \hline +\endhead + \multirow{2}{3cm}{minfo } & \multirow{2}{5cm}{Tests that the getInfo call works for this a general setter method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericAnyShape } & \multirow{2}{5cm}{} & & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [smodel/setYunits] method works for a list of objects as input.} & Tests that the [smodel/setYunits] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericList } & \multirow{2}{5cm}{Tests that the [smodel/setYunits] method works for a list of objects as input.} & Tests that the [smodel/setYunits] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'objs' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{genericHistory } & \multirow{2}{5cm}{Tests that the [smodel/setYunits] method properly applies history.} & Test that the result of applying the [smodel/setYunits] method can be processed +back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[smodel/setYunits]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{genericModify } & \multirow{2}{5cm}{Tests that the [smodel/setYunits] method can modify the input AO.} & Test that the [smodel/setYunits] method can modify the input object by calling +with no output and that the method doesn't change the input of the +function notation (with a equal sign). & pass \\ \cline{3-4} + & & 1) Check that the modified input is changed by the method +2) Check that 'out' and 'obj\_eq' are now different. +3) Check that 'obj\_eq' is not changed +4) Check that out and amodi are the same & pass \\ \hline + \multirow{2}{3cm}{genericOutput } & \multirow{2}{5cm}{Check that the [smodel/setYunits] method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for smodel/setYunits.} +\label{tab:smodel_setYunits} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf smodel/smodel} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [smodel/smodel] method works with a vector of objects as input.} & Test that the [smodel/smodel] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [smodel/smodel] method works with a matrix of objects as input.} & Test that the [smodel/smodel] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [smodel/smodel] method works with a list of objects as input.} & Test that the [smodel/smodel] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [smodel/smodel] method works with a mix of different arrays of objects as input.} & Tests that the [smodel/smodel] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [smodel/smodel] method properly applies history.} & Test that the result of applying the [smodel/smodel] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[smodel/smodel]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the smodel can read older MAT files which have different +values in 'xvals'} & Tests that the smodel can read older MAT files which have different +values in 'xvals' +The smodel object was created with the commands: +s = smodel('A.*(t >= toff)'); +s.setXvar('t'); +s.setParams({'A','toff'}, {5,300}); +s.setName('Step at toff'); +s.setDescription('Step function of amplitude A at time toff'); +s.setXunits('Hz\^1/2 km\^2'); +s.setYunits('s\^2 m\^-1'); +s.setXvals(1:1e3); +s.setAliasNames('a'); +s.setAliasValues(8); & pass \\ \cline{3-4} + & & 1) Check that the objects are quite the same +2) Check that 'xvals' is a cell-array with the numbers from 1 to 1000 & pass \\ \hline + \multirow{2}{3cm}{60 } & \multirow{2}{5cm}{Tests that the constructor method doesn't apply history to the read +MAT-file constructor.} & Tests that the constructor method doesn't apply history to the read +MAT-file constructor. & pass \\ \cline{3-4} + & & 1) Check that the history is the same as the history of the saved +object. Because save and load shouldn't add a history step. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{61 } & \multirow{2}{5cm}{Tests that the constructor properly applies history to the read +XML-file constructor.} & Tests that the constructor properly applies history to the read +XML-file constructor. & pass \\ \cline{3-4} + & & 1) Check that the history is the same as the history of the saved +object. Because save and load shouldn't add a history step. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{62 } & \multirow{2}{5cm}{Tests that the constructor properly applies history in the struct constructor.} & Tests that the constructor properly applies history in the struct constructor. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to the class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{64 } & \multirow{2}{5cm}{Tests that the contructor properly applies history to the +plist(filename) constructor.} & Tests that the contructor properly applies history to the +plist(filename) constructor. & pass \\ \cline{3-4} + & & 1) Check that the save method doesn't change the input object +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{65 } & \multirow{2}{5cm}{Tests that the contructed object can be submitted and retrieved.} & Tests that the contructed object can be submitted and retrieved. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +the class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{68 } & \multirow{2}{5cm}{Tests that the constructor properly applies history to the conn+Id constructor.} & Tests that the constructor properly applies history to the conn+Id +constructor. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for smodel/smodel.} +\label{tab:smodel_smodel} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ssm/addParameters} &&& \\ \hline +\endhead + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ssm/addParameters] method works with a vector of objects as input.} & Test that the [ssm/addParameters] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ssm/addParameters] method works with a matrix of objects as input.} & Test that the [ssm/addParameters] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ssm/addParameters] method works with a list of objects as input.} & Test that the [ssm/addParameters] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ssm/addParameters] method works with a list of objects as input.} & Test that the [ssm/addParameters] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ssm/addParameters] method works with a mix of different arrays of objects as input.} & Tests that the [ssm/addParameters] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ssm/addParameters] method properly applies history.} & Test that the result of applying the [ssm/addParameters] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ssm/addParameters]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline +\caption{Unit tests for ssm/addParameters.} +\label{tab:ssm_addParameters} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ssm/copy} &&& \\ \hline +\endhead + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline +\caption{Unit tests for ssm/copy.} +\label{tab:ssm_copy} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ssm/loadobj} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check the shape of the loaded objects. & pass \\ \hline +\caption{Unit tests for ssm/loadobj.} +\label{tab:ssm_loadobj} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf model/DFACS} &&& \\ \hline +\endhead + \multirow{2}{3cm}{901 } & \multirow{2}{5cm}{Tests that the model has a meaningful name.} & Test that the model has a meaningful name. & pass \\ \cline{3-4} + & & 1) Check that the name of the object is not empty and not equal to 'none' & pass \\ \hline + \multirow{2}{3cm}{902 } & \multirow{2}{5cm}{Tests that the model has a meaningful description.} & Test that the model has a meaningful description. & pass \\ \cline{3-4} + & & 1) Check that the description of the object is not empty and not equal to 'none' & pass \\ \hline + \multirow{2}{3cm}{903 } & \multirow{2}{5cm}{Tests that the model responds to 'DIM' configuration key.} & Test that the model responds to 'DIM' configuration key. & pass \\ \cline{3-4} + & & 1) Check that the model builds with DIM==1 +2) Check that the model builds with DIM==2 +3) Check that the model builds with DIM==3 +4) Check that the 3 models are different & pass \\ \hline +\caption{Unit tests for model/DFACS.} +\label{tab:model_DFACS} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf model/IFO} &&& \\ \hline +\endhead + \multirow{2}{3cm}{901 } & \multirow{2}{5cm}{Tests that the model has a meaningful name.} & Test that the model has a meaningful name. & pass \\ \cline{3-4} + & & 1) Check that the name of the object is not empty and not equal to 'none' & pass \\ \hline + \multirow{2}{3cm}{902 } & \multirow{2}{5cm}{Tests that the model has a meaningful description.} & Test that the model has a meaningful description. & pass \\ \cline{3-4} + & & 1) Check that the description of the object is not empty and not equal to 'none' & pass \\ \hline + \multirow{2}{3cm}{903 } & \multirow{2}{5cm}{Tests that the model responds to 'DIM' configuration key.} & Test that the model responds to 'DIM' configuration key. & pass \\ \cline{3-4} + & & 1) Check that the model builds with DIM==1 +2) Check that the model builds with DIM==2 +3) Check that the model builds with DIM==3 +4) Check that the 3 models are different & pass \\ \hline +\caption{Unit tests for model/IFO.} +\label{tab:model_IFO} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf ssm/ssm} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the [ssm/ssm] method works with a vector of objects as input.} & Test that the [ssm/ssm] method works for a vector of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'vec' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the [ssm/ssm] method works with a matrix of objects as input.} & Test that the [ssm/ssm] method works for a matrix of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the [ssm/ssm] method works with a list of objects as input.} & Test that the [ssm/ssm] method works for a list of objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the [ssm/ssm] method works with a mix of different arrays of objects as input.} & Tests that the [ssm/ssm] method works with a mix of different arrays of +objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'mat' +2) Check that each output object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the [ssm/ssm] method properly applies history.} & Test that the result of applying the [ssm/ssm] method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'[ssm/ssm]'. +2) Check that the re-built object is the same object as the input. & pass \\ \hline + \multirow{2}{3cm}{60 } & \multirow{2}{5cm}{Tests that the constructor method doesn't apply history to the read +MAT-file constructor.} & Tests that the constructor method doesn't apply history to the read +MAT-file constructor. & pass \\ \cline{3-4} + & & 1) Check that the history is the same as the history of the saved +object. Because save and load shouldn't add a history step. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{61 } & \multirow{2}{5cm}{Tests that the constructor properly applies history to the read +XML-file constructor.} & Tests that the constructor properly applies history to the read +XML-file constructor. & pass \\ \cline{3-4} + & & 1) Check that the history is the same as the history of the saved +object. Because save and load shouldn't add a history step. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{62 } & \multirow{2}{5cm}{Tests that the constructor properly applies history in the struct constructor.} & Tests that the constructor properly applies history in the struct constructor. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to the class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{63 } & \multirow{2}{5cm}{Tests that the constructor properly applies history to the pzmodel constructor.} & Tests that the constructor properly applies history to the pzmodel constructor. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to the class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{64 } & \multirow{2}{5cm}{Tests that the contructor properly applies history to the +plist(filename) constructor.} & Tests that the contructor properly applies history to the +plist(filename) constructor. & pass \\ \cline{3-4} + & & 1) Check that the save method doesn't change the input object +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{65 } & \multirow{2}{5cm}{Tests that the contructed object can be submitted and retrieved.} & Tests that the contructed object can be submitted and retrieved. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +the class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{66 } & \multirow{2}{5cm}{Tests that the construuctor properly works with the plist(pzmodel) +constructor.} & Tests that the constructor properly works with the plist(pzmodel) +constructor. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'ssm'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{67 } & \multirow{2}{5cm}{Tests that the constructor properly applies history to the +pole/zero model + plist object constructor.} & Tests that the constructor properly applies history to the +pole/zero model + plist object constructor. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{68 } & \multirow{2}{5cm}{Tests that the constructor properly applies history to the conn+Id constructor.} & Tests that the constructor properly applies history to the conn+Id +constructor. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +class name. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for ssm/ssm.} +\label{tab:ssm_ssm} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf time/datenum} &&& \\ \hline +\endhead + \multirow{2}{3cm}{901 } & \multirow{2}{5cm}{Tests the 'datenum' method.} & Create a time object and use datenum to produce a serial date number. & pass \\ \cline{3-4} + & & Check that the returned value is the same as the one you get when +using time/format with the same format string when converted using +MATLAB's datestr() function. & pass \\ \hline + \multirow{2}{3cm}{901 } & \multirow{2}{5cm}{Tests the 'datenum' method.} & Create a time object and use datenum to produce a serial date number. & pass \\ \cline{3-4} + & & Check that the returned value is the same as the one you get when +using time/format with the same format string when converted using +MATLAB's datestr() function. & pass \\ \hline + \multirow{2}{3cm}{903 } & \multirow{2}{5cm}{Tests 'double' method.} & Set the time-zone to PST and create a time object and use datenum to +produce a serial date number. & pass \\ \cline{3-4} + & & Check that the returned value is the same as the one you get when +using time/format with the same format string when converted using +MATLAB's datestr() function. & pass \\ \hline +\caption{Unit tests for time/datenum.} +\label{tab:time_datenum} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf time/double} &&& \\ \hline +\endhead + \multirow{2}{3cm}{901 } & \multirow{2}{5cm}{Tests 'double' method.} & Use the double() method on single time objects and vectors of time +objects. & pass \\ \cline{3-4} + & & Check that double returns the expected numerical values for each +case. & pass \\ \hline +\caption{Unit tests for time/double.} +\label{tab:time_double} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf time/format} &&& \\ \hline +\endhead + \multirow{2}{3cm}{901 } & \multirow{2}{5cm}{Tests 'format' static method.} & Use the static format method to produce a number of time strings in +different formats and for different time-zones. & pass \\ \cline{3-4} + & & Check that the returned strings match the expected strings. & pass \\ \hline +\caption{Unit tests for time/format.} +\label{tab:time_format} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf time/minus} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests time object minus operator.} & Compute the difference between time objects and doubles. & pass \\ \cline{3-4} + & & Check the resulting time objects have the correct values. & pass \\ \hline +\caption{Unit tests for time/minus.} +\label{tab:time_minus} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf time/parse} &&& \\ \hline +\endhead + \multirow{2}{3cm}{901 } & \multirow{2}{5cm}{Tests 'parse' static method with time string only.} & Use parse() to parse different time strings with different time-zones +set. & pass \\ \cline{3-4} + & & Check the resulting millsecond values are the expected ones. & pass \\ \hline + \multirow{2}{3cm}{902 } & \multirow{2}{5cm}{Tests 'parse' static method with time and format strings.} & Use parse() to parse different time strings with different time-zones +set. The time-string format is specified as a second input argument. & pass \\ \cline{3-4} + & & Check the resulting millsecond values are the expected ones. & pass \\ \hline + \multirow{2}{3cm}{903 } & \multirow{2}{5cm}{Tests 'parse' static method with time string and numeric format.} & Use parse() to parse different time strings using the supported +MATLAB numeric time formats. & pass \\ \cline{3-4} + & & Check the resulting millsecond values against the result of parsing +a time string. (See time/parse utp\_902.) & pass \\ \hline + \multirow{2}{3cm}{904 } & \multirow{2}{5cm}{Tests 'parse' static method with time string containing timezone information.} & Use parse() to parse different time strings which contain the +time-zone. & pass \\ \cline{3-4} + & & Check the resulting millisecond value is the expected one. & pass \\ \hline + \multirow{2}{3cm}{905 } & \multirow{2}{5cm}{Tests 'parse' static method with time string and timezone specification.} & Use parse() to parse different time strings when passing the +time-zone as the third argument. The second argument (the format) is +left empty. & pass \\ \cline{3-4} + & & Check the resulting millisecond value is the expected one. & pass \\ \hline +\caption{Unit tests for time/parse.} +\label{tab:time_parse} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf time/plus} &&& \\ \hline +\endhead + \multirow{2}{3cm}{101 } & \multirow{2}{5cm}{Tests time object plus operator.} & Compute the sum of time objects and doubles. & pass \\ \cline{3-4} + & & Check the resulting time objects have the correct values. & pass \\ \hline +\caption{Unit tests for time/plus.} +\label{tab:time_plus} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf time/string} &&& \\ \hline +\endhead + \multirow{2}{3cm}{901 } & \multirow{2}{5cm}{Tests that the output of the 'string' method can be used to recreate the time object.} & Use string to convert a time object to a string. Use eval on the +result to recreate a time object. & pass \\ \cline{3-4} + & & Check the recreated time object matches the original. & pass \\ \hline +\caption{Unit tests for time/string.} +\label{tab:time_string} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf time/time} &&& \\ \hline +\endhead + \multirow{2}{3cm}{901 } & \multirow{2}{5cm}{Tests time object constructor without arguments. Should return the current time.} & Call the time() constructor with no inputs. & pass \\ \cline{3-4} + & & No test can be done here since we don't know the time when the +constructor is called. We could check that the resulting time is > +0, but that's not so useful. & pass \\ \hline + \multirow{2}{3cm}{902 } & \multirow{2}{5cm}{Tests time object constructor from numeric value.} & Call the time() constructor with a numeric input (number of seconds +since epoch). & pass \\ \cline{3-4} + & & Check the time object has the expected millisecond value. & pass \\ \hline + \multirow{2}{3cm}{903 } & \multirow{2}{5cm}{Tests time object constructor from string.} & Call the time() constructor with different time-string inputs. & pass \\ \cline{3-4} + & & Check the time objects have the expected millisecond values. & pass \\ \hline + \multirow{2}{3cm}{904 } & \multirow{2}{5cm}{Tests time object constructor from a cell array of strings.} & Call the time() constructor with cell-array of time-strings. & pass \\ \cline{3-4} + & & Check the time objects have the expected millisecond values. & pass \\ \hline + \multirow{2}{3cm}{905 } & \multirow{2}{5cm}{Tests time object constructor from plist with 'time' parameter.} & Call the time() constructor with plist input. Check a plist with a +numeric value and a plist with a time-string. & pass \\ \cline{3-4} + & & Check the time objects have the expected millisecond values. & pass \\ \hline + \multirow{2}{3cm}{906 } & \multirow{2}{5cm}{Tests time object constructor from plist with 'milliseconds' parameter} & Call the time() constructor with plist input using the 'millisecond' +key. & pass \\ \cline{3-4} + & & Check the time object has the expected millisecond value. & pass \\ \hline + \multirow{2}{3cm}{907 } & \multirow{2}{5cm}{Tests time object constructor from plist with more parameters.} & Call the time() constructor with plist input containing the time +string and the time-zone. +key. & pass \\ \cline{3-4} + & & Check the time objects have the expected millisecond values. & pass \\ \hline + \multirow{2}{3cm}{908 } & \multirow{2}{5cm}{Tests time object constructor from structure.} & Call the time() constructor with an input structure obtained from +calling struct() on a time object. +key. & pass \\ \cline{3-4} + & & Check the original and reconstructed time objects have the same +millisecond value. & pass \\ \hline + \multirow{2}{3cm}{909 } & \multirow{2}{5cm}{Tests time object constructor from string and time format.} & Call the time() constructor with an input time string and time format +string. & pass \\ \cline{3-4} + & & Check the resulting time object has the expected millisecond value. & pass \\ \hline +\caption{Unit tests for time/time.} +\label{tab:time_time} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf time/timeformat} &&& \\ \hline +\endhead + \multirow{2}{3cm}{901 } & \multirow{2}{5cm}{Tests that the method really returns what is in the user preferences.} & Check that the timeformat method runs without error. & pass \\ \cline{3-4} + & & Check that the returned value is the same as the one set in the +user preferences. & pass \\ \hline + \multirow{2}{3cm}{902 } & \multirow{2}{5cm}{Change user preferences and do it again.} & Set the time string format in the preferences and check that the +timeformat method runs without error. & pass \\ \cline{3-4} + & & Check that the returned value is the same as the one set in the +user preferences. & pass \\ \hline + \multirow{2}{3cm}{903 } & \multirow{2}{5cm}{Change user preferences and do it again.} & Set the time string format in the preferences and check that the +timeformat method runs without error. & pass \\ \cline{3-4} + & & Check that the returned value is the same as the one set in the +user preferences. & pass \\ \hline +\caption{Unit tests for time/timeformat.} +\label{tab:time_timeformat} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf time/timezone} &&& \\ \hline +\endhead + \multirow{2}{3cm}{901 } & \multirow{2}{5cm}{Tests that the method really returns what is in the user preferences.} & Call the static timezone method. & pass \\ \cline{3-4} + & & Check the resulting timezone object against the one in the user +preferences. & pass \\ \hline + \multirow{2}{3cm}{902 } & \multirow{2}{5cm}{Change user preferences and do it again.} & Set the timezone in the preferences then call the static timezone method. & pass \\ \cline{3-4} + & & Check the resulting timezone object against the one in the user +preferences. & pass \\ \hline + \multirow{2}{3cm}{903 } & \multirow{2}{5cm}{Change user preferences and do it again.} & Set the timezone in the preferences then call the static timezone method. & pass \\ \cline{3-4} + & & Check the resulting timezone object against the one in the user +preferences. & pass \\ \hline +\caption{Unit tests for time/timezone.} +\label{tab:time_timezone} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf timespan/char} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the char method works with a vector of TIMESPAN objects as input.} & Test that the char method works for a vector of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each start time & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the char method works with a matrix of TIMESPAN objects as input.} & Test that the char method works for a matrix of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each start time & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the char method works with a list of TIMESPAN objects as input.} & Test that the char method works for a list of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each start time & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the char method works with a mix of different shaped TIMESPAN objects +as input.} & Test that the char method works with an input of matrices and vectors +and single TIMESPAN objects. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each start time & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the char method properly applies history.} & The method char doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for timespan/char.} +\label{tab:timespan_char} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf timespan/copy} &&& \\ \hline +\endhead + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline + \multirow{2}{3cm}{69 } & \multirow{2}{5cm}{Tests that the copy method works with a single object as an input.} & Test the positive (copy-case) and the negative (non copy-case) case. & pass \\ \cline{3-4} + & & 1) Check that the output is a 'real' copy or only a copy of the handle & pass \\ \hline +\caption{Unit tests for timespan/copy.} +\label{tab:timespan_copy} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf timespan/created} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the created method works with a vector of TIMESPAN objects as +input.} & Test that the created method works for a vector of TIMESPAN objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'tsv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the created method works with a matrix of TIMESPAN objects as +input.} & Test that the created method works for a matrix of TIMESPAN objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'tsm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the created method works with a list of TIMESPAN objects as +input.} & Test that the created method works for a list of TIMESPAN objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the created method works with a mix of different shaped +TIMESPAN objects as input.} & Test that the created method works with an input of matrices and +vectors and single TIMESPAN objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the created method properly applies history} & This method doesn't change the input object, thus no history is added +to the object. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the created method can be used with the modify command.} & Tests that the created method can be used with the modify command. & pass \\ \cline{3-4} + & & 1) Check the single object +2) Check the matrix object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the created method retruns always a well defined time object +even for an empty input object.} & Test that the created method with an empty 'TIMESPAN object & pass \\ \cline{3-4} + & & 1) Check that the output is a time object with a ell defined time. & pass \\ \hline +\caption{Unit tests for timespan/created.} +\label{tab:timespan_created} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf timespan/creator} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the creator method works with a vector of TIMESPAN objects as +input.} & Test that the creator method works for a vector of TIMESPAN objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'tsv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the creator method works with a matrix of TIMESPAN objects as +input.} & Test that the creator method works for a matrix of TIMESPAN objects as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'tsm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the creator method works with a list of TIMESPAN objects as +input.} & The creator method doesn't work for a list of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the creator method works with a mix of different shaped +TIMESPAN objects as input.} & The creator method doesn't work with different shaped input objects. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the creator method properly applies history} & This method doesn't change the input object, thus no history is added +to the object. & pass \\ \cline{3-4} + & & 1) Nothing to check. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the creator method can be used with the modify command.} & Tests that the creator method can be used with the modify command. & pass \\ \cline{3-4} + & & 1) Check the single object +2) Check the matrix object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the creator method retruns all creator(s)/modifier(s) which +are in the history.} & Test that the creator method uses the option 'all' direct or in a +plist. The test file must have the modifier 'first', 'second' and +'third' & pass \\ \cline{3-4} + & & 1) Check that out1 contains only one creator +2) Check that out2 contain more creator/modifier & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests the negative case for the option 'all'.} & Test that the creator method throws an error if the option 'all' is +used in connection with a matrix/vector of TIMESPAN objects. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline +\caption{Unit tests for timespan/creator.} +\label{tab:timespan_creator} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf timespan/display} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the display method works with a vector of TIMESPAN objects as input.} & Test that the display method works for a vector of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the display method works with a matrix of TIMESPAN objects as input.} & Test that the display method works for a matrix of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the display method works with a list of TIMESPAN objects as input.} & Test that the display method works for a list of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the display method works with a mix of different shaped +TIMESPAN objects as input.} & Test that the display method works with an input of matrices and vectors +and single TIMESPAN objects as. & pass \\ \cline{3-4} + & & 1) Check that the output contain at least each object name & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the display method properly applies history.} & The method display doesn't change the data, thus it is not possible to +check the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for timespan/display.} +\label{tab:timespan_display} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf timespan/eq} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the eq method works with a vector of TIMESPAN objects as input.} & Test that the eq method works for a vector of TIMESPAN objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the eq function. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the eq method works with a matrix of TIMESPAN objects as input.} & Test that the eq method works for a matrix of TIMESPAN objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the eq function. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the eq method works with a list of TIMESPAN objects as input.} & The eq method doesn't works for a list of TIMESPAN objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the eq method works with a mix of different shaped TIMESPAN objects +as input.} & The eq method doesn't works for a list of TIMESPAN objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the eq method properly applies history.} & The eq method doesn't change the TIMESPAN object, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'name'. Use the option 'internal' to +suppress the history. It is necessary to add 'created' to the exception +list because ts is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'endt'. Use the option 'internal' to +suppress the history. It is necessary to add 'created' to the exception +list because ts is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Test the eq method with an exception list. +With the LTPDA toolbox 2.0 it is only possible to test the exception list +with properties where a public set method exist.} & Test the eq method with the exception 'startT'. Use the option 'internal' +to suppress the history. It is necessary to add 'created' to the exception +list because ts is created at an other time. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Test the eq method with an exception list which is in a plist.} & Test that the eq method uses the exception list in a plist. & pass \\ \cline{3-4} + & & 1) Check the output. & pass \\ \hline +\caption{Unit tests for timespan/eq.} +\label{tab:timespan_eq} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf timespan/get} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests the get method of the timespan class.} & Test that the get returns returns the value of the specified +property. Do this for all properties of the TIMESPAN object. & pass \\ \cline{3-4} + & & 1) Check the correct value of the output & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the get method works with a plist.} & Test that the get returns returns the value of the specified +property which is defined in a plist. & pass \\ \cline{3-4} + & & 1) Check the correct value of the output & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests the get method of the timespan class.} & Test that the get throws an error if the input are more than +one TIMESPAN object. & pass \\ \cline{3-4} + & & 1) Nothing to test & pass \\ \hline +\caption{Unit tests for timespan/get.} +\label{tab:timespan_get} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf timespan/index} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the index method works with a vector of TIMESPAN objects as +input.} & Test that the index method works for a vector of TIMESPAN objects as +input. The following indexing should work: +I = [ 1 2 3 ] or (I/J) = [(1,1), (1,2), (1,3)] & pass \\ \cline{3-4} + & & 1) Check that the index method selects the correct object. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the index method works with a matrix of TIMESPAN objects as +input.} & Test that the index method works for a matrix of TIMESPAN objects as +input. The following indexing should work: +I = [ 1 3 5 ] or (I/J) = [(1,1), (1,2), (1,3)] +[ 2 4 6 ] [(2,1), (2,2), (2,3)] & pass \\ \cline{3-4} + & & 1) Check that the index method selects the correct object. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the index method works with a list of TIMESPAN objects as +input.} & The index method doesn't work for a list of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Nothing to test. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the index method properly applies history.} & Test that the result of index have an additional history step. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds +to 'index'. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the index method works for the modifier command.} & Tests that the index method works for the modifier command. & pass \\ \cline{3-4} + & & 1) Check that the history-plist contains the used indices. +2) Check that the index method selects the correct object & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the index method can be controled with a plist. & pass \\ \cline{3-4} + & & 1) Check that the history-plist contains the used indices. +2) Check that the index method selects the correct object & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test that the index method selects more objects if I have more indices.} & Test that the index method selects more objects if I have more indices. & pass \\ \cline{3-4} + & & 1) Check that the history-plist contains the used indices. +2) Check that the index method selects the correct object & pass \\ \hline +\caption{Unit tests for timespan/index.} +\label{tab:timespan_index} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf timespan/isprop} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the isprop method works with a vector of TIMESPAN objects as input.} & Test that the isprop method works for a vector of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'tsv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the isprop method works with a matrix of TIMESPAN objects as input.} & Test that the isprop method works for a matrix of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'tsm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the isprop method works with a list of TIMESPAN objects as input.} & Test that the isprop method works for a list of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the isprop method works with a mix of different shaped +TIMESPAN objects as input.} & Test that the isprop method works with an input of matrices and vectors +and single TIMESPAN objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the isprop method properly applies history.} & The method isprop doesn't change the object, thus it is not necessary to +apply history. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the isprop method works for each property.} & Test that the isprop method works for the properties: +startT', 'endT', 'timeformat', 'timezone', 'interval' +'hist' and 'name' & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the negative case and the not function command.} & Test that the isprop method retrun false for a unknown property and for +methods of the object. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline +\caption{Unit tests for timespan/isprop.} +\label{tab:timespan_isprop} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf timespan/loadobj} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check the shape of the loaded objects. & pass \\ \hline +\caption{Unit tests for timespan/loadobj.} +\label{tab:timespan_loadobj} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf timespan/ne} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the ne method works with a vector of TIMESPAN objects as input.} & Test that the ne method works for a vector of TIMESPAN objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the ne function. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the ne method works with a matrix of TIMESPAN objects as input.} & Test that the ne method works for a matrix of TIMESPAN objects as input. +Test the positive and the negative case. & pass \\ \cline{3-4} + & & 1) Check the output of the ne function. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the ne method works with a list of TIMESPAN objects as input.} & The ne method doesn't works for a list of TIMESPAN objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the ne method works with a mix of different shaped TIMESPAN objects +as input.} & The ne method doesn't works for a list of TIMESPAN objects as input. +Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the ne method properly applies history.} & The ne method doesn't change the TIMESPAN object, thus will no history added. +Nothing to do & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Test the ne method with an exception list. +The function timespan/ne use the function timespan/eq so it is not +necessary to check all possibilities of the exception list.} & Test the ne method with the exception 'name'. Use the option 'internal' to +suppress the history. It is necessary to add 'created' to the exception +list because ts is created at an other time. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Test the ne method with an exception list which is in a plist.} & Test that the ne method uses the exception list in a plist. & pass \\ \cline{3-4} + & & 1) Check that each output contains the correct data. & pass \\ \hline +\caption{Unit tests for timespan/ne.} +\label{tab:timespan_ne} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf timespan/rebuild} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the rebuild method works with a vector of TIMESPAN objects as input.} & Test that the rebuild method works for a vector of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the rebuild method works with a matrix of TIMESPAN objects as input.} & Test that the rebuild method works for a matrix of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the rebuild method works with a list of TIMESPAN objects as input.} & Test that the rebuild method works for a list of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the rebuild method works with a mix of different shaped TIMESPAN objects +as input.} & Test that the rebuild method works with an input of matrices and vectors +and single TIMESPAN objects. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the rebuild method properly applies history.} & The method rebuild doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Check that the rebuild method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for timespan/rebuild.} +\label{tab:timespan_rebuild} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf timespan/save} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the save method works with a vector of TIMESPAN objects as input.} & Test that the save method works for a vector of TIMESPAN objects as input. +Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the same +as in 'tsv' +2) Check that the loaded objects are the same as the saved objects. +3) The outputs 'out1' and 'out2' must be the same. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the save method works with a matrix of TIMESPAN objects as input.} & Test that the save method works for a matrix of TIMESPAN objects as input. +Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the same +as in 'tsm' +2) Check that the loaded objects are the same as the saved objects. +3) The outputs 'out1' and 'out2' must be the same. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the save method works with a list of TIMESPAN objects as input.} & Test that the save method works for a list of TIMESPAN objects as input. +Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out1' and 'out2' are the same +as in the list +2) Check that the loaded objects are the same as the saved objects. +3) The outputs 'out1' and 'out2' must be the same except. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the save method works with a mix of different shaped TIMESPAN objects +as input.} & Test that the save method works with an input of matrices and vectors +and single TIMESPAN objects. Test both formats 'xml' and 'mat'. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output TIMESPAN object contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the save method properly applies history.} & Test that the result of applying the save method can be processed back +to an m-file. Do this for both extensions 'mat' and 'xml' & pass \\ \cline{3-4} + & & 1) Check that the history applies to the output object. Check that +save doesn't add a history step to the input object. +2) Check that the read object doesn't contain the save + load history steps. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the save method works with the modify command.} & Use the save method with the modifier command. & pass \\ \cline{3-4} + & & 1) Check that the save method doesn't apply the history. +2) Check the output against the input. +3) Check the history of the output against the input. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Control the method with a plist.} & Test that the save method uses the filename which is stored in a plist. & pass \\ \cline{3-4} + & & 1) Check the output & pass \\ \hline +\caption{Unit tests for timespan/save.} +\label{tab:timespan_save} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf timespan/setEndT} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setEndT method works with a vector of TIMESPAN objects as input.} & Test that the setEndT method works for a vector of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'tsv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setEndT method works with a matrix of TIMESPAN objects as input.} & Test that the setEndT method works for a matrix of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'tsm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setEndT method works with a list of TIMESPAN objects as input.} & Test that the setEndT method works for a list of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setEndT method works with a mix of different shaped TIMESPAN +objects as input.} & Test that the setEndT method works with an input of matrices and vectors +and single TIMESPAN objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setEndT method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setEndT method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setEndT'. +2) Check that the last entry in the history of 'out2' NOT corresponds to +'setEndT'. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setEndT method can modify the input TIMESPAN object.} & Test that the setEndT method can modify the input TIMESPAN object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'ts5' and 'ain' are now different. +2) Check that 'ain' has the correct name field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setEndT method can set the property with a plist.} & Test that the setEndT method can modify the property 'endT' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct name field +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setEndT method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the setEndT method accept different inputs.} & Test that the setEndT method accept input of double, char and +time-objects. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for timespan/setEndT.} +\label{tab:timespan_setEndT} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf timespan/setName} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setName method works with a vector of TIMESPAN objects as input.} & Test that the setName method works for a vector of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'tsv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setName method works with a matrix of TIMESPAN objects as input.} & Test that the setName method works for a matrix of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'tsm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setName method works with a list of TIMESPAN objects as input.} & Test that the setName method works for a list of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setName method works with a mix of different shaped TIMESPAN +objects as input.} & Test that the setName method works with an input of matrices and vectors +and single TIMESPAN objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setName method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setName method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setName'. +2) Check that the last entry in the history of 'out2' NOT corresponds to +'setName'. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setName method can modify the input TIMESPAN object.} & Test that the setName method can modify the input TIMESPAN object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'ts5' and 'ain' are now different. +2) Check that 'ain' has the correct name field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setName method can set the property with a plist.} & Test that the setName method can modify the property 'name' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct name field +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setName method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for timespan/setName.} +\label{tab:timespan_setName} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf timespan/setStartT} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the setStartT method works with a vector of TIMESPAN objects as input.} & Test that the setStartT method works for a vector of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'tsv' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the setStartT method works with a matrix of TIMESPAN objects as input.} & Test that the setStartT method works for a matrix of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in 'tsm' +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the setStartT method works with a list of TIMESPAN objects as input.} & Test that the setStartT method works for a list of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the setStartT method works with a mix of different shaped TIMESPAN +objects as input.} & Test that the setStartT method works with an input of matrices and vectors +and single TIMESPAN objects. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same as in +input. +2) Check that each output contains the correct data. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the setStartT method properly applies history and that the +option 'internal' suppresses the history.} & Test that the result of applying the setStartT method can be processed back +to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out1' corresponds to +'setStartT'. +2) Check that the last entry in the history of 'out2' NOT corresponds to +'setStartT'. +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the setStartT method can modify the input TIMESPAN object.} & Test that the setStartT method can modify the input TIMESPAN object +by calling with no output. & pass \\ \cline{3-4} + & & 1) Check that 'ts5' and 'ain' are now different. +2) Check that 'ain' has the correct name field & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the setStartT method can set the property with a plist.} & Test that the setStartT method can modify the property 'startT' +with a value in a plist. & pass \\ \cline{3-4} + & & 1) Check that 'ain' has the correct name field +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Check that the setStartT method pass back the output objects to a list of +output variables or to a single variable.} & Call the method with a list of output variables and with a single output +variable. Additionaly check that the rebuild method works on the output. & pass \\ \cline{3-4} + & & 1) Check that the output contains the right number of objects +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Check that the setStartT method accept different inputs.} & Test that the setStartT method accept input of double, char and +time-objects. & pass \\ \cline{3-4} + & & 1) Check the output +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for timespan/setStartT.} +\label{tab:timespan_setStartT} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf timespan/string} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the string method works with a vector of TIMESPAN objects as input.} & Test that the string method works for a vector of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the string method works with a matrix of TIMESPAN objects as input.} & Test that the string method works for a matrix of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the string method works with a list of TIMESPAN objects as input.} & Test that the string method works for a list of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the string method works with a mix of different shaped TIMESPAN objects +as input.} & Test that the string method works with an input of matrices and vectors +and single TIMESPAN objects. & pass \\ \cline{3-4} + & & 1) Check that the output is a executable string. +2) Check the correct number of rout +3) Check the rebuild objects. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the string method properly applies history.} & The method string doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the string method doesn't work if the TIMESPAN object have more +than one history step.} & The method string throws an error because the input object have more than +one history step. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for timespan/string.} +\label{tab:timespan_string} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf timespan/timespan} &&& \\ \hline +\endhead + \multirow{2}{3cm}{00 } & \multirow{2}{5cm}{Tests that the timespan constructor does what is supposed to do.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the timespan method works with a vector of TIMESPAN objects as input.} & Test that the timespan method works with a vector of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output TIMESPANs is the same as the input shape. +2) Check that each output TIMESPAN is a copy of the input TIMESPAN. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the timespan method works with a matrix of TIMESPAN objects as input.} & Test that the timespan method works with a matrix of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the shape of the output TIMESPANs is the same as the input shape. +2) Check that each output TIMESPAN is a copy of the input TIMESPAN. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the timespan method works with a list of TIMESPAN objects as input.} & Test that the timespan method works with a list of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same of the +number in the input. +2) Check that each output TIMESPAN is a copy of the input TIMESPAN. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the timespan method works with a mix of different shaped TIMESPANs as +input.} & Test that the timespan method works with a mix of different shaped TIMESPANs as +input. & pass \\ \cline{3-4} + & & 1) Check that the number of elements in 'out' is the same of the +number in the input. +2) Check that each output TIMESPAN is a copy of the input TIMESPAN. +3) Check that the copy have an additional history step. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the timespan method properly applies history.} & Test that the result of applying the timespan method can be processed back. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'timespan'. +2) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{07 } & \multirow{2}{5cm}{Tests that the timespan method properly applies history to the copy constructor.} & Test that the output can be processed back with the 'rebuild' method. +Test the constructor with a different number of inputs. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'timespan'. +2) Check that the original objects are not changed by the setter function +3) Check that the method rebuild produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{08 } & \multirow{2}{5cm}{Tests that the timespan method properly applies history to the read +MAT-file constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{09 } & \multirow{2}{5cm}{Tests that the timespan method properly applies history to the read +XML-file constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{10 } & \multirow{2}{5cm}{Tests that the timespan method properly applies history to the struct constructor.} & Test that the output can be processed back with the 'rebuild' method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' +corresponds to 'timespan'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{11 } & \multirow{2}{5cm}{Tests that the timespan method properly applies history to the +plist(filename) constructor.} & Test that the output can be processed back to an m-file. & pass \\ \cline{3-4} + & & 1) Check that the save method doesn't change the input object +2) Check that the last two entries in the history of 'out' corresponds to +'timespan' and 'save' +3) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{12 } & \multirow{2}{5cm}{Tests that the TIMESPAN method properly applies history to the +plist(conn) constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'timespan'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{13 } & \multirow{2}{5cm}{Tests that the TIMESPAN method properly applies history to the +plist(type) constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'timespan'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{15 } & \multirow{2}{5cm}{Tests that the TIMESPAN method properly applies history to +the start + end time constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'timespan'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{16 } & \multirow{2}{5cm}{Tests that the TIMESPAN method properly applies history to the conn+Id constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'timespan'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline + \multirow{2}{3cm}{17 } & \multirow{2}{5cm}{Tests that the TIMESPAN method properly applies history to +the start + end time + format constructor.} & Test that the output can be processed back with the rebuild method. & pass \\ \cline{3-4} + & & 1) Check that the last entry in the history of 'out' corresponds to +'timespan'. +2) Check that the 'rebuild' method produces the same object as 'out'. & pass \\ \hline +\caption{Unit tests for timespan/timespan.} +\label{tab:timespan_timespan} +\end{longtable} +\clearpage + + +\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \hline +{\bf timespan/type} &&& \\ \hline +\endhead + \multirow{2}{3cm}{01 } & \multirow{2}{5cm}{Tests that the getInfo call works for this method.} & Test that the getInfo call works for no sets, all sets, and each set +individually. & pass \\ \cline{3-4} + & & 1) Check that getInfo call returned an minfo object in all cases. +2) Check that all plists have the correct parameters. & pass \\ \hline + \multirow{2}{3cm}{02 } & \multirow{2}{5cm}{Tests that the type method works with a vector of TIMESPAN objects as input.} & Test that the type method works for a vector of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{03 } & \multirow{2}{5cm}{Tests that the type method works with a matrix of TIMESPAN objects as input.} & Test that the type method works for a matrix of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{04 } & \multirow{2}{5cm}{Tests that the type method works with a list of TIMESPAN objects as input.} & Test that the type method works for a list of TIMESPAN objects as input. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{05 } & \multirow{2}{5cm}{Tests that the type method works with a mix of different shaped TIMESPAN objects +as input.} & Test that the type method works with an input of matrices and vectors +and single TIMESPAN objects. & pass \\ \cline{3-4} + & & 1) Check the rebuilt output. & pass \\ \hline + \multirow{2}{3cm}{06 } & \multirow{2}{5cm}{Tests that the type method properly applies history.} & The method type doesn't change the data, thus it is not possible to check +the history. Nothing to do. & pass \\ \cline{3-4} + & & & pass \\ \hline +\caption{Unit tests for timespan/type.} +\label{tab:timespan_type} +\end{longtable} +\clearpage + + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/unit_test_doc/unit_test_doc.pdf Binary file testing/utp_1.1/unit_test_doc/unit_test_doc.pdf has changed diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/unit_test_doc/unit_test_doc.tex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/unit_test_doc/unit_test_doc.tex Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,213 @@ +% +% do not indent paragraphs +% +\setlength{\parindent}{0pt} +\setlength{\parskip}{5pt plus 2pt minus 1pt} +% +% switch off extra space after punctuation marks +% +\frenchspacing + +\newcommand{\documentname}{S2-AEI-TN-XXXX} +\newcommand{\documentdate}{\today} + +%Schriftgroesse, Layout, Papierformat, Art des Dokumentes +\documentclass[fleqn,10pt,a4paper,DIV11]{scrartcl} + +\usepackage{longtable} +\usepackage{changebar} +\usepackage[usenames,dvipsnames]{color} +\setlength{\parindent}{0pt} +\setlength{\parskip}{0.5cm} +\usepackage{tocstyle} +\usepackage{upgreek} +% +% make document useable for latex and pdflatex +% +\usepackage{ifpdf} + +\ifpdf + \usepackage[pdftex]{graphicx} % to include graphics + \pdfcompresslevel=9 + % + % use package hyperref to create a pdf file with hyperlinks + % the package wants to be loaded as last packages, since it overrides settings + % + \usepackage[pdftex, % sets up hyperref to use pdftex driver + plainpages=false, % allows page i and 1 to exist in the same document + breaklinks=true, % link texts can be broken at the end of line + colorlinks=true, + % pdftitle=, % keine Umlaute oder Sonderzeichen + pdfauthor= Martin Hewitson + ]{hyperref} % should be the last package that is loaded according to docsumentation + % + % to create thumbnails in pdf files + % + %\usepackage{thumbpdf} +\else + \usepackage{graphicx} % to include graphics + \usepackage{hyperref} % to simplify the use of \href +\fi + +%Umlaute ermoeglichen +%\usepackage [applemac]{inputenc} %ggf. \usepackage[latin9]{inputenc} + +%weitere Pakete +\usepackage[T1]{fontenc} +\usepackage{ae} % beachte: durch dieses Paket kann im Acrobat nicht mehr nach Woertern mit Umlauten gesucht werden. +%\pdfcompresslevel=9 %(1-9) +%\pdfinfo{info keys for example: Title, Creator, Author} + +%\raggedbottom +%Packages aus alten Dokumenten%%%%%%%%%%%%%%% +\usepackage[intlimits]{amsmath} +\usepackage{amssymb} +\usepackage[headinclude,footinclude]{scrpage2} +%\usepackage[pdftex]{graphicx} +\usepackage{verbatim} +\usepackage{rotating} +\usepackage{lastpage} +\usepackage{calc} +\usepackage{tabularx,colortbl} + +\definecolor{TableHeader}{rgb}{0.8,0.8,0.8} + +%\usepackage{hyperref} +\DeclareGraphicsExtensions{.pdf} + +\pagestyle{scrheadings} +\renewcommand{\headheight}{2.5cm} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%Kopfzeile +%Kopfzeile links bzw. innen +\ihead{ +\begin{minipage}[b]{3cm} +\small{\documentname}\\\small{\documentdate\\Issue: Release\\ Rev. 1} +\end{minipage} +} +%Kopfzeile rechts bzw. aussen +\ohead{ +\begin{minipage}[b]{1.4cm} +\includegraphics[width=1.4cm]{AEI_small.png} +\end{minipage} +\begin{minipage}[b]{5cm} + \scriptsize +\textsc{Max Planck Institute for\\Gravitational Physics\\ +(Albert-Einstein-Institute)}\\ +\end{minipage} +\hspace{-1cm} +\begin{minipage}[b]{6cm} +\includegraphics[width=6cm]{UTN_complete_logo.jpg} +\end{minipage}\\\vspace{-0.5cm} +} +%Kopfzeile mittig +\chead{} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%Fusszeile +%Fusszeile rechts bzw. aussen +\ofoot{\pagemark} +%Fusszeile links bzw. innen +\ifoot{} +%Fusszeile mittig +\cfoot{} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\setheadtopline{1pt} +\setheadsepline{1pt} + +%Gummimaße erhöhen +\tolerance 1414 +\hbadness 1414 +\setlength{\emergencystretch}{1.5em} +\hfuzz 0.3pt +\widowpenalty=10000 +\vfuzz \hfuzz +\raggedbottom + +%Satz von Floats verbessern (nach FAQ): +\renewcommand{\floatpagefraction}{.7} +\renewcommand{\textfraction}{.15} +\renewcommand{\topfraction}{.8} +\renewcommand{\bottomfraction}{.5} +\usepackage[table]{xcolor} +\usepackage{multirow} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{document} + + +%Titelseite +\titlehead{ +\begin{center} +\begin{minipage}[b]{1.4cm} +\includegraphics[width=1.4cm]{AEI_small.png} +\end{minipage} +\begin{minipage}[b]{5,5cm} + \small\textsc{Max-Planck-Institute for\\ Gravitational Physics\\ +(Albert-Einstein-Institute)}\\ +\end{minipage}\vspace{-0.5cm} +\begin{minipage}[b]{7cm} +\includegraphics[width=7cm]{UTN_complete_logo.jpg} +\end{minipage}\\ +\end{center}} + + +\title{ + LTPDA Unit Test Report + \vspace{1cm} + {\large \documentname} \\ \vspace{2cm} + \author{ + \begin{tabular}{p{4cm}p{9.5cm}} + \hline + prepared by & M~Hewitson \\ + checked by & \\ + Issue & 1 \\ + Revision & 1 \\ + Status & Draft \\ + Number of pages & \pageref{LastPage} \\ + date of issue & \documentdate \\ + approved by & \\ + \hline + \end{tabular} + } +} + + + +\date{} +\maketitle + +\textbf{This document and all parts of it are confidential. Any distribution is prohibited without +written authorisation from AEI and UNITN.} + +\newpage + +%---------------------------------------------------------------------------------- + +\section*{Distribution List} +\begin{tabular}{p{4cm}p{9.5cm}} +\hline \rowcolor[gray]{0.9} Name & Company/ Institute\\ \hline + & AEI Hannover\\ +\hline +\end{tabular} + +\newpage + +% +\tableofcontents +\listoftables +% + +\newpage + + +%---------------------------------------------------------------------------------- + +\input{./introduction.tex} +\input{./results.tex} + +%---------------------------------------------------------------------------------- + +\pagebreak + + +\end{document} diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/unit_test_doc/unit_test_doc.texnicle --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/unit_test_doc/unit_test_doc.texnicle Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,87 @@ + + + + + + 134481920 + 231379FB-789F-4615-879A-7819A5E35B8F + 105 + + + + NSPersistenceFrameworkVersion + 251 + NSStoreModelVersionHashes + + File + + SIcXmxCoKtFW+YhDSLEkwmXSrw4caz9RzuU6RdD8wRE= + + Folder + + Grij332X1rMYXqmN3lNQISkMHRf2/DdXELst812WKGE= + + Project + + 77EjZJf+xpmgyr0pFJbXwUaIZN6MKS/o2PFxZbvsCsc= + + ProjectItem + + WtaPU9rm7J0aQWjjEf7sfCn2HZlql+cuYhRsDffn51Q= + + TeXFile + + 7+kViVWxvtxxOsB7FryvRxcxR7jVqaNMyRZDLX9s/qk= + + + NSStoreModelVersionHashesVersion + 3 + NSStoreModelVersionIdentifiers + + + + + + + /Users/hewitson/working/ltp/ltpda/software/testing/utp_1.1/unit_test_doc + pdflatex + unit_test_doc + + + + + + 1 + {{0, 2153}, {2059, 1259}} + 325667599.50514602661132812500 + 1 + 325667599.54020202159881591797 + tex + {5056, 0} + 0 + unit_test_doc.tex + 0 + ./unit_test_doc.tex + + + + + + + 1 + {{0, 0}, {2080, 1259}} + 325667622.50502097606658935547 + 1 + 325667621.85971099138259887695 + tex + {1187, 0} + 1 + introduction.tex + 0 + ./introduction.tex + + + + + + \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/unittest.rb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/unittest.rb Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,39 @@ +#!/usr/bin/ruby + +class SubTest + attr_accessor :testDescription, :syntaxDescription, :algoDescription, :syntaxCode, :algoCode, :number, :syntaxResult, :algoResult, :date + def initialize + @number = 0 + @testDescription = "" + @syntaxDescription = "" + @algoDescription = "" + @syntaxCode = "" + @algoCode = "" + @syntaxResult = -1 + @algoResult = -1 + end +end + +class UnitTest + attr_accessor :methodDescription, :tests, :results, :path, :title, :code, :tainted + + def initialize + @methodDescription = "" + @tests = [] + @results = [] + @tainted = false + @path = "" + @title = "" + @code = "" + end +end + +class Result + attr_accessor :syntax, :algorithm, :date, :number + def initialize + @syntax = -1 + @algorithm = -1 + @date = Time.now + @number = 0 + end +end \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_ao_metropolis1D.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_ao_metropolis1D.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,450 @@ +% UTP_AO_METROPOLIS2D a set of UTPs for the ao/metropolis2D method +% +% M Nofrarias 06-07-09 +% +% $Id: utp_ao_metropolis1D.m,v 1.1 2009/08/06 17:06:18 miquel Exp $ +% + +% +% +% METROPOLIS2D samples a probability distribution for a SISO problem using a +% Metropolis/Metropolis-Hastings algorithm. +% +% + +function results = utp_ao_metropolis2D(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'metropolis2D'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + S11 = ao(plist('fs', 1, 'nsecs', 100, 'tsfcn', 'randn(size(t))')); + S22 = ao(plist('fs', 1, 'nsecs', 100, 'tsfcn', 'randn(size(t))')); + S12 = ao(plist('fs', 1, 'nsecs', 100, 'tsfcn', '1e-2*randn(size(t))')); + S21 = ao(plist('fs', 1, 'nsecs', 100, 'tsfcn', '1e-2*randn(size(t))')); + noise = [S11 S12 S21 S22]; + + in(1) = ao(plist('fs', 1, 'nsecs', 100, 'tsfcn', 'sin(2*pi*1*t)')); + in(2) = ao(plist('fs', 1, 'nsecs', 100, 'tsfcn', 'sin(2*pi*0.1*t)')); + + out(1) = ao(plist('fs', 1, 'nsecs', 100, 'tsfcn', '10 + sin(2*pi*1*t)')); + out(2) = ao(plist('fs', 1, 'nsecs', 100, 'tsfcn', '200 + sin(2*pi*0.1*t)')); + + % Test smodels + st1 = smodel('a + t'); + st1.setXvar('f'); + st1.setParams('a',10); + st1.setXvar('t'); + st1.setXvals(in(1).x); + + st2 = smodel('b + t'); + st2.setXvar('f'); + st2.setParams('b',10); + st2.setXvar('t'); + st2.setXvals(in(1).x); + st = [st1 st2]; + + % define plist + pl = plist('param',{'a','b'},... + 'sigma',[1 10],... + 'N',2,... + 'range',{[5 15],[180 220]},... + 'x0',[10 200]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test output of the data + + % + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + % + try + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + % + atest = true; + if stest + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 6, atest = false; end + % Check key + % Check default value + % Check options + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the metropolis2D method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the metropolis2D method works for a vector of AOs as input. + % + % + + % + try + avec = [in(1) in(2) out(1) out(2) noise(1) noise(2) noise(3) noise(4)]; + st = [st1 st2]; + m = metropolis2D(avec,st,pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(m) ~= numel(in), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the metropolis2D method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the metropolis2D method works for a matrix of AOs as input. + % + % + + % + try + amat = [in(1); in(2); out(1); out(2); noise(1); noise(2); noise(3); noise(4)]; + st = [st1; st2]; + m = metropolis2D(amat,st,pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(m) ~= numel(in), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the metropolis2D method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the metropolis2D method works for a list of AOs as input. + % + % + + % + try + m = metropolis2D(in(1),in(2),out(1),out(2),noise(1),noise(2),noise(3),noise(4),st1,st2,pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(m) ~= numel(in), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the metropolis2D method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the metropolis2D method works with an input of matrices and vectors + % and single AOs. + % + % + + % + try + m = metropolis2D([in(1),in(2),out(1)],out(2),noise,st1,st2,pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(m) ~= numel(in), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + % + % + % Tests that the metropolis2D method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the metropolis2D method can be processed back + % to an m-file. + % + % + + % + try + m = metropolis2D(in,out,noise,st,pl); + mm = rebuild(m); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the last entry in the history of 'm' corresponds to + % 'metropolis2D'. + % 2) Check that the re-built object is the same object as 'm'. + % THIS IS NOT TRUE FOR METROPOLIS BECAUSE THE OUTPUT CHAIN IS ONLY + % EQUAL STATISTICALLY + % + % + + % + atest = true; + if stest + % Check the last step in the history of 'out' + if ~strcmp(m(1).hist.methodInfo.mname, 'metropolis2D'), atest = false; end + % Check the re-built object +% if ~eq(mm(1), m(1), ple2), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the metropolis2D method can not modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the tfe method can not modify the input AO. + % The method must throw an error for the modifier call. + % + % + + try + % + % copy at1 to work with + ain = ao(in(1)); + % modify ain + ain.metropolis2D(in,out,noise,model,pl); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + + +end + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/get_random_unit.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/get_random_unit.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,32 @@ +% GET_RANDOM_UNIT returns a random unit object, with random unit and random +% prefix (if the unit is different from '') +% +% CALL: u = get_test_ples +% +% OUTPUTS: u - a unit object with random unit and prefix +% +% VERSION: $Id: get_random_unit.m,v 1.2 2010/05/05 04:21:52 mauro Exp $ +% +function u = get_random_unit(varargin) + unit_list = unit.supportedUnits; + prefix_list = unit.supportedPrefixes; + + u = cell2mat(utils.math.randelement(unit_list,1)); + + pref = true; + if nargin + switch varargin{1} + case {'nopref', 'noprefix', 'no_pref', 'no_prefix'} + pref = false; + otherwise + end + end + + % Add a prefix only if the unit is different from '' + if pref && ~isempty(u) && ~strcmpi(u, '') + u = unit([cell2mat(utils.math.randelement(prefix_list,1)) u]); + else + u = unit(u); + end + +end \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/get_test_csd_ao_noisegen2D.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/get_test_csd_ao_noisegen2D.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,377 @@ +% test csd for ao/noisegen2D +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: Output a model for mdc1 cross spectral density +% +% CALL: +% [TF,CSD] = get_test_csd_ao_noisegen2D(pl) +% +% PARAMETERS: 'fs' - Sampling frequency +% 'f1' - the start frequency +% 'f2' - the stop frequency +% 'nf' - number of evaluation points +% 'scale' - spacing of frequencies: 'lin' or 'log' +% or +% 'f' - a vector of frequency values or an AO +% whereby the x-axis is taken for the frequency values +% +% OUTPUTS: +% CSD - a 2x2 matrix of analysis objects containing CSD +% models +% TF - a 2x2 matrix of analysis objects containing TF +% models +% +% M-FILE INFO: Get information about this methods by calling +% >> ao.getInfo('get_test_csd_ao_noisegen2D') +% +% Get information about a specified set-plist by calling: +% >> ao.getInfo('get_test_csd_ao_noisegen2D', 'none') +% +% VERSION: $Id: get_test_csd_ao_noisegen2D.m,v 1.4 2011/03/24 19:37:53 ingo Exp $ +% +% +% HISTORY: 22-12-2008 L Ferraioli +% Creation +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function varargout = get_test_csd_ao_noisegen2D(varargin) + + % Check if this is a call for parameters + if utils.helper.isinfocall(varargin{:}) + varargout{1} = getInfo(varargin{3}); + return + end + + import utils.const.* + utils.helper.msg(msg.MNAME, 'running %s/%s', mfilename('class'), mfilename); + + % Collect input variable names + in_names = cell(size(varargin)); + for ii = 1:nargin,in_names{ii} = inputname(ii);end + + % Collect all AOs and plists + [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names); + pl = utils.helper.collect_objects(varargin(:), 'plist', in_names); + + % Get frequency vector + f = find(pl, 'f'); + if isa(f, 'ao') && (isa(f.data, 'fsdata') || isa(f.data, 'xydata')) + f = f.data.getX; + end + + % Get sampling frequency + fs = find(pl, 'fs'); + + if isempty(f) + % Compute from frequency range + f1 = find(pl, 'f1'); + f2 = find(pl, 'f2'); + ndata = find(pl, 'nf'); + scale = find(pl, 'scale'); + + switch scale + case 'lin' + f = linspace(f1, f2, ndata); + case 'log' + f = logspace(log10(f1), log10(f2), ndata); + end + end + + + % Models response calculation + tf11 = calcTF11(f,fs); + tf12 = calcTF12(f,fs); + tf21 = calcTF21(f,fs); + tf22 = calcTF22(f,fs); + + % CSD calculation + csd11 = tf11.*conj(tf11)+tf12.*conj(tf12); + csd12 = tf11.*conj(tf21)+tf12.*conj(tf22); + csd22 = tf22.*conj(tf22)+tf21.*conj(tf21); + csd21 = conj(csd12); + csd11.setName('CSD11'); + csd12.setName('CSD12'); + csd21.setName('CSD21'); + csd22.setName('CSD22'); + + % Output data + if nargout == 1 + varargout{1} = [csd11 csd12;csd21 csd22]; + elseif nargout == 2 + varargout{1} = [csd11 csd12;csd21 csd22]; + varargout{2} = [tf11 tf12;tf21 tf22]; + end + +end + +%-------------------------------------------------------------------------- +% Get Info Object +%-------------------------------------------------------------------------- +function ii = getInfo(varargin) + if nargin == 1 && strcmpi(varargin{1}, 'None') + sets = {}; + pls = []; + elseif nargin == 1&& ~isempty(varargin{1}) && ischar(varargin{1}) + sets{1} = varargin{1}; + pls = getDefaultPlist(sets{1}); + else + sets = {'List', 'Range'}; + pls = []; + for kk=1:numel(sets) + pls = [pls getDefaultPlist(sets{kk})]; + end + end + % Build info object + ii = minfo(mfilename, 'ao', '', utils.const.categories.mdc01, '$Id: get_test_csd_ao_noisegen2D.m,v 1.4 2011/03/24 19:37:53 ingo Exp $', sets, pls); + ii.setModifier(false); +end + +%-------------------------------------------------------------------------- +% Get Default Plist +%-------------------------------------------------------------------------- +function plo = getDefaultPlist(set) + switch set + case 'List' + plo = plist('fs', 10, 'f', []); + case 'Range' + plo = plist('fs', 10, 'f1', -1, 'f2', -1, 'nf', 1000, 'scale', 'log'); + otherwise + error('### Unknown set [%s] for a default list.', set); + end +end + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% LOCAL FUNCTIONS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function tf11 = calcTF11(f,fs) + + + + % Model Stefano TF11 coefficients + dRes11 = [2.44554138162509e-011 - 1.79482547894083e-011i; + 2.44554138162509e-011 + 1.79482547894083e-011i; + 2.66402334803101e-009 + 1.1025122049153e-009i; + 2.66402334803101e-009 - 1.1025122049153e-009i; + -7.3560293387644e-009; + -1.82811618589835e-009 - 1.21803627800855e-009i; + -1.82811618589835e-009 + 1.21803627800855e-009i; + 1.16258677367555e-009; + 1.65216557639319e-016; + -1.78092396888606e-016; + -2.80420398962379e-017; + 9.21305973049041e-013 - 8.24686706827269e-014i; + 9.21305973049041e-013 + 8.24686706827269e-014i; + 5.10730060739905e-010 - 3.76571756625722e-011i; + 5.10730060739905e-010 + 3.76571756625722e-011i; + 3.45893698149735e-009; + 3.98139182134446e-014 - 8.25503935419059e-014i; + 3.98139182134446e-014 + 8.25503935419059e-014i; + -1.40595719147164e-011]; + + dPoles11 = [0.843464045655194 - 0.0959986292915475i; + 0.843464045655194 + 0.0959986292915475i; + 0.953187595424927 - 0.0190043625473383i; + 0.953187595424927 + 0.0190043625473383i; + 0.967176277937188; + 0.995012027005247 - 0.00268322602801729i; + 0.995012027005247 + 0.00268322602801729i; + 0.996564761885673; + 0.999999366165445; + 0.999981722418555; + 0.999921882627659; + 0.999624431675213 - 0.000813407848742761i; + 0.999624431675213 + 0.000813407848742761i; + 0.997312006278751 - 0.00265611346834941i; + 0.997312006278751 + 0.00265611346834941i; + 0.990516544257531; + 0.477796923118318 - 0.311064085401834i; + 0.477796923118318 + 0.311064085401834i; + 0]; + + dDTerms11 = 0; + + % response calculation + pfparams.type = 'disc'; + pfparams.freq = f; + pfparams.fs = fs; + pfparams.res = dRes11; + pfparams.pol = dPoles11; + pfparams.dterm = dDTerms11; + pfr = utils.math.pfresp(pfparams); + mtf11 = pfr.resp; + + % building AOs + tf11 = ao(plist('xvals', f, 'yvals', mtf11, 'fs', fs, 'type', 'fsdata')); + % name for this object + tf11.setName('TF11'); + +end + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function tf12 = calcTF12(f,fs) + + % Model Stefano TF12 + dRes12 = [1.44258422208796e-017 + 7.07359428613009e-019i; + 1.44258422208796e-017 - 7.07359428613009e-019i; + -3.4918408053655e-021 - 1.05662874569329e-021i; + -3.4918408053655e-021 + 1.05662874569329e-021i; + -7.61773292876976e-021; + 4.84357724603939e-020 + 2.38824204294595e-019i; + 4.84357724603939e-020 - 2.38824204294595e-019i; + -4.07088520945753e-020 - 2.31474543846105e-019i; + -4.07088520945753e-020 + 2.31474543846105e-019i; + 8.73316588658882e-023; + -5.21840635377469e-020; + 1.8461911504859e-023; + 5.20105247464461e-020; + -4.68960092394415e-022; + -1.44261407664171e-017 + 6.8922564526833e-019i; + -1.44261407664171e-017 - 6.8922564526833e-019i; + 3.13688133935426e-022]; + + dPoles12 = [0.477546340377332 - 0.310830571032376i; + 0.477546340377332 + 0.310830571032376i; + 0.99790715414307 - 0.0028490561287024i; + 0.99790715414307 + 0.0028490561287024i; + 0.998014205354671 ; + 0.999585354543332 - 0.000780408757425194i; + 0.999585354543332 + 0.000780408757425194i; + 0.99966003029931 - 0.000830944038363768i; + 0.99966003029931 + 0.000830944038363768i; + 0.999962770401331 ; + 0.999981881865521 ; + 0.999999365763457 ; + 0.999981706320212 ; + 0.99992421574188 ; + 0.477898460791003 + 0.311001926610074i; + 0.477898460791003 - 0.311001926610074i; + 0]; + dDTerms12 = 0; + + % response calculation + pfparams.type = 'disc'; + pfparams.freq = f; + pfparams.fs = fs; + pfparams.res = dRes12; + pfparams.pol = dPoles12; + pfparams.dterm = dDTerms12; + pfr = utils.math.pfresp(pfparams); + mtf12 = pfr.resp; + + % building AOs + tf12 = ao(plist('xvals', f, 'yvals', mtf12, 'fs', fs, 'type', 'fsdata')); + % name for this object + tf12.setName('TF12'); + +end + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function tf21 = calcTF21(f,fs) + + % Model Stefano Tf21 + dRes21 = [-1.80035241582968e-016 + 1.99543917791863e-015i; + -1.80035241582968e-016 - 1.99543917791863e-015i; + -1.85590889333759e-013 - 1.23844418827409e-014i; + -1.85590889333759e-013 + 1.23844418827409e-014i; + 5.03656596876842e-013 ; + -2.62470963499904e-013 + 2.30024232938878e-012i; + -2.62470963499904e-013 - 2.30024232938878e-012i; + -9.83780507870955e-018 ; + 3.40426735130194e-021 ; + 9.78322351492755e-018 ; + -1.65010934542937e-020 ; + 2.60918565203438e-015 + 1.0546609464659e-015i; + 2.60918565203438e-015 - 1.0546609464659e-015i; + 3.18105585405455e-014 + 2.48839990780042e-013i; + 3.18105585405455e-014 - 2.48839990780042e-013i; + 3.23021641947666e-013 ; + 4.81265000078114e-016 - 3.18269170053848e-017i; + 4.81265000078114e-016 + 3.18269170053848e-017i; + 5.16260024128201e-018]; + + dPoles21 = [0.872004077421604 - 0.110344282822693i; + 0.872004077421604 + 0.110344282822693i; + 0.956884129232757 - 0.0225532091775074i; + 0.956884129232757 + 0.0225532091775074i; + 0.966514825697177 ; + 0.995140550419744 - 0.000755127639524413i; + 0.995140550419744 + 0.000755127639524413i; + 0.999981802194393 ; + 0.99999936576546 ; + 0.999981722418555 ; + 0.999921882627659 ; + 0.999624431675213 + 0.000813407848742761i; + 0.999624431675213 - 0.000813407848742761i; + 0.997312006278751 + 0.00265611346834941i; + 0.997312006278751 - 0.00265611346834941i; + 0.990516544257531 ; + 0.477796923118318 + 0.311064085401834i; + 0.477796923118318 - 0.311064085401834i; + 0]; + + dDTerms21 = 0; + + % response calculation + pfparams.type = 'disc'; + pfparams.freq = f; + pfparams.fs = fs; + pfparams.res = dRes21; + pfparams.pol = dPoles21; + pfparams.dterm = dDTerms21; + pfr = utils.math.pfresp(pfparams); + mtf21 = pfr.resp; + + % building AOs + tf21 = ao(plist('xvals', f, 'yvals', mtf21, 'fs', fs, 'type', 'fsdata')); + % name for this object + tf21.setName('TF21'); + +end + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function tf22 = calcTF22(f,fs) + + % Model Stefano Tf22 + dRes22 = [1.1284521501259e-014; + -3.72133611555879e-014 - 2.08232683444075e-014i; + -3.72133611555879e-014 + 2.08232683444075e-014i; + 9.84930639106637e-014 - 1.46640810672565e-013i; + 9.84930639106637e-014 + 1.46640810672565e-013i; + 2.51323684013671e-014 ; + -5.64078525288305e-014 ; + -1.62476406586366e-014 ; + -1.08424815979566e-011 + 8.32328079357669e-012i; + -1.08424815979566e-011 - 8.32328079357669e-012i; + 2.41831559776112e-011]; + + dPoles22 = [0.988511243978897; + 0.997305870640646 + 0.00211760900132725i; + 0.997305870640646 - 0.00211760900132725i; + 0.999626453270255 + 0.0008125673525946i; + 0.999626453270255 - 0.0008125673525946i; + 0.999999366366222 ; + 0.999981706320212 ; + 0.99992421574188 ; + 0.477898460791003 - 0.311001926610074i; + 0.477898460791003 + 0.311001926610074i; + 0]; + + dDTerms22 = 0; + + % response calculation + pfparams.type = 'disc'; + pfparams.freq = f; + pfparams.fs = fs; + pfparams.res = dRes22; + pfparams.pol = dPoles22; + pfparams.dterm = dDTerms22; + pfr = utils.math.pfresp(pfparams); + mtf22 = pfr.resp; + + % building AOs + tf22 = ao(plist('xvals', f, 'yvals', mtf22, 'fs', fs, 'type', 'fsdata')); + % name for this object + tf22.setName('TF22'); + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/get_test_obj_ao_noisegen1D.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/get_test_obj_ao_noisegen1D.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,207 @@ +% test csd for ao/noisegen1D +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: Output a model for mdc1 cross spectral density +% +% CALL: +% [PSD,a1,a2,a3,a4,a5,av,am,plstd] = get_test_obj_ao_noisegen1D() +% +% +% OUTPUTS: +% CSD - a 2x2 matrix of analysis objects containing CSD +% models +% TF - a 2x2 matrix of analysis objects containing TF +% models +% a# - are white noise aos +% av - a vector of wn aos +% am - a matrix of wn aos +% plst - a standard plist to call noisegen2D +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function [PSD,a1,a2,a3,a4,a5,av,am,plstd,plstd2] = get_test_obj_ao_noisegen1D() + + nsecs = 100; + fs = 10; % Hz + f = logspace(-6,log10(fs/2),100).'; % vector of frequencies Hz + + % Models response calculation + tf11 = calcTF11(f,fs); + tf12 = calcTF12(f,fs); + + % PSD calculation + PSD = tf11.*conj(tf11)+tf12.*conj(tf12); + PSD.setName('PSD'); + + + % Building test objects + a1 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', 'm')); + a2 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs)); + a3 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', 'V')); + a4 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', '')); + a5 = ao(plist('tsfcn', 'randn(size(t)).''', 'fs', fs, 'nsecs', nsecs, 'yunits', 'fm s^-2')); + av = [a1 a2 a3]; + am = [a1 a2; a3 a4]; + + a1.setName; + a2.setName; + a3.setName; + a4.setName; + a5.setName; + + % building standard plist + plstd = plist(... + 'model', PSD, ... + 'MaxIter', 60, ... + 'PoleType', 2, ... + 'MinOrder', 15, ... + 'MaxOrder', 45, ... + 'Weights', 3, ... + 'Plot', false,... + 'Disp', false,... + 'MSEVARTOL', 0.1,... + 'FITTOL', 0.01); + + plstd2 = plist(... + 'fs', fs, ... + 'Iunits', '', ... + 'Ounits', 'm', ... + 'MaxIter', 60, ... + 'PoleType', 2, ... + 'MinOrder', 15, ... + 'MaxOrder', 45, ... + 'Weights', 3, ... + 'Plot', false,... + 'Disp', false,... + 'MSEVARTOL', 0.1,... + 'FITTOL', 0.01); + +end + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% LOCAL FUNCTIONS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function tf11 = calcTF11(f,fs) + + + + % Model Stefano TF11 coefficients + dRes11 = [2.44554138162509e-011 - 1.79482547894083e-011i; + 2.44554138162509e-011 + 1.79482547894083e-011i; + 2.66402334803101e-009 + 1.1025122049153e-009i; + 2.66402334803101e-009 - 1.1025122049153e-009i; + -7.3560293387644e-009; + -1.82811618589835e-009 - 1.21803627800855e-009i; + -1.82811618589835e-009 + 1.21803627800855e-009i; + 1.16258677367555e-009; + 1.65216557639319e-016; + -1.78092396888606e-016; + -2.80420398962379e-017; + 9.21305973049041e-013 - 8.24686706827269e-014i; + 9.21305973049041e-013 + 8.24686706827269e-014i; + 5.10730060739905e-010 - 3.76571756625722e-011i; + 5.10730060739905e-010 + 3.76571756625722e-011i; + 3.45893698149735e-009; + 3.98139182134446e-014 - 8.25503935419059e-014i; + 3.98139182134446e-014 + 8.25503935419059e-014i; + -1.40595719147164e-011]; + + dPoles11 = [0.843464045655194 - 0.0959986292915475i; + 0.843464045655194 + 0.0959986292915475i; + 0.953187595424927 - 0.0190043625473383i; + 0.953187595424927 + 0.0190043625473383i; + 0.967176277937188; + 0.995012027005247 - 0.00268322602801729i; + 0.995012027005247 + 0.00268322602801729i; + 0.996564761885673; + 0.999999366165445; + 0.999981722418555; + 0.999921882627659; + 0.999624431675213 - 0.000813407848742761i; + 0.999624431675213 + 0.000813407848742761i; + 0.997312006278751 - 0.00265611346834941i; + 0.997312006278751 + 0.00265611346834941i; + 0.990516544257531; + 0.477796923118318 - 0.311064085401834i; + 0.477796923118318 + 0.311064085401834i; + 0]; + + dDTerms11 = 0; + + % response calculation + pfparams.type = 'disc'; + pfparams.freq = f; + pfparams.fs = fs; + pfparams.res = dRes11; + pfparams.pol = dPoles11; + pfparams.dterm = dDTerms11; + pfr = utils.math.pfresp(pfparams); + mtf11 = pfr.resp; + + % building AOs + tf11 = ao(plist('xvals', f, 'yvals', mtf11, 'fs', fs, 'type', 'fsdata')); + % name for this object + tf11.setName('TF11'); + +end + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function tf12 = calcTF12(f,fs) + + % Model Stefano TF12 + dRes12 = [1.44258422208796e-017 + 7.07359428613009e-019i; + 1.44258422208796e-017 - 7.07359428613009e-019i; + -3.4918408053655e-021 - 1.05662874569329e-021i; + -3.4918408053655e-021 + 1.05662874569329e-021i; + -7.61773292876976e-021; + 4.84357724603939e-020 + 2.38824204294595e-019i; + 4.84357724603939e-020 - 2.38824204294595e-019i; + -4.07088520945753e-020 - 2.31474543846105e-019i; + -4.07088520945753e-020 + 2.31474543846105e-019i; + 8.73316588658882e-023; + -5.21840635377469e-020; + 1.8461911504859e-023; + 5.20105247464461e-020; + -4.68960092394415e-022; + -1.44261407664171e-017 + 6.8922564526833e-019i; + -1.44261407664171e-017 - 6.8922564526833e-019i; + 3.13688133935426e-022]; + + dPoles12 = [0.477546340377332 - 0.310830571032376i; + 0.477546340377332 + 0.310830571032376i; + 0.99790715414307 - 0.0028490561287024i; + 0.99790715414307 + 0.0028490561287024i; + 0.998014205354671 ; + 0.999585354543332 - 0.000780408757425194i; + 0.999585354543332 + 0.000780408757425194i; + 0.99966003029931 - 0.000830944038363768i; + 0.99966003029931 + 0.000830944038363768i; + 0.999962770401331 ; + 0.999981881865521 ; + 0.999999365763457 ; + 0.999981706320212 ; + 0.99992421574188 ; + 0.477898460791003 + 0.311001926610074i; + 0.477898460791003 - 0.311001926610074i; + 0]; + dDTerms12 = 0; + + % response calculation + pfparams.type = 'disc'; + pfparams.freq = f; + pfparams.fs = fs; + pfparams.res = dRes12; + pfparams.pol = dPoles12; + pfparams.dterm = dDTerms12; + pfr = utils.math.pfresp(pfparams); + mtf12 = pfr.resp; + + % building AOs + tf12 = ao(plist('xvals', f, 'yvals', mtf12, 'fs', fs, 'type', 'fsdata')); + % name for this object + tf12.setName('TF12'); + +end + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/get_test_obj_ao_noisegen2D.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/get_test_obj_ao_noisegen2D.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,333 @@ +% test csd for ao/noisegen2D +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: Output a model for mdc1 cross spectral density +% +% CALL: +% [CSD,TF,a1,a2,a3,a4,a5,a6,av,am,plstd] = get_test_obj_ao_noisegen2D() +% +% +% OUTPUTS: +% CSD - a 2x2 matrix of analysis objects containing CSD +% models +% TF - a 2x2 matrix of analysis objects containing TF +% models +% a# - are white noise aos +% av - a vector of wn aos +% am - a matrix of wn aos +% plst - a standard plist to call noisegen2D +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function [CSD,TF,a1,a2,a3,a4,a5,a6,av,am,plstd,plstd2] = get_test_obj_ao_noisegen2D() + + nsecs = 100; + fs = 10; % Hz + f = logspace(-6,log10(fs/2),100).'; % vector of frequencies Hz + + % Models response calculation + tf11 = calcTF11(f,fs); + tf12 = calcTF12(f,fs); + tf21 = calcTF21(f,fs); + tf22 = calcTF22(f,fs); + + % CSD calculation + csd11 = tf11.*conj(tf11)+tf12.*conj(tf12); + csd12 = tf11.*conj(tf21)+tf12.*conj(tf22); + csd22 = tf22.*conj(tf22)+tf21.*conj(tf21); + csd21 = conj(csd12); + csd11.setName('CSD11'); + csd12.setName('CSD12'); + csd21.setName('CSD21'); + csd22.setName('CSD22'); + + CSD = [csd11 csd12;csd21 csd22]; + TF = [tf11 tf12;tf21 tf22]; + + % Building test objects + a1 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', 'm')); + a2 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs)); + a3 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', 'm')); + a4 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', '')); + a5 = ao(plist('tsfcn', 'randn(size(t)).''', 'fs', fs, 'nsecs', nsecs, 'fm s^-2')); + a6 = ao(plist('tsfcn', 'randn(size(t)).''', 'fs', fs, 'nsecs', nsecs, 'V^2')); + av = [a1 a2 a3]; + am = [a1 a2; a3 a4]; + + a1.setName; + a2.setName; + a3.setName; + a4.setName; + a5.setName; + a6.setName; + + % building standard plist + plstd = plist(... + 'csd11', CSD(1,1), ... + 'csd12', CSD(1,2), ... + 'csd21', CSD(2,1), ... + 'csd22', CSD(2,2), ... + 'MaxIter', 60, ... + 'PoleType', 2, ... + 'MinOrder', 15, ... + 'MaxOrder', 45, ... + 'Weights', 3, ... + 'Plot', false,... + 'FITTOL', 0.1,... + 'MSEVARTOL', 0.1,... + 'UseSym', 0,... + 'Disp', false); + + plstd2 = plist(... + 'fs', fs, ... + 'Iunits', '', ... + 'Ounits', 'm', ... + 'MaxIter', 60, ... + 'PoleType', 2, ... + 'MinOrder', 15, ... + 'MaxOrder', 45, ... + 'Weights', 3, ... + 'Plot', false,... + 'FITTOL', 0.1,... + 'MSEVARTOL', 0.1,... + 'UseSym', 0,... + 'Disp', false); + +end + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% LOCAL FUNCTIONS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function tf11 = calcTF11(f,fs) + + + + % Model Stefano TF11 coefficients + dRes11 = [2.44554138162509e-011 - 1.79482547894083e-011i; + 2.44554138162509e-011 + 1.79482547894083e-011i; + 2.66402334803101e-009 + 1.1025122049153e-009i; + 2.66402334803101e-009 - 1.1025122049153e-009i; + -7.3560293387644e-009; + -1.82811618589835e-009 - 1.21803627800855e-009i; + -1.82811618589835e-009 + 1.21803627800855e-009i; + 1.16258677367555e-009; + 1.65216557639319e-016; + -1.78092396888606e-016; + -2.80420398962379e-017; + 9.21305973049041e-013 - 8.24686706827269e-014i; + 9.21305973049041e-013 + 8.24686706827269e-014i; + 5.10730060739905e-010 - 3.76571756625722e-011i; + 5.10730060739905e-010 + 3.76571756625722e-011i; + 3.45893698149735e-009; + 3.98139182134446e-014 - 8.25503935419059e-014i; + 3.98139182134446e-014 + 8.25503935419059e-014i; + -1.40595719147164e-011]; + + dPoles11 = [0.843464045655194 - 0.0959986292915475i; + 0.843464045655194 + 0.0959986292915475i; + 0.953187595424927 - 0.0190043625473383i; + 0.953187595424927 + 0.0190043625473383i; + 0.967176277937188; + 0.995012027005247 - 0.00268322602801729i; + 0.995012027005247 + 0.00268322602801729i; + 0.996564761885673; + 0.999999366165445; + 0.999981722418555; + 0.999921882627659; + 0.999624431675213 - 0.000813407848742761i; + 0.999624431675213 + 0.000813407848742761i; + 0.997312006278751 - 0.00265611346834941i; + 0.997312006278751 + 0.00265611346834941i; + 0.990516544257531; + 0.477796923118318 - 0.311064085401834i; + 0.477796923118318 + 0.311064085401834i; + 0]; + + dDTerms11 = 0; + + % response calculation + pfparams.type = 'disc'; + pfparams.freq = f; + pfparams.fs = fs; + pfparams.res = dRes11; + pfparams.pol = dPoles11; + pfparams.dterm = dDTerms11; + pfr = utils.math.pfresp(pfparams); + mtf11 = pfr.resp; + + % building AOs + tf11 = ao(plist('xvals', f, 'yvals', mtf11, 'fs', fs, 'type', 'fsdata')); + % name for this object + tf11.setName('TF11'); + +end + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function tf12 = calcTF12(f,fs) + + % Model Stefano TF12 + dRes12 = [1.44258422208796e-017 + 7.07359428613009e-019i; + 1.44258422208796e-017 - 7.07359428613009e-019i; + -3.4918408053655e-021 - 1.05662874569329e-021i; + -3.4918408053655e-021 + 1.05662874569329e-021i; + -7.61773292876976e-021; + 4.84357724603939e-020 + 2.38824204294595e-019i; + 4.84357724603939e-020 - 2.38824204294595e-019i; + -4.07088520945753e-020 - 2.31474543846105e-019i; + -4.07088520945753e-020 + 2.31474543846105e-019i; + 8.73316588658882e-023; + -5.21840635377469e-020; + 1.8461911504859e-023; + 5.20105247464461e-020; + -4.68960092394415e-022; + -1.44261407664171e-017 + 6.8922564526833e-019i; + -1.44261407664171e-017 - 6.8922564526833e-019i; + 3.13688133935426e-022]; + + dPoles12 = [0.477546340377332 - 0.310830571032376i; + 0.477546340377332 + 0.310830571032376i; + 0.99790715414307 - 0.0028490561287024i; + 0.99790715414307 + 0.0028490561287024i; + 0.998014205354671 ; + 0.999585354543332 - 0.000780408757425194i; + 0.999585354543332 + 0.000780408757425194i; + 0.99966003029931 - 0.000830944038363768i; + 0.99966003029931 + 0.000830944038363768i; + 0.999962770401331 ; + 0.999981881865521 ; + 0.999999365763457 ; + 0.999981706320212 ; + 0.99992421574188 ; + 0.477898460791003 + 0.311001926610074i; + 0.477898460791003 - 0.311001926610074i; + 0]; + dDTerms12 = 0; + + % response calculation + pfparams.type = 'disc'; + pfparams.freq = f; + pfparams.fs = fs; + pfparams.res = dRes12; + pfparams.pol = dPoles12; + pfparams.dterm = dDTerms12; + pfr = utils.math.pfresp(pfparams); + mtf12 = pfr.resp; + + % building AOs + tf12 = ao(plist('xvals', f, 'yvals', mtf12, 'fs', fs, 'type', 'fsdata')); + % name for this object + tf12.setName('TF12'); + +end + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function tf21 = calcTF21(f,fs) + + % Model Stefano Tf21 + dRes21 = [-1.80035241582968e-016 + 1.99543917791863e-015i; + -1.80035241582968e-016 - 1.99543917791863e-015i; + -1.85590889333759e-013 - 1.23844418827409e-014i; + -1.85590889333759e-013 + 1.23844418827409e-014i; + 5.03656596876842e-013 ; + -2.62470963499904e-013 + 2.30024232938878e-012i; + -2.62470963499904e-013 - 2.30024232938878e-012i; + -9.83780507870955e-018 ; + 3.40426735130194e-021 ; + 9.78322351492755e-018 ; + -1.65010934542937e-020 ; + 2.60918565203438e-015 + 1.0546609464659e-015i; + 2.60918565203438e-015 - 1.0546609464659e-015i; + 3.18105585405455e-014 + 2.48839990780042e-013i; + 3.18105585405455e-014 - 2.48839990780042e-013i; + 3.23021641947666e-013 ; + 4.81265000078114e-016 - 3.18269170053848e-017i; + 4.81265000078114e-016 + 3.18269170053848e-017i; + 5.16260024128201e-018]; + + dPoles21 = [0.872004077421604 - 0.110344282822693i; + 0.872004077421604 + 0.110344282822693i; + 0.956884129232757 - 0.0225532091775074i; + 0.956884129232757 + 0.0225532091775074i; + 0.966514825697177 ; + 0.995140550419744 - 0.000755127639524413i; + 0.995140550419744 + 0.000755127639524413i; + 0.999981802194393 ; + 0.99999936576546 ; + 0.999981722418555 ; + 0.999921882627659 ; + 0.999624431675213 + 0.000813407848742761i; + 0.999624431675213 - 0.000813407848742761i; + 0.997312006278751 + 0.00265611346834941i; + 0.997312006278751 - 0.00265611346834941i; + 0.990516544257531 ; + 0.477796923118318 + 0.311064085401834i; + 0.477796923118318 - 0.311064085401834i; + 0]; + + dDTerms21 = 0; + + % response calculation + pfparams.type = 'disc'; + pfparams.freq = f; + pfparams.fs = fs; + pfparams.res = dRes21; + pfparams.pol = dPoles21; + pfparams.dterm = dDTerms21; + pfr = utils.math.pfresp(pfparams); + mtf21 = pfr.resp; + + % building AOs + tf21 = ao(plist('xvals', f, 'yvals', mtf21, 'fs', fs, 'type', 'fsdata')); + % name for this object + tf21.setName('TF21'); + +end + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function tf22 = calcTF22(f,fs) + + % Model Stefano Tf22 + dRes22 = [1.1284521501259e-014; + -3.72133611555879e-014 - 2.08232683444075e-014i; + -3.72133611555879e-014 + 2.08232683444075e-014i; + 9.84930639106637e-014 - 1.46640810672565e-013i; + 9.84930639106637e-014 + 1.46640810672565e-013i; + 2.51323684013671e-014 ; + -5.64078525288305e-014 ; + -1.62476406586366e-014 ; + -1.08424815979566e-011 + 8.32328079357669e-012i; + -1.08424815979566e-011 - 8.32328079357669e-012i; + 2.41831559776112e-011]; + + dPoles22 = [0.988511243978897; + 0.997305870640646 + 0.00211760900132725i; + 0.997305870640646 - 0.00211760900132725i; + 0.999626453270255 + 0.0008125673525946i; + 0.999626453270255 - 0.0008125673525946i; + 0.999999366366222 ; + 0.999981706320212 ; + 0.99992421574188 ; + 0.477898460791003 - 0.311001926610074i; + 0.477898460791003 + 0.311001926610074i; + 0]; + + dDTerms22 = 0; + + % response calculation + pfparams.type = 'disc'; + pfparams.freq = f; + pfparams.fs = fs; + pfparams.res = dRes22; + pfparams.pol = dPoles22; + pfparams.dterm = dDTerms22; + pfr = utils.math.pfresp(pfparams); + mtf22 = pfr.resp; + + % building AOs + tf22 = ao(plist('xvals', f, 'yvals', mtf22, 'fs', fs, 'type', 'fsdata')); + % name for this object + tf22.setName('TF22'); + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/get_test_obj_ao_whiten2D.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/get_test_obj_ao_whiten2D.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,70 @@ +% test objects for ao/whiten2D +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: Output colored noise data and a model for mdc1 cross spectral density +% +% CALL: +% [CSD,a1,a2,a3,a4,a5,a6,av,am] = get_test_obj_ao_whiten2D() +% +% +% OUTPUTS: +% CSD - a 2x2 matrix of analysis objects containing CSD +% models +% a# - are colored noise time series AOs +% av - is a vector of 3 AOs +% am - is a 2x2 matrix of AOs +% +% M-FILE INFO: Get information about this methods by calling +% >> ao.getInfo('get_test_obj_ao_whiten2D') +% +% Get information about a specified set-plist by calling: +% >> ao.getInfo('get_test_obj_ao_whiten2D', 'none') +% +% VERSION: $Id: get_test_obj_ao_whiten2D.m,v 1.2 2009/02/19 17:34:18 luigi Exp $ +% +% +% HISTORY: 18-02-2009 L Ferraioli +% Creation +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function [CSD,a1,a2,a3,a4,a5,a6,av,am,plstd] = get_test_obj_ao_whiten2D() + + % getting CSD and TF + [CSD,TF,aw1,aw2,aw3,aw4,aw5,aw6,awv,awm,plstdng] = get_test_obj_ao_noisegen2D(); + + % Generating test objects + [a1,a2,a3,a4,a5,a6] = noisegen2D(aw1,aw2,aw3,aw4,aw5,aw6,plstdng); + + % setting name + a1.setName; + a2.setName; + a3.setName; + a4.setName; + a5.setName; + a6.setName; + + % Building vectors + av = [a1 a2 a3]; + am = [a1 a3;a2 a4]; + + fs = CSD(1,1).fs; + % standrd plist for ao/whiten2D + plstd = plist(... + 'csd11', CSD(1,1), ... + 'csd12', CSD(1,2), ... + 'csd21', CSD(2,1), ... + 'csd22', CSD(2,2), ... + 'MaxIter', 70, ... + 'PoleType', 2, ... + 'MinOrder', 24, ... + 'MaxOrder', 35, ... + 'Weights', 2, ... + 'Plot', false,... + 'FitTolerance', 1,... + 'RMSEVar', 5,... + 'UseSym', 0,... + 'Disp', false); + + +end \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/get_test_objects_ao.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/get_test_objects_ao.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,90 @@ +% GET_TEST_OBJECTS_AO returns a set of AOs suitable for many of the UTPs +% +% CALL: [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao(); +% +% OUTPUTS: +% at1 - a tsdata AO containing 2 seconds of a 1.23Hz sine wave sampled at 10Hz. +% at2 - an fsdata AO containing 1000 samples of white noise +% at3 - an xydata AO containing 100 data samples +% at4 - a cdata AO containing a 3x3 matrix +% at5 - a tsdata AO containing 30s of noise at 10Hz (data-vector = row vector) +% at6 - a tsdata AO containing 30s of different noise at 10Hz (data-vector = column vector) +% atvec - a vector of AOs containing [at1 at3 at3] +% atmat - a matrix of AOs containing [at1 at2 at3; at4 at5 at6] +% +% M Hewitson 06-08-08 +% +% $Id: get_test_objects_ao.m,v 1.8 2011/04/01 08:07:25 mauro Exp $ +% +function [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao + + %% Single AO containing a sine wave + fs = 10; + pl1 = plist(); + pl1.append('fs', fs); + pl1.append('nsecs', 30); + pl1.append('waveform', 'sine wave'); + pl1.append('f', 1.23); + pl1.append('phi', 30); + at1 = ao(pl1); + + + % Single AO containing an xydata object + x = 1:100; + y = exp(x.^.5/2); + at3 = ao(x,y, plist('type', 'xydata')); + + %% Single AO with a matrix + at4 = ao([1 -2 3; 4 5 -6; -7 8 9]); + + %% Single AO with 30s of noise + at5 = ao(plist('tsfcn', 'randn(size(t))', 'nsecs', 30, 'fs', fs)); + at5.setDy(at5.y*.1); + + %% Single AO with 30s of noise + at6 = ao(plist('tsfcn', 'randn(size(t)).''', 'nsecs', 30, 'fs', fs)); + + %% Single AO containing some fsdata + at2 = psd(at5); + at2.setDy(at2.y*.1); + + %% Set AOs yunits + + % Pick units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + + % Set units by choosing a random prefix and a random unit + at1.setYunits(... + unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + at2.setYunits(... + unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + at3.setYunits(... + unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + at4.setYunits(... + unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + at5.setYunits(... + unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + at6.setYunits(... + unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + %% Vector of AOs + atvec = [at2 at5 at6]; + + %% Matrix of AOs + atmat = [at1 at2 at3; at4 at5 at6]; + + %% Set AO names. + % Don't remove the setting of the AO names and it must be at the last position. + at1.setName; + at2.setName; + at3.setName; + at4.setName; + at5.setName; + at6.setName; + +end + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/get_test_objects_matrix.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/get_test_objects_matrix.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,59 @@ +% GET_TEST_OBJECTS_MATRIX returns a set of MATRIX objects suitable for many of the UTPs +% +% CALL: [ma1,ma2,ma3,mav,mam] = get_test_objects_matrix +% +% OUTPUTS: +% ma1 - matrix object with 2x3 AOs +% ma2 - matrix object with 3x2 AOs +% ma3 - matrix object with Filters (iir) +% ma4 - matrix object with Pole/Zero models +% mav - [ma1, ma2, ma3]; +% mam - [ma1, ma2, ma3; ma1 ma2 ma3]; +% +% +% M Hewitson 06-08-08 +% +% $Id: get_test_objects_matrix.m,v 1.1 2009/08/04 18:38:11 ingo Exp $ +% +function [ma1,ma2,ma3,ma4,mav,mam] = get_test_objects_matrix + + + %% empty matrix object + a1 = ao(1:10, randn(10,1), plist('type', 'tsdata')); + a2 = ao(1:10, randn(10,1), plist('type', 'tsdata')); + a3 = ao(1:10, randn(10,1), plist('type', 'tsdata')); + a4 = ao(1:10, randn(10,1), plist('type', 'tsdata')); + a5 = ao(1:10, randn(10,1), plist('type', 'tsdata')); + a6 = ao(1:10, randn(10,1), plist('type', 'tsdata')); + + ma1 = matrix([a1, a2, a3; a4 a5 a6]); + ma1.setName(); + + %% matrix object only with poles + ma2 = matrix(a1, a2, a3, a4, a5, a6, plist('shape', [3 2])); + ma2.setName(); + + %% matrix object with I-/O- units + iir1 = miir(plist('type', 'lowpass', 'order', 3)); + iir2 = miir(plist('type', 'lowpass', 'order', 3)); + iir3 = miir(plist('type', 'lowpass', 'order', 3)); + ma3 = matrix(iir1, [iir2 iir3], [iir1 iir2 iir3], plist('shape', [2 3])); + ma3.setName(); + + %% matrix object with I-/O- units + pzm1 = pzmodel(1, 1, 1); + pzm2 = pzmodel(1, {1 3}, 1); + pzm3 = pzmodel(1, [1 3], 1); + pzm4 = pzmodel(1, 1, {1 4}); + ma4 = matrix([pzm1, pzm2; pzm3, pzm4]); + ma4.setName(); + + %% matrix vector + mav = [ma1, ma2, ma3]; + + %% matrix matrix + mam = [ma1, ma2, ma3; ma4 ma1 ma2]; + +end + + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/get_test_objects_mfir.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/get_test_objects_mfir.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,59 @@ +% GET_TEST_OBJECTS_MFIR returns a set of MFIR objects suitable for many of the UTPs +% +% CALL: [firhp,firlp,firbp,firbr,firpzm,firao,firv,firm] = get_test_objects_mfir +% [fir1,fir2,fir3,fir4,fir5,fir6,firv,firm] = get_test_objects_mfir +% +% OUTPUTS: +% firhp - FIR highpass filter +% firlp - FIR lowpass filter +% firbp - FIR bandpass filter +% firbr - FIR bandreject filter +% firpzm - FIR object created from a pole/zero model +% firao - FIR object created from an analysis object +% firv - [firhp firlp firbr firao]; +% firm - [firhp firpzm firbp; firlp firbr firao]; +% +% +% M Hewitson 06-08-08 +% +% $Id: get_test_objects_mfir.m,v 1.5 2009/01/27 16:29:14 ingo Exp $ +% +function [firhp,firlp,firbp,firbr,firpzm,firao,firv,firm] = get_test_objects_mfir + + + %% FIR highpass filter + firhp = mfir(plist('type', 'highpass')); + firhp.setName(); + + %% FIR lowpass filter + firlp = mfir(plist('type', 'lowpass')); + firlp.setName(); + + %% FIR bandpass filter + firbp = mfir(plist('type', 'bandpass', 'fc', [0.01 0.1])); + firbp.setName(); + + %% FIR bandreject filter + firbr = mfir(plist('type', 'bandreject', 'fc', [0.01 0.1])); + firbr.setName(); + + %% FIR created from pole/zero model + pzm = pzmodel(1, [pz(1) pz(200)], pz(50)); + pl = plist('pzmodel', pzm, 'fs', 1000); + firpzm = mfir(pl); + firpzm.setName(); + + %% FIR created from AO + a1 = ao(plist('fsfcn', '1./(50+f)', 'f', linspace(0, 500, 1000))); + a1.setFs(1000); + pl = plist('ao', a1); + firao = mfir(pl); + firao.setName(); + + %% FIR vector + firv = [firhp firlp firbr firao]; + + %% FIR matrix + firm = [firhp firpzm firbp; firlp firbr firao]; + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/get_test_objects_miir.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/get_test_objects_miir.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,60 @@ +% GET_TEST_OBJECTS_MIIR returns a set of MIIR objects suitable for many of the UTPs +% +% CALL: [iirhp,iirlp,iirbp,iirbr,iirpzm,iirab,iirv,iirm] = get_test_objects_miir +% [iir1,iir2,iir3,iir4,iir5,iir6,iirv,iirm] = get_test_objects_miir +% +% OUTPUTS: +% iirhp - IIR highpass filter +% iirlp - IIR lowpass filter +% iirbp - IIR bandpass filter +% iirbr - IIR bandreject filter +% iirpzm - IIR from pzmodel +% iirab - IIR from a,b +% iirv - [iirhp iirlp iirbr iirpzm] +% iirm - [iirab iirbr iirbp; iirlp iirpzm iirhp] +% +% +% M Hewitson 06-08-08 +% +% $Id: get_test_objects_miir.m,v 1.3 2009/01/27 16:29:14 ingo Exp $ +% +function [iirhp,iirlp,iirbp,iirbr,iirpzm,iirab,iirv,iirm] = get_test_objects_miir + + + %% IIR highpass filter + iirhp = miir(plist('type', 'highpass')); + iirhp.setName(); + + %% IIR lowpass filter + iirlp = miir(plist('type', 'lowpass')); + iirlp.setName(); + + %% IIR bandpass filter + iirbp = miir(plist('type', 'bandpass', 'fc', [0.01 0.1])); + iirbp.setName(); + + %% IIR bandreject filter + iirbr = miir(plist('type', 'bandreject', 'fc', [0.01 0.1])); + iirbr.setName(); + + %% IIR created from pole/zero model + pzm = pzmodel(1, [pz(1) pz(200)], pz(50)); + pzm.setName(); + pl = plist('pzmodel', pzm, 'fs', 1000); + iirpzm = miir(pl); + iirpzm.setName(); + + %% IIR created from a and b + a = [0.5 -0.01]; + b = [1 0.1]; + fs = 1; + iirab = miir(a,b,fs); + iirab.setName(); + + %% IIR vector + iirv = [iirhp iirlp iirbr iirpzm]; + + %% IIR matrix + iirm = [iirab iirbr iirbp; iirlp iirpzm iirhp]; + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/get_test_objects_parfrac.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/get_test_objects_parfrac.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,40 @@ +% GET_TEST_OBJECTS_PARFRAC returns a set of PARFRAC objects suitable for many of the UTPs +% +% CALL: [pf1,pf2,pf3,pfv,pfm] = get_test_objects_parfrac +% +% OUTPUTS: +% pf1 - parfrac object without direct term +% pf2 - parfrac object with direct term +% pf3 - parfrac object with I-/O- units +% pfv - [pf1, pf2, pf3]; +% pfm - [pf1, pf2, pf3; pf1 pf2 pf3]; +% +% +% M Hewitson 06-08-08 +% +% $Id: get_test_objects_parfrac.m,v 1.3 2011/04/04 13:35:56 ingo Exp $ +% +function [pf1,pf2,pf3,pfv,pfm] = get_test_objects_parfrac + + + %% empty parfrac object + pf1 = parfrac([1 2], [4, 6+2i]); + pf1.setName(); + + %% parfrac object only with poles + pf2 = parfrac([1 2+1i 2-1i], [6 1+3i 1-3i], [1 2]); + pf2.setName(); + + %% parfrac object with I-/O- units + pf3 = parfrac([1 2+1i 2-1i], [6 1+3i 1-3i], [1 2 3 4], 'my par frac', unit('V'), unit('Hz')); + pf3.setName(); + + %% PARFRAC vector + pfv = [pf1, pf2, pf3]; + + %% PARFRAC matrix + pfm = [pf1, pf2, pf3; pf1 pf2 pf3]; + +end + + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/get_test_objects_plist.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/get_test_objects_plist.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,53 @@ +% GET_TEST_OBJECTS_PLIST returns a set of PLIST objects suitable for many of the UTPs +% +% CALL: [pl1, pl2, pl3, pl4, plv, plm] = get_test_objects_plist +% +% OUTPUTS: +% pl1 - An empty plist +% pl2 - A plist (simple) +% pl3 - A plist (complex) +% pl4 - A plist (objects) +% plv - [pl2 pl3 pl4] +% plm - [pl4 pl3 pl2; pl1 pl4 pl3] +% +% M Hewitson 06-08-08 +% +% $Id: get_test_objects_plist.m,v 1.2 2009/01/27 16:29:14 ingo Exp $ +% +function [pl1, pl2, pl3, pl4, plv, plm] = get_test_objects_plist + + %% PL1 + pl1 = plist(); + pl1.setName(); + + %% PL2 + pl2 = plist('a', 1, 'b', 2, 'c', 3); + pl2.setName(); + + %% PL3 + c = 'string'; + n = 123+5i; + l = true; + sy = sym('symbol'); + t = time('14:00:00'); + s = struct('a', c, 'b', n, 'c', l, 'd', sy, 'time', t); + ce = {'asd', [1 2 3; 4 5i 6], [true false], [sym('a'); sym('B')], s}; + + pl3 = plist('char', c, 'number', n, 'logical', l, 'symbolic', sy, 'struct', s, 'cell', ce); + pl3.setName(); + + %% PL4 + win = specwin('Kaiser', 5, 20); + a1 = ao(plist('xvals', '1:10', 'yvals', 'randn(10,1)')); + t1 = time(123456); + iir = miir(plist('type', 'lowpass')); + pl4 = plist('spec', win, 'time', t1, 'ao', a1, 'miir', iir); + pl4.setName(); + + %% PLV + plv = [pl2 pl3 pl4]; + + %% PLM + plm = [pl4 pl3 pl2; pl1 pl4 pl3]; + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/get_test_objects_pzmodel.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/get_test_objects_pzmodel.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,41 @@ +% GET_TEST_OBJECTS_PZMODEL returns a set of PZMODEL objects suitable for many of the UTPs +% +% CALL: [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel +% +% OUTPUTS: +% pz1 - A pzmodel with no zeros +% pz2 - A pzmodel with no poles +% pz3 - A pzmodel with both poles and zeros +% pz4 - An empty pzmodel +% pzv - [pz1 pz2 pz3] +% pzm - [pz1 pz2 pz3; pz2 pz3 pz1]; +% +% +% M Hewitson 06-08-08 +% +% $Id: get_test_objects_pzmodel.m,v 1.4 2009/01/08 16:43:30 ingo Exp $ +% +function [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel + + + %% PZ1 + pz1 = pzmodel(1, pz(1), []); + pz1.setName(); + %% PZ2 + pz2 = pzmodel(1, [], pz(1)); + pz2.setName(); + %% PZ3 + pz3 = pzmodel(1, [pz(1) pz(1,2)], pz(10)); + pz3.setName(); + %% PZ4 + pz4 = pzmodel(); + pz4.setName(); + %% PZ5 + pz5 = pzmodel(2, [pz(1) pz(1+2i)], pz(10), unit('V'), unit('Hz')); + pz5.setName(); + %% PZV + pzv = [pz1 pz2 pz3]; + %% PZM + pzm = [pz1 pz2 pz3; pz4 pz5 pz1]; + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/get_test_objects_rational.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/get_test_objects_rational.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,42 @@ +% GET_TEST_OBJECTS_RATIONAL returns a set of RATIONAL objects suitable for many of the UTPs +% +% CALL: [ra1,ra2,ra3,rav,ram] = get_test_objects_rational +% +% OUTPUTS: +% ra1 - rational object without direct term +% ra2 - rational object with direct term +% ra3 - rational object with I-/O- units +% rav - [ra1, ra2, ra3]; +% ram - [ra1, ra2, ra3; ra1 ra2 ra3]; +% +% +% M Hewitson 06-08-08 +% +% $Id: get_test_objects_rational.m,v 1.1 2009/02/08 16:37:26 ingo Exp $ +% +function [ra1,ra2,ra3,rav,ram] = get_test_objects_rational + + + %% rational object from pzmodel + pzm = pzmodel(12, {2, [3 5], 7}, {1+2i 5}); + ra1 = rational(pzm); + ra1.setName(); + + %% rational object from parfrac object + pf = parfrac([1 2+1i 2-1i], [6 1+3i 1-3i], [1 2]); + ra2 = rational(pf); + ra2.setName(); + + %% rational object (num, den, name, iunits, ounits) + ra3 = rational([1 2 3], [4 5 6 7], 'my rational', unit('V'), unit('Hz')); + ra3.setName(); + + %% rational vector + rav = [ra1, ra2, ra3]; + + %% rational matrix + ram = [ra1, ra2, ra3; ra1 ra2 ra3]; + +end + + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/get_test_objects_ssm.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/get_test_objects_ssm.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,24 @@ +% GET_TEST_OBJECTS_SSM returns a set of SSMs suitable for many of the UTPs +% +% CALL: [sys1,sys2] = get_test_objects_ao(); +% +% OUTPUTS: +% sys1 - a numerical dampened mass-spring system +% sys2 - a symbolic dampened mass-spring system +% +% A Grynagier 25-02-09 +% +% $Id: get_test_objects_ssm.m,v 1.3 2010/12/22 16:08:32 ingo Exp $ +% +function [sys1 sys2] = get_test_objects_ssm + + sys1 = ssm(plist('built-in', 'LPF')); + sys2 = ssm(plist('built-in', 'DIST_TM', 'SYMBOLIC PARAMS', 'ALL')); + + %% SetSSM names. + % Don't remove the setting of the SSM names and it must be at the last position. + sys1.setName; + sys2.setName; + +end + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/get_test_objects_timespan.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/get_test_objects_timespan.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,45 @@ +% GET_TEST_OBJECTS_TIMESPAN returns a set of TIMESPAN objects suitable for many of the UTPs +% +% CALL: [ts1, ts2, ts3, ts4, ts5, ts6, tsv, tsm] = get_test_objects_timespan +% +% OUTPUTS: +% ts1 - An empty timespan +% ts2 - A timespan +% ts3 - A timespan +% ts4 - A timespan +% ts5 - A timespan +% ts6 - A timespan +% tsv - [ts6 ts2 ts5] +% tsm - [ts1 ts2 ts3; ts4 ts5 ts6]; +% +% M Hewitson 06-08-08 +% +% $Id: get_test_objects_timespan.m,v 1.3 2009/08/03 18:34:11 ingo Exp $ +% +function [ts1, ts2, ts3, ts4, ts5, ts6, tsv, tsm] = get_test_objects_timespan + + %% TS1 + ts1 = timespan(); + ts1.setName(); + %% TS2 + ts2 = timespan(1000, 10000); + ts2.setName(); + %% TS3 + ts3 = timespan('2008-08-08 12:00:00', '2008-08-08 13:00:00'); + ts3.setName(); + %% TS4 + ts4 = timespan(time(10), time(100)); + ts4.setName(); + %% TS5 + pl = plist('timezone', 'PST', 'timeformat', 'HH:MM:SS.FFF', 'startT', time(1234), 'endT', time(12345)); + ts5 = timespan(pl); + ts5.setName(); + %% TS6 + ts6 = timespan(10, time(100), 'HH:MM:SS'); + ts6.setName(); + %% TSV + tsv = [ts6 ts2 ts5]; + %% TSM + tsm = [ts1 ts2 ts3; ts4 ts5 ts6]; + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/get_test_ples.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/get_test_ples.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,70 @@ +% GET_TEST_PLES returns parameter lists with exception for the equal method +% +% CALL: [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples +% +% OUTPUTS: ple1 - created, proctime, UUID, param/desc, version +% ple2 - created, proctime, UUID, param/desc, name, methodInvars, +% version +% ple3 - history, created, UUID, param/desc, name, version +% ple4 - identical to ple1 +% ple5 - identical to ple1 +% ple6 - identical to ple1 +% +% VERSION: $Id: get_test_ples.m,v 1.7 2010/06/07 16:41:47 ingo Exp $ +% +function [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples() + + %% ple1 + ple1 = plist('Exceptions', {'created', 'proctime', 'UUID', 'param/desc', 'version'}); + + % Possible reasons for this exceptions: + % + % 'created' : The rebuid method creates the new object at a different + % time. + % 'proctime' : The rebuid method creates the new object at a different + % time. + % 'UUID' : The rebuild method creates a new object with a new UUID + % 'param/desc': The rebuild method doesn't rebuild the description of a + % parameter. Even the possible options are not rebuilt. The + % rebuild method rebuilds only the used key/value pair. + % + + %% ple2 + ple2 = plist('Exceptions', {'created', 'proctime', 'UUID', 'param/desc', 'name', 'methodInvars', 'version'}); + + % Possible reasons for this exceptions (see above): + % + % 'name' : Sometimes adds a method the variable name to the name + % of an object. But the rebuild method uses its own + % created variable names. + % 'methodInvars': The history adds always the variable names of the input + % object or a name which represents the variable name. + % Our rebuild method create its own variable names. + + %% ple3 + ple3 = plist('Exceptions', {'history', 'created', 'UUID', 'param/desc', 'name', 'version'}); + + + % 'version' in some cases, like whenever the constructor goes through a + % from* file, then the version can be different than the + % constructor version so after the copy constructor the version + % is different. + + %% ple4 + ple4 = plist('Exceptions', {'created', 'proctime', 'UUID', 'param/desc', 'name', 'methodInvars', 'version', 'plistUsed'}); + + % Possible reasons for this exceptions (see above): + % + % 'plistUsed': Some methods put the variable name as a key/value pair + % to the history plist. For example: + % 'name'/'fir((1./smoother(ASD(a4642512))))' + + %% ple5 + ple5 = ple1; + + %% ple6 + ple6 = ple1; + + +end + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/isEmptyCell.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/isEmptyCell.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,13 @@ +% ISEMPTYCHAR returns true if the input is an empty char cell. +% +% CALL: res = isEmptyChar(val) +% +% OUTPUTS: true, flase +% +% VERSION: $Id: isEmptyCell.m,v 1.1 2011/04/11 19:42:27 ingo Exp $ +% +function res = isEmptyCell(val) + + res = iscell(val) && isempty(val); + +end \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/isEmptyChar.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/isEmptyChar.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,13 @@ +% ISEMPTYCHAR returns true if the input is an empty char ''. +% +% CALL: res = isEmptyChar(val) +% +% OUTPUTS: true, flase +% +% VERSION: $Id: isEmptyChar.m,v 1.1 2009/07/20 15:13:38 ingo Exp $ +% +function res = isEmptyChar(val) + + res = ischar(val) && isempty(val); + +end \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/isEmptyDouble.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/isEmptyDouble.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,13 @@ +% ISEMPTYDOUBLE returns true if the input is an empty double []. +% +% CALL: res = isEmptyDouble(val) +% +% OUTPUTS: true, flase +% +% VERSION: $Id: isEmptyDouble.m,v 1.1 2009/07/20 15:13:38 ingo Exp $ +% +function res = isEmptyDouble(val) + + res = isnumeric(val) && isempty(val); + +end \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/utpCloseConnection.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/utpCloseConnection.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,26 @@ +% UTPCLOSECONNECTION closes the connection. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: UTPCLOSECONNECTION closes the connection. +% +% CALL: utpGetConnection(conn) +% +% VERSION: $Id: utpCloseConnection.m,v 1.2 2009/09/20 15:38:53 ingo Exp $ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function utpCloseConnection(conn) + + if isa(conn, 'database') + % MATLAB connection + if isconnection(conn) + close(conn); + end + elseif isa(conn, 'mpipeline.repository.RepositoryConnection') + % java connection + conn.closeConnection(); + else + error('### Unknown connection [%s]. Can not close the connection', class(conn)); + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/utpGetConnection.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/utpGetConnection.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,21 @@ +% UTPGETCONNECTION returns the connection for the repository tests. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: UTPGETCONNECTION returns the connection for the repository +% tests. +% +% CALL: conn = utpGetConnection() +% +% VERSION: $Id: utpGetConnection.m,v 1.1 2009/09/19 15:27:52 ingo Exp $ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function conn = utpGetConnection() + +% % MATLAB connection +% conn = utils.mysql.connect(utpGetHostname, utpGetDatabase, utpGetUsername, utpGetPassword); + + % java connection + conn = utils.jmysql.connect(utpGetHostname, utpGetDatabase, utpGetUsername, utpGetPassword); + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/utpGetConnectionPlist.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/utpGetConnectionPlist.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,20 @@ +% UTPGETCONNECTIONPLIST returns the connection plist for the repository tests. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: UTPGETCONNECTION returns the connection plist for the +% repository tests. +% +% CALL: conn = utpGetConnectionPlist() +% +% VERSION: $Id: utpGetConnectionPlist.m,v 1.2 2010/02/01 18:42:38 ingo Exp $ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function connPl = utpGetConnectionPlist() + + % java connection + rm = LTPDARepositoryManager(); + rm.newConnection(utpGetHostname, utpGetDatabase, utpGetUsername, utpGetPassword); + connPl = plist('hostname', utpGetHostname, 'database', utpGetDatabase, 'username', utpGetUsername); + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/utpGetDatabase.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/utpGetDatabase.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,18 @@ +% UTPGETDATABASE returns the database for the repository tests. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: UTPGETDATABASE returns the database for the repository +% tests. +% +% CALL: database = utpGetDatabase() +% +% VERSION: $Id: utpGetDatabase.m,v 1.1 2009/09/19 15:27:53 ingo Exp $ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function database = utpGetDatabase() + +% database = 'an other db name'; + database = 'ltpda_test'; + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/utpGetHostname.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/utpGetHostname.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,18 @@ +% UTPGETHOSTNAME returns the hostname for the repository tests. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: UTPGETHOSTNAME returns the hostname for the repository +% tests. +% +% CALL: hostname = utpGetHostname() +% +% VERSION: $Id: utpGetHostname.m,v 1.1 2009/09/19 15:27:53 ingo Exp $ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function hostname = utpGetHostname() + +% hostname = 'localhost'; + hostname = '130.75.117.67'; + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/utpGetPassword.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/utpGetPassword.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,20 @@ +% UTPGETPASSWORD returns the password for the repository tests. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: UTPGETPASSWORD returns the password for the repository +% tests. +% +% CALL: password = utpGetPassword() +% +% VERSION: $Id: utpGetPassword.m,v 1.4 2010/07/26 16:43:37 hewitson Exp $ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function password = utpGetPassword() + + password = getappdata(0, 'LTPDARepoPassword'); + if isempty(password) + password = 'a1b2c3d4'; + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/utpGetUsername.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/utpGetUsername.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,20 @@ +% UTPGETUSERNAME returns the username for the repository tests. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: UTPGETUSERNAME returns the username for the repository +% tests. +% +% CALL: username = utpGetUsername() +% +% VERSION: $Id: utpGetUsername.m,v 1.3 2010/07/14 12:38:49 hewitson Exp $ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function username = utpGetUsername() + + username = getappdata(0, 'LTPDARepoUsername'); + if isempty(username) + username = 'tester'; + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_fcns/utp_prepare_result.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_fcns/utp_prepare_result.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,75 @@ +% UTP_PREPARE_RESULT prepares a result structure from the inputs +% +% M Hewitson 07-11-07 +% +% $Id: utp_prepare_result.m,v 1.13 2011/04/27 09:03:02 hewitson Exp $ +% +function result = utp_prepare_result(a, s, stack, call, varargin) + + result.a = 0; + result.s = 0; + result.fcn = '?'; + result.num = '?'; + result.date = time; + result.runtime = toc(); + result.msg = '?'; + result.method = '?'; + result.class = '?'; + result.file = '?'; + + if numel(stack)>1 + + % look for utp_run + idx = -1; + for kk=1:numel(stack) + if strcmp(stack(kk).name, 'utp_run') + idx = kk; + break; + end + end + + if idx>0 + call = stack(idx-1).name; + end + end + + % parse out utp number + parts = regexp(stack(1).name, '_', 'split'); + parts = regexp(parts{end}, '(\w+)(\(.*\))*', 'tokens'); + utpnum = parts{1}{1}; + + result.a = a; + result.s = s; + result.fcn = sprintf('%s_%s', call, utpnum); + result.num = utpnum; + result.subnum = parts{1}{2}; + result.msg = ''; + + parts = regexp(call, '_', 'split'); + result.method = parts{end}; + result.class = parts{end-1}; + result.utp = strrep(stack(1).name, result.subnum, ''); + if ismember('file', fieldnames(stack(1))) + result.file = stack(1).file; + else + result.file = ''; + end + + if a + as = 'Pass'; + else + as = 'Fail'; + end + if s + ss = 'Pass'; + else + ss = 'Fail'; + end + + if numel(varargin) >= 1 + result.msg = varargin{1}; + fprintf(' %-27s | %s | %s | %s\n', result.num, ss, as, varargin{1}); + else + fprintf(' %-27s | %s | %s\n', result.num, ss, as); + end +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_run.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_run.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,207 @@ +% UTP_RUN Runs the UTP tests found in the 'utps' directory. If no output +% argument is specified a results report is generated and printed to screen, +% otherwise the results are returned. +% +% USAGE: +% +% >> % run all the tests in the 'utps' directory +% >> utp_run(); +% +% >> % run the UTPs with the given names +% >> utp_run('utp_classname_fcn1', 'utp_classname_fcn2', ...); +% +% >> % run a reduced set of UTPs operating on the listed classes +% >> utp_run('classname1', 'classname2', ...); +% +% EXAMPLES: +% +% >> utp_run(); +% >> utp_run('utp_ao_ao'); +% >> utp_run('utp_ao_ao', 'utp_ao_abs'); +% >> utp_run('ao', 'tsdata', 'fsdata'); +% >> utp_run('ao', 'tsdata', 'fsdata', pl); +% +% pl keys +% 'tests' - cell array of strings above +% 'no repository' - true/false +% 'skip tests' - cell array of tests to skip +% 'skip classes' - cell array of classes to skip +% +% +% +% $Id: utp_run.m,v 1.20 2010/08/09 16:38:49 ingo Exp $ + +function varargout = utp_run(varargin) + + % save current path + oldpath = path(); + + [pl, dummy, rest] = utils.helper.collect_objects(varargin(:), 'plist'); + + % Make sure that pl is a PLIST + pl = combine(plist(), pl); + + skipClasses = pl.find('skip classes', ''); + skipTests = pl.find('skip tests', ''); + tests = pl.find('tests', ''); + noRepository = pl.find('no repository', false); + + if ~isempty(rest) && ~isempty(tests) + tests = [reshape(cellstr(tests), 1, []), reshape(rest, 1, [])]; + elseif ~isempty(tests) + tests = cellstr(tests); + elseif ~isempty(rest) + tests = rest; + end + + try + % add support functions and UTPs folders to path + utppath = fileparts(which('utp_run')); + addpath(genpath(utppath)); + + % list of the classes for which we have UTPs + classes = {}; + + % cell array to hold UTP function names to run + utps = {}; + + % check for input arguments + if numel(tests) > 0 + + % check if input argument is a list of UTP function names + if all(strncmp(tests, 'utp_', 4)) + % add the given UTPs to the list of test functions to run + for kk = 1:numel(tests) + uname = tests{kk}; + % check if the given UTPs exist + if exist(uname, 'file') == 2 + utps = addUtpTest(utps, tests(kk)); + else + error('### test ''%s'' not found\n', uname); + end + end + else + % assume input argument is a list of classes + for kk = 1:numel(tests) + cname = tests{kk}; + % check if it exists + if exist(fullfile(utppath, 'utps', cname), 'dir') + classes = [classes {cname}]; + else + error('### test class ''%s'' not found\n', cname); + end + end + end + + else + + % list of all the classes we have UTPs for + d = dir(fullfile(utppath, 'utps')); + for kk = 1:numel(d) + if ~d(kk).isdir + continue; + end + if d(kk).name(1) == '.' + continue; + end + if strcmp(d(kk).name, 'CVS') + continue; + end + + % Skip classes + if utils.helper.ismember(d(kk).name, skipClasses) + continue; + end + classes = [classes {d(kk).name}]; + end + + end + + % add to the UPTs function name list the UTPs for each class in the list + for kk = 1:numel(classes) + mfiles = dir(fullfile(utppath, 'utps', classes{kk})); + % identify all UTP functions + for jj=1:length(mfiles) + [pathstr, name, ext] = fileparts(mfiles(jj).name); + if ~strcmp(ext, '.m') + continue; + end + try + utps = addUtpTest(utps, name); + end + end + end + + % number of collected UTPs to run + fprintf('%d UTPs to run\n', numel(utps)); + + % initialize timer to measure UTPs execution time + tic(); + + % call each UTP function and collect the results + results = []; + for jj=1:length(utps) + try + results = [results eval(utps{jj})]; + catch ex + % report the error failure in running the UTP + stack.name = 'xx'; + message = ['exception: ' ex.message]; + results = [results utp_prepare_result(false, false, stack, utps{jj}, message)]; + % show error on console + fprintf(2, ['\n' ex.getReport()]); + fprintf(1, '\n'); + end + end + + % set output + if nargout == 1 + varargout{1} = results; + else + display_utp_results(results) + end + + catch ex + % restore original path + path(oldpath); + rethrow(ex); + end + + % restore original path + path(oldpath); + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % + % FUNCTION: addUtpTest + % + % DESCRIPTION: Local method which adds an UTP to the UTP list if it pass + % all conditions. + % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + function utpsLocal = addUtpTest(utpsLocal, utpIn) + + utpIn = cellstr(utpIn); + + % Check if the UTP name is a UTP + if feval(utpIn{1}, 'isutp') + + addUTP = true; + % Skip the UTPs if it needs a repository. + if noRepository && feval(utpIn{1}, 'needs repository') == 2 + addUTP = false; + end + % Skip the UTPs if it is in the skil list. + if utils.helper.ismember(utpIn{1}, skipTests) + addUTP = false; + end + + if addUTP + utpsLocal = [utpsLocal utpIn]; + end + + end + + end + +end + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_template.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_template.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,112 @@ +% UTP_TEMPLATE a set of unit tests for FOO. +% +% Joe Blogs 28-07-10 +% +% $Id: utp_template.m,v 1.5 2010/07/28 04:11:07 hewitson Exp $ +% + +% +% +% The method FOO for the class Boing does bouncy things with data. +% +% + +function results = utp_template(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'Boing'; + model = 'foo'; + + results = []; + disp('******************************************************'); + disp(['**** Running Unit Tests for ' class '/' model]); + disp('******************************************************'); + + % Run the tests + results = [results utp_01()]; % check FOO does something useful + + 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 + + + % + % + % Tests that the method does something useful. + % + % + % + % $Id: utp_template.m,v 1.5 2010/07/28 04:11:07 hewitson Exp $ + % + + function result = utp_01(varargin) + + % + % + % Tests that the method does something useful. + % + % + + try + + % + + % Here we just check that a suitable call to the method can be made. + + % + stest = true; + catch err + disp(err.message) + msg = [err.message ' - ' err.stack(1).name ' - line ' num2str(err.stack(1).line)]; + stest = false; + end + + % + % + % 1) Check that the object is pink when embarrassed + % 2) Check that the data are nice and shiny + % + % + + atest = true; + if stest + msg = ''; + % + + % Here we perform detailed checks on the content of the objects or + % outputs produced during the syntax check + + if somethingBad + atest = false; + msg = 'Oooh something bad happened here'; + end + + if somethingElseBad + atest = false; + msg = 'Wow something else bad happened here'; + end + + % + else + atest = false; + end + + % Return a result structure + dd = dbstack; + mfilename = dd(2).file(1:end-2); + result = utp_prepare_result(atest, stest, dbstack, mfilename, msg); + end % END UTP_XX + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_test_files/loadAllFiles.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_test_files/loadAllFiles.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,53 @@ + +clc; + +matfiles = utils.prog.filescan('.', '.mat'); +xmlfiles = utils.prog.filescan('.', '.xml'); + +currentVer = ''; +currentCl = ''; + +for j=1:numel(matfiles) + fn = matfiles{j}; + [path, name, ext, ver] = fileparts(fn); + [cl, rest] = strtok(name, '_'); + [v, rest] = strtok(rest, '_'); + if ~strcmp(v, currentVer) || ~strcmp(cl, currentCl) + currentCl = cl; + currentVer = v; + fprintf('%%%% Loading MAT files of class: %s and version: %s\n', cl, currentVer); + end + try + warning('off', 'MATLAB:unknownElementsNowStruc'); + obj = feval(cl, fn); + warning('on', 'MATLAB:unknownElementsNowStruc'); + catch err + fprintf(2, '----- Loading %s failed. ', fn); + fprintf(2, '%s\n', err.message); + end +end + +currentVer = ''; +currentCl = ''; + +for j=1:numel(xmlfiles) + fn = xmlfiles{j}; + [path, name, ext, ver] = fileparts(fn); + [cl, rest] = strtok(name, '_'); + [v, rest] = strtok(rest, '_'); + if ~strcmp(v, currentVer) || ~strcmp(cl, currentCl) + currentCl = cl; + currentVer = v; + fprintf('%%%% Loading XML files of class: %s and version: %s\n', cl, currentVer); + end + try + obj = feval(cl, fn); + catch err + fprintf(2, '----- Loading %s failed. ', fn); + fprintf(2, '%s\n', err.message) + end +end + +disp('%%%% Done.'); + + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utp_test_files/makeTestFiles.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utp_test_files/makeTestFiles.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,451 @@ +% MAKETESTFILES builds a set of test files for the current LTPDA version. +% +% M Hewitson 09-09-08 +% +% $Id: makeTestFiles.m,v 1.8 2010/05/12 15:55:19 ingo Exp $ +% +function makeTestFiles() + + mkPlist(); + + mkAO(); + mkRational(); + mkParfrac(); + mkPzmodel(); + mkMiir(); + mkMfir(); + mkTimespan(); + mkSSM(); + + mkCollection(); + mkMatrix; + mkSmodel; + mkPest; + mkFilterbank; + +end + +%% PLIST +function mkPlist() + + + pl1 = plist(); + pl2 = plist('a', 1, 'b', 2, 'c', 3); + pl3 = plist('char', 'string', ... + 'number', 123, ... + 'logical', true, ... + 'cell', {'asd', [1 2 3; 4 5 6], [true false], 'asd'}); + + pl4 = plist('spec', specwin('kaiser', 5, 20), ... + 'time', time(123456), ... + 'ao', ao(1:10, randn(10,1)), ... + 'miir', miir(plist('type', 'lowpass'))); + + plvec = [pl1, pl2, pl3]; + plmat = [pl1, pl2, pl3; pl4, pl1, pl2]; + + writeFiles([pl1, pl2, pl3, pl4], plvec, plmat); + +end + +%% AO +function mkAO() + + % tsdata ao + aots = ao(plist('fs', 10, 'nsecs', 10, ... + 'tsfcn', 'sin(2*pi*1.4*t) + 0.1*randn(size(t))', ... + 't0', time('1980-12-01 12:43:12'))); + + aots.setName(); + + % fsdata ao + aofs = aots.psd; + aofs.setName(); + + % xydata ao + aoxy = ao(xydata(1:10,1:10)); + aoxy.setName(); + + % cdata ao + aoc = ao(magic(3)); + aoc.setName(); + + plvec = [aots, aofs, aoxy]; + plmat = [aots, aofs, aoxy; aots, aoc, ao()]; + + writeFiles([aots, aofs, aoxy, aoc], plvec, plmat); + +end + +%% Pzmodel +function mkPzmodel() + + pzm1 = pzmodel(1, pz(1), []); + pzm1.setName(); + + pzm2 = pzmodel(1, [], pz(1)); + pzm2.setName(); + + pzm3 = pzmodel(1, 1, 10); + pzm3.setName(); + + pzm4 = pzmodel(); + pzm4.setName(); + + pzm5 = pzmodel(2, 10, {1, [1 1]}); + pzm5.setName(); + + pzmvec = [pzm1, pzm2, pzm3]; + pzmmat = [pzm1, pzm2, pzm3; pzm4, pzm5, pzm5]; + + writeFiles([pzm1, pzm2, pzm3, pzm4, pzm5], pzmvec, pzmmat); + +end + +%% MFIR +function mkMfir() + + fir1 = mfir(plist('type', 'highpass')); + fir1.setName(); + + fir2 = mfir(plist('type', 'lowpass')); + fir2.setName(); + + fir3 = mfir(plist('type', 'lowpass', 'fc', .1, 'gain', 1, 'fs', 1, 'order', 64, 'WIN', specwin('Hanning', 65))); + fir3.setName(); + + pzm = pzmodel(1, [pz(1) pz(200)], pz(50)); + pl = plist('pzmodel', pzm, 'fs', 1000); + fir4 = mfir(pl); + fir4.setName(); + + a1 = ao(plist('fsfcn', '1./(50+f)', 'f', linspace(0, 500, 1000))); + a1.setFs(1000); + pl = plist('ao', a1); + fir5 = mfir(pl); + fir5.setName(); + + firvec = [fir1, fir2, fir3]; + firmat = [fir1, fir2, fir3; fir4, fir5, fir5]; + + writeFiles([fir1, fir2, fir3, fir4, fir5], firvec, firmat); + +end +%% MIIR +function mkMiir() + + iir1 = miir(plist('type', 'lowpass')); + iir1.setName(); + + iir2 = miir(plist('type', 'bandpass', 'fc', [0.01 0.1])); + iir2.setName(); + + iir3 = miir(plist('type', 'bandreject', 'fc', [0.01 0.1])); + iir3.setName(); + + pzm = pzmodel(1, [pz(1) pz(200)], pz(50)); + pzm.setName(); + pl = plist('pzmodel', pzm, 'fs', 1000); + iir4 = miir(pl); + iir4.setName(); + + a = [0.5 -0.01]; + b = [1 0.1]; + fs = 1; + iir5 = miir(a,b,fs); + iir5.setName(); + + iirvec = [iir1, iir2, iir3]; + iirmat = [iir1, iir2, iir3; iir4, iir5, iir5]; + + writeFiles([iir1, iir2, iir3, iir4, iir5], iirvec, iirmat); + +end + +%% SSM +function mkSSM + + try + s1 = ssm(); + s2 = ssm(plist('built-in', 'SMD')); + s3 = ssm(plist('built-in', 'HARMONIC_OSC_1D')); + + sVec = [s1, s2, s3]; + sMat = [s1, s2, s3; s2, s1, s2]; + + writeFiles([s1 s2 s3], sVec, sMat); + catch + warning('!!! Don''t know how to build this SSM object.'); + end + +end + +%% TIMESPAN +function mkTimespan() + + ts1 = timespan(); + ts1.setName(); + + ts2 = timespan('2008-08-08 12:00:00', '2008-08-08 13:00:00'); + ts2.setName(); + + ts3 = timespan(time(10), time(100)); + ts3.setName(); + + ts4 = timespan(time(0) ,'14:00:00'); % timespan + ts4.setName(); + + pl = plist('timezone', 'GMT+06','start', time(1234),'end', time(12345)); + ts5 = timespan(pl); + ts5.setName(); + + tsvec = [ts4, ts2, ts5]; + + tsmat = [ts1, ts2, ts5; ts4, ts3, ts2]; + + writeFiles([ts1, ts2, ts3, ts4, ts5], tsvec, tsmat) + +end + +%% PARFRAC +function mkParfrac() + + pf1 = parfrac(); + pf1.setName(); + + pf2 = parfrac([1 2], {4, 6+2i}, []); + pf2.setName(); + + pf3 = parfrac([1 2+1i 2-1i], [6 1+3i 1-3i], [1 2]); + pf3.setName(); + + pf4 = parfrac([1 2+1i 2-1i], [6 1+3i 1-3i], [1 2 3 4], 'my par frac', unit('V'), unit('Hz')); + pf4.setName(); + + pzm = pzmodel(1, pz(1), [pz(1,2), pz(1+2i)]); + pl = plist('pzmodel', pzm, 'name', 'new name', 'iunits', 'm^3', 'ounits', 'Hz'); + pf5 = parfrac(pl); + pf5.setName(); + + pfvec = [pf4, pf2, pf5]; + + pfmat = [pf1, pf2, pf5; pf4, pf3, pf2]; + + writeFiles([pf1, pf2, pf3, pf4, pf5], pfvec, pfmat) + +end + +%% RATIONAL +function mkRational() + + ra1 = rational(); + ra1.setName(); + + ra2 = rational([1 2], [4, 6], 'my rational'); + ra2.setName(); + + ra3 = rational([1 2 -3], [6 -7 1 -5], 'my par rat', unit('V'), unit('Hz')); + ra3.setName(); + + pzm = pzmodel(1, pz(1), [pz(1,2), pz(1+2i)]); + pl = plist('pzmodel', pzm, 'name', 'new name', 'iunits', 'm^3', 'ounits', 'Hz'); + ra4 = rational(pl); + ra4.setName(); + + ravec = [ra4, ra3, ra2]; + + ramat = [ra1, ra2, ra3; ra4, ra3, ra2]; + + writeFiles([ra1, ra2, ra3, ra4], ravec, ramat) + +end + +%% COLLECTION +function mkCollection() + + coll1 = collection(); + coll1.setName(); + + coll2 = collection(rational([1 2], [4, 6], 'my rational'), ao(magic(8)), mfir(plist('type', 'lowpass'))); + coll2.setName(); + + coll3 = collection(ao(1:51, randn(1,51) + 1.1i, 12.3), pzmodel(1, pz(1), [pz(1,2), pz(1+2i)])); + coll3.setName(); + coll3.setPlotinfo(plist('color', 'black')); + + + collVec = [coll1, coll2, coll3]; + + collMat = [coll3, coll1, coll2; coll2 coll3, coll1]; + + writeFiles([coll1, coll2, coll3], collVec, collMat) + +end + +%% MATRIX +function mkMatrix() + + m1 = matrix(); + m1.setName(); + + m2 = matrix([ao(1), ao(2) ao(3); ao(4), ao(5), ao(6)]); + m2.setName(); + + m3 = matrix(ao(1), ao(2), ao(3)); + m3.setName(); + m3.setPlotinfo(plist('color', 'black')); + + + mVec = [m1, m2, m3]; + + mMat = [m3, m1, m2; m2 m3, m1]; + + writeFiles([m1, m2, m3], mVec, mMat) + +end + +%% SMODEL +function mkSmodel() + + model1 = smodel(); + model1.setName(); + + model2 = smodel('C1*X1 + C2*X2 + C3*X3'); + model2.setParams('C1', 1.00447715161685); + model2.setParams('C2', 2.06131342419899); + model2.setParams('C3', 3.03410245878967); + model2.setXvals(randn(1,100)); + % model2.setXvar({'X1', 'X2', 'X3'}); + model2.setXvar('X1'); + model2.setXunits(unit('T', 'm', 'C')); + model2.setYunits('m'); + model2.setPlotinfo(plist('color', 'black')); + model2.setName(); + + modelVec = [model1, model2]; + + modelMat = [model1, model1 model2; model1 model2, model1]; + + writeFiles([model1, model2], modelVec, modelMat) + +end + +%% PEST +function mkPest() + + model = smodel('C1*X1 + C2*X2 + C3*X3'); + model.setParams('C1', 1.00447715161685); + model.setParams('C2', 2.06131342419899); + model.setParams('C3', 3.03410245878967); + % model.setXvar({'X1', 'X2', 'X3'}); + model.setXvar('X1'); + model.setXunits(unit('T', 'm', 'C')); + model.setYunits('m'); + model.setName(); + + pest1 = pest([1;2.06;3.03], {'C1', 'C2', 'C3'}, [0.0917;0.089;0.0957], [0.00841 -0.000604 0.000455;-0.000604 0.00791 -0.000246;0.000455 -0.000246 0.00916]); + pest1.setYunits(unit('[m T^(-1)]','[m m^(-1)]','[m C^(-1)]')); + pest1.setModels(model); + pest1.setName(); + + pest2 = pest(); + pest2.setName(); + + pestVec = [pest1, pest2]; + + pestMat = [pest1, pest1 pest2; pest1 pest2, pest1]; + + writeFiles([pest1, pest2], pestVec, pestMat) + +end + +%% FILTERBANK +function mkFilterbank() + + a1 = ao(plist('fsfcn', '1./(50+f)', 'f', linspace(0, 500, 1000))); + a1.setFs(1000); + pl = plist('ao', a1); + + f1 = mfir(pl); + f2 = mfir(plist('Type', 'lowpass')); + f3 = mfir(plist('type', 'lowpass', 'fc', .1, 'gain', 1, 'fs', 1, 'order', 64, 'WIN', specwin('Hanning', 65))); + + pzm = pzmodel(1, [pz(1) pz(200)], pz(50)); + pzm.setName(); + pl = plist('pzmodel', pzm, 'fs', 1000); + + f4 = miir(pl); + f5 = miir(); + f6 = miir(plist('type', 'bandreject', 'fc', [0.01 0.1])); + + fb1 = filterbank(); + fb1.setName(); + + fb2 = filterbank([f1, f2, f3], 'serial'); + fb2.setPlotinfo(plist('color', 'black')); + fb2.setName(); + + fb3 = filterbank(f4, f5, f6); + + fbVec = [fb1, fb2, fb3]; + + fbMat = [fb1, fb3 fb2; fb1 fb2, fb3]; + + writeFiles([fb1, fb2, fb3], fbVec, fbMat) + +end + +%% Write Function +function writeFiles(objs, obj_vec, obj_mat) + + % class + cln = class(objs); + + % Get the toolbox version + tbxver = getappdata(0, 'ltpda_version'); + + % get only the version string without the MATLAB version + tbxver = strtok(tbxver); + + % remove the points between the subversions + tbxver = strrep(tbxver, '.', ''); + + %%%%%%%%%% Save single objects %%%%%%%%%% + for ii = 1:numel(objs) + + % Create filename + filename = sprintf('%s_%s_%d', cln, tbxver, ii); + + % Save XML + save(objs(ii), [filename '.xml']); + if ~strcmp(tbxver, '191') + % Save MAT + save(objs(ii), [filename '.mat']); + end + end + + %%%%%%%%%% Save vector of object %%%%%%%%%% + + % Create filename + filename = sprintf('%s_%s_vec', cln, tbxver); + + % Save XML + save(obj_vec, [filename '.xml']); + if ~strcmp(tbxver, '191') + % Save MAT + save(obj_vec, [filename '.mat']); + end + + %%%%%%%%%% Save matrix of object %%%%%%%%%% + + % Create filename + filename = sprintf('%s_%s_mat', cln, tbxver); + + % Save XML + save(obj_mat, [filename '.xml']); + if ~strcmp(tbxver, '191') + % Save MAT + save(obj_mat, [filename '.mat']); + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/reference_files/create_ref_psd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/reference_files/create_ref_psd.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,56 @@ +% CREATE_REF_PSD creates a reference psd +% +% M Nofrarias 20-01-09 +% +% $Id: create_ref_psd.m,v 1.2 2009/02/13 14:31:05 mauro Exp $ +% + +% +% +% The method uses computes the psd of known white noise using MATLAB's +% pwelch +% +% + +function create_ref_psd() + + % + + % analyzes reference object: 10 s at 1000 Hz, sigma = 1 + a = ao('ref_whitenoise_10s_1000Hz.xml'); + + Nfft = 2*a.data.fs; + win = specwin('Hanning', Nfft); + [pxx, f] = pwelch(a.data.y, win.win, Nfft*win.rov/100, Nfft, a.data.fs); + + out = [f pxx]; + + save('ref_psd_10s_1000Hz.txt','out','-ascii','-double'); + + % analyzes reference object: 3600 s at 1 Hz, sigma = 3e-4 + a = ao('ref_whitenoise_3600s_1Hz.xml'); + + Nfft = 1000; + win = specwin('BH92', Nfft); + [pxx, f] = pwelch(a.data.y, win.win, Nfft*win.rov/100, Nfft, a.data.fs); + + out = [f pxx]; + + save('ref_psd_3600s_1Hz.txt','out','-ascii','-double'); + + % analyzes reference object: 100000 s at 0.1 Hz, sigma = 4e-12 + a = ao('ref_whitenoise_100000s_100mHz.xml'); + + Nfft = a.data.fs * a.data.nsecs; + psll = 100; + win = specwin('Kaiser', Nfft, psll); + [pxx, f] = pwelch(a.data.y, win.win, Nfft*win.rov/100, Nfft, a.data.fs); + + out = [f pxx]; + + save('ref_psd_100000s_100mHz.txt','out','-ascii','-double'); + + % + + +end \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/reference_files/create_ref_whitenoise.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/reference_files/create_ref_whitenoise.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,74 @@ +% CREATE_REF_WHITENOISE creates a set of known white noise time series to +% be used in UTP testing +% +% M Nofrarias 20-01-09 +% +% $Id: create_ref_whitenoise.m,v 1.5 2010/05/06 07:29:42 ingo Exp $ +% + +% +% +% The method uses the 'whitenoise' AO model to create white noise using +% always the same seed for the noise generator. +% +% + +function create_ref_whitenoise() + + % + + % creates 10 s at 1000 Hz, sigma = 1 + pl = plist(... + 'sigma',1,... + 'nsecs',10,... + 'fs',1000); + + a = ao(plist('built-in', 'whitenoise'),pl); + % save xml file + save(a,'ref_whitenoise_10s_1000Hz.xml'); + + + % creates 3600 s at 1 Hz, sigma = 3e-8 + pl = plist(... + 'sigma',3e-8,... + 'nsecs',3600,... + 'fs',1); + + a = ao(plist('built-in', 'whitenoise'),pl); + % save xml file + save(a,'ref_whitenoise_3600s_1Hz.xml'); + + + % creates 100000 s at 0.1 Hz, sigma = 4e-12 + pl = plist(... + 'sigma',4e-12,... + 'nsecs',100000,... + 'fs',0.1); + + a = ao(plist('built-in', 'whitenoise'),pl); + % save xml file + save(a,'ref_whitenoise_100000s_100mHz.xml'); + + % creates 2e4 s at 10 Hz, sigma = 5e-6 + pl = plist(... + 'sigma', 5e-6,... + 'nsecs', 2e3,... + 'fs', 10); + + a = ao(plist('built-in', 'whitenoise'),pl); + % save xml file + save(a,'ref_whitenoise_20000s_10Hz.xml'); + + % creates 2e5 s at 10 Hz, sigma = 5e-6 + pl = plist(... + 'sigma', 5e-6,... + 'nsecs', 2e3,... + 'fs', 10); + + a = ao(plist('built-in', 'whitenoise'),pl); + % save xml file + save(a,'ref_whitenoise_200000s_10Hz.xml'); + + % + +end \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_abs.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_abs.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,132 @@ +% UTP_AO_ABS a set of UTPs for the ao/abs method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_abs.m,v 1.30 2011/04/17 09:11:10 hewitson Exp $ +% + +% +% +% The abs method of the ao class computes the absolute value of the y +% and/or x data. +% +% + +function results = utp_ao_abs(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'abs'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple1)]; % Test the modify call works + results = [results utp_08(mthd, at1, ple2)]; % Test with additional plist with the key 'axis' + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at5, at6, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% Algorithm test for UTP 02,03,04 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(abs(in.data.getY), out.data.getY) + atest = false; + end + end + + + + + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_acos.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_acos.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,129 @@ +% UTP_AO_ACOS a set of UTPs for the ao/acos method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_acos.m,v 1.15 2011/04/17 09:50:21 hewitson Exp $ +% + +% +% +% The acos method of the ao class computes the inverse cosine of the y +% and/or x data. +% +% + +function results = utp_ao_acos(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'acos'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple1)]; % Test the modify call works + results = [results utp_08(mthd, at1, ple2)]; % Test with additional plist with the key 'axis' + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at5, at6, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(acos(in.data.getY), out.data.getY) + atest = false; + end + end + + + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_and.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_and.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,125 @@ +% UTP_AO_AND a set of UTPs for the ao/and method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_and.m,v 1.1 2010/09/23 19:48:49 ingo Exp $ +% + +% +% +% The AND method of the ao class performs a logical AND of the y data of +% the two inputs. +% +% + +function results = utp_ao_and(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'and'; + + results = []; + disp('******************************************************'); + disp('**** Running UTPs for ao/and'); + disp('******************************************************'); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_generic_aop_rule1(@and)]; % Rule 1 + results = [results utp_generic_aop_rule2(@and)]; % Rule 2 + results = [results utp_generic_aop_rule3(@and)]; % Rule 3 + results = [results utp_generic_aop_rule4(@and)]; % Rule 4 + results = [results utp_generic_aop_rule5(@and)]; % Rule 5 + results = [results utp_generic_aop_rule6(@and)]; % Rule 6 + results = [results utp_generic_aop_rule7(@and)]; % Rule 7 + results = [results utp_generic_aop_rule8(@and)]; % Rule 8 + results = [results utp_generic_aop_rule9(@and)]; % Rule 9 + results = [results utp_generic_aop_rule10(@and)]; % Rule 10 + results = [results utp_generic_aop_rule11(@and)]; % Rule 11 + results = [results utp_generic_aop_negative_tests(@and)]; % Negative tests + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_angle.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_angle.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,139 @@ +% UTP_AO_ANGLE a set of UTPs for the ao/angle method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_angle.m,v 1.10 2011/04/17 09:50:12 hewitson Exp $ +% + +% +% +% The angle method of the ao class returns the phase angles, in radians, of +% a matrix with complex elements. +% +% + +function results = utp_ao_angle(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'angle'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + plts = plist('fs', '1', 'nsecs', 30, 'tsfcn', 'randn(size(t)) + randn(size(t))*i'); + plfs = plist('f', '1:30', 'fsfcn', 'randn(size(f)) + randn(size(f))*i'); + plxy = plist('x', '1:30', 'xyfcn', 'randn(size(x)) + randn(size(x))*i'); + at1 = ao(plts); + at2 = ao(plfs); + at3 = ao(plxy); + at4 = ao([1 -3+5i +5; 3-1i .5 -7]); + at5 = ao(plist('fs', '1', 'nsecs', 30, 'tsfcn', 'transpose(randn(size(t)) + randn(size(t))*i)')); + atvec = [at1, at2, at3, at4]; + atmat = [at1, at2, at3; at3, at2, at1]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple2)]; % Test the modify call works + results = [results utp_08(mthd, at1, ple2)]; % Test with additional plist with the key 'axis' + results = [results utp_09(mthd, at1, at5)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at1, at2, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(angle(in.data.getY), out.data.getY) + atest = false; + end + end + + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_ao.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_ao.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,1964 @@ +% UTP_AO_AO a set of UTPs for the ao/ao method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_ao.m,v 1.73 2011/08/15 10:44:51 hewitson Exp $ +% + +% +% +% The ao method of the ao class constructs AOs. +% +% + +function results = utp_ao_ao(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'ao'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Define THRESHOLD for computing error + TOL = 1e-14; + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, [], [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, [], [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, [], [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, [], [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + + % Old format + results = [results utp_08]; % Test history is working with ASCII file constructor + results = [results utp_09]; % Test history is working with complex ASCII file constructor + results = [results utp_13]; % Test history is working with vals constructor + results = [results utp_15]; % Test history is working with plist(fcn) constructor + results = [results utp_16]; % Test history is working with plist(vals) constructor + results = [results utp_17]; % Test history is working with plist(x/y-vals) constructor + results = [results utp_18]; % Test history is working with plist(tsfcn) constructor + results = [results utp_19]; % Test history is working with plist(fsfcn) constructor + results = [results utp_20]; % Test history is working with plist(win) constructor + results = [results utp_21]; % Test history is working with plist(waveform) constructor + results = [results utp_23]; % Test history is working with plist(polynomial) constructor + results = [results utp_25]; % Test history is working with specwin constructor + results = [results utp_26]; % Test history is working with data-objects constructor + results = [results utp_28]; % Test history is working with x-vector, y-vector constructor + results = [results utp_29]; % Test history is working with filename + plist constructor + results = [results utp_30]; % Test history is working with filename + plist constructor + results = [results utp_31]; % Test history is working with filename + plist constructor + + % constructor specific tests + results = [results utp_60(class, at3, ple2)]; % Test history is properly handled with MAT file constructor + results = [results utp_61(class, at1, ple2)]; % Test history is properly handled with XML file constructor + results = [results utp_62(class, at1, at2, ple2)]; % Test history is working with struct constructor +% results = [results utp_63(class, ple1)]; % Test history is working with pzmodel-object constructor + results = [results utp_64(class, at1, ple1, ple2)]; % Test history is working with plist(filename) constructor + results = [results utp_65(class, at1, ple3)]; % Test history is working with plist(hostname) constructor + results = [results utp_66(class, ple1)]; % Test history is working with plist(pzmodel) constructor + results = [results utp_67(class, ple1)]; % Test history is working with pzmodel + plist constructor + results = [results utp_68(class, at1, ple3)]; % Test history is working with conn+Id constructor + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + msg = ''; + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + msg = err.message; + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + + % SET 'None' + if ~isempty(io(1).sets), atest = false; msg = 'Sets ''None'' isn''t empty.'; end + if ~isempty(io(1).plists), atest = false; msg = 'First plist for all sets isn''t empty.'; end + % Check number of SETS + if numel(io(2).sets) ~= 21, atest = false; msg = 'Number of sets is wrong'; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; msg = 'Sets array does not contain ''Default'''; end + if ~any(strcmpi(io(2).sets, 'From MAT File')), atest = false; msg = 'Sets array does not contain ''From MAT File'''; end + if ~any(strcmpi(io(2).sets, 'From XML File')), atest = false; msg = 'Sets array does not contain ''From XML File'''; end + if ~any(strcmpi(io(2).sets, 'From Repository')), atest = false; msg = 'Sets array does not contain ''From Repository'''; end + if ~any(strcmpi(io(2).sets, 'From Built-in model')), atest = false; msg = 'Sets array does not contain ''From Built-in Model'''; end + if ~any(strcmpi(io(2).sets, 'From MAT Data File')), atest = false; msg = 'Sets array does not contain ''From MAT Data File'''; end + if ~any(strcmpi(io(2).sets, 'From ASCII File')), atest = false; msg = 'Sets array does not contain ''From ASCII File'''; end + if ~any(strcmpi(io(2).sets, 'From Complex ASCII File')), atest = false; msg = 'Sets array does not contain ''From Complex ASCII File'''; end + if ~any(strcmpi(io(2).sets, 'From Function')), atest = false; msg = 'Sets array does not contain ''From Function'''; end + if ~any(strcmpi(io(2).sets, 'From Values')), atest = false; msg = 'Sets array does not contain ''From Values'''; end + if ~any(strcmpi(io(2).sets, 'From XY Values')), atest = false; msg = 'Sets array does not contain ''From XY Values''';end + if ~any(strcmpi(io(2).sets, 'From Time-series Function')), atest = false; msg = 'Sets array does not contain ''From Time-series Function'''; end + if ~any(strcmpi(io(2).sets, 'From XY Function')), atest = false; msg = 'Sets array does not contain ''From XY Function'''; end + if ~any(strcmpi(io(2).sets, 'From Frequency-series Function')), atest = false; msg = 'Sets array does not contain ''From Frequency-series Function'''; end + if ~any(strcmpi(io(2).sets, 'From Window')), atest = false; msg = 'Sets array does not contain ''From Window'''; end + if ~any(strcmpi(io(2).sets, 'From Waveform')), atest = false; msg = 'Sets array does not contain ''From Waveform''';end + if ~any(strcmpi(io(2).sets, 'From Polynomial')), atest = false; msg = 'Sets array does not contain ''From Polynomial''';end + if ~any(strcmpi(io(2).sets, 'From Pzmodel')), atest = false; msg = 'Sets array does not contain ''From Pzmodel''';end + if ~any(strcmpi(io(2).sets, 'From smodel')), atest = false; msg = 'Sets array does not contain ''From smodel''';end + if ~any(strcmpi(io(2).sets, 'From pest')), atest = false; msg = 'Sets array does not contain ''From pest''';end + if ~any(strcmpi(io(2).sets, 'From Parameter')), atest = false; msg = 'Sets array does not contain ''From Parameter'''; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; msg = 'Number of plists does not match number of sets'; end + %%%%%%%%%% SET 'Default' + % Check key + pn = 3; + [atest, msg] = checkParamNumber(io, pn, 3); + % Check default value + % Check options + %%%%%%%%%% SET 'From MAT File' + pn = 4; + [atest, msg] = checkParamNumber(io, pn, 1); + % Check key + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + %%%%%%%%%% SET 'From XML File' + pn = 5; + [atest, msg] = checkParamNumber(io, pn, 1); + % Check key + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + %%%%%%%%%% SET 'From Repository' + pn = 6; + [atest, msg] = checkParamNumber(io, pn, 7); + % Check key + if ~io(pn).plists.isparam('hostname'), atest = false; end + if ~io(pn).plists.isparam('id'), atest = false; end + if ~io(pn).plists.isparam('cid'), atest = false; end + if ~io(pn).plists.isparam('database'), atest = false; end + if ~io(pn).plists.isparam('binary'), atest = false; end + if ~io(pn).plists.isparam('username'), atest = false; end + if ~io(pn).plists.isparam('password'), atest = false; end + % Check default value + if ~isEmptyDouble(io(pn).plists.find('id')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('cid')), atest = false; end + if ~isequal(io(pn).plists.find('binary'), 'yes'), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('id'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('cid'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('binary'), {'yes', 'no'}), atest = false; end + %%%%%%%%%% SET 'From Built-in model' + pn = 7; + [atest, msg] = checkParamNumber(io, pn, 1); + % Check key + if ~io(pn).plists.isparam('built-in'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('built-in')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('built-in'), {''}), atest = false; end + %%%%%%%%%% SET 'From MAT Data File' + pn = 8; + [atest, msg] = checkParamNumber(io, pn, 9); + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('filename'), atest = false; end + if ~io(pn).plists.isparam('type'), atest = false; end + if ~io(pn).plists.isparam('columns'), atest = false; end + if ~io(pn).plists.isparam('xunits'), atest = false; end + if ~io(pn).plists.isparam('yunits'), atest = false; end + if ~io(pn).plists.isparam('fs'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + if ~isequal(io(pn).plists.find('type'), 'cdata'), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('columns')), atest = false; end + if ~isequal(io(pn).plists.find('xunits'), 's'), atest = false; end + if ~isEmptyChar(io(pn).plists.find('yunits')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('fs')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('name'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('description'), {''}), atest = false; end + % not sure how to test this + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('type'), {'tsdata', 'fsdata', 'xydata', 'cdata'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('columns'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {'s'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end + %%%%%%%%%% SET 'From ASCII File' + pn = 9; + [atest, msg] = checkParamNumber(io, pn, 14); + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('filename'), atest = false; end + if ~io(pn).plists.isparam('type'), atest = false; end + if ~io(pn).plists.isparam('columns'), atest = false; end + if ~io(pn).plists.isparam('xunits'), atest = false; end + if ~io(pn).plists.isparam('t0'), atest = false; end + if ~io(pn).plists.isparam('yunits'), atest = false; end + if ~io(pn).plists.isparam('comment_char'), atest = false; end + if ~io(pn).plists.isparam('maxlines'), atest = false; end + if ~io(pn).plists.isparam('fs'), atest = false; end + if ~io(pn).plists.isparam('robust'), atest = false; end + if ~io(pn).plists.isparam('delimiter'), atest = false; end + % Check default value + if ~isequal(io(pn).plists.find('name'), ''), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + if ~isequal(io(pn).plists.find('type'), 'cdata'), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('columns')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('xunits')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('yunits')), atest = false; end + if ~isequal(double(time(io(pn).plists.find('t0'))), 0), atest = false; end + if ~isEmptyChar(io(pn).plists.find('comment_char')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('maxlines')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('fs')), atest = false; end + if ~isequal(io(pn).plists.find('robust'), 'no'), atest = false; end + if ~isequal(io(pn).plists.find('delimiter'), ''), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('name'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('description'), {''}), atest = false; end + % not sure how to test this + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('type'), {'tsdata', 'fsdata', 'xydata', 'cdata'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('columns'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('comment_char'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('maxlines'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('robust'), {'yes', 'no'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('delimiter'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('t0'), {'1970-01-01 00:00:00.000'}), atest = false; end + %%%%%%%%%% SET 'From Complex ASCII File' + pn = 10; + [atest, msg] = checkParamNumber(io, pn, 11); + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('filename'), atest = false; end + if ~io(pn).plists.isparam('complex_type'), atest = false; end + if ~io(pn).plists.isparam('t0'), atest = false; end + if ~io(pn).plists.isparam('type'), atest = false; end + if ~io(pn).plists.isparam('columns'), atest = false; end + if ~io(pn).plists.isparam('xunits'), atest = false; end + if ~io(pn).plists.isparam('yunits'), atest = false; end + if ~io(pn).plists.isparam('comment_char'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + if ~strcmp(io(pn).plists.find('complex_type'), 'real/imag'), atest = false; end + if ~strcmp(io(pn).plists.find('type'), 'fsdata'), atest = false; end + if ~isequal(io(pn).plists.find('columns'), [1 2 3]), atest = false; end + if ~isequal(io(pn).plists.find('xunits'), 'Hz'), atest = false; end + if ~isEmptyChar(io(pn).plists.find('yunits')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('comment_char')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('complex_type'), { 'real/imag', 'abs/deg', 'dB/deg', 'abs/rad', 'dB/rad'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('type'), {'tsdata', 'fsdata', 'xydata', 'cdata'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('columns'), {[1 2 3]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {'Hz'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('comment_char'), {''}), atest = false; end + %%%%%%%%%% SET 'From Function' + pn = 11; + [atest, msg] = checkParamNumber(io, pn, 5); + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('fcn'), atest = false; end + if ~io(pn).plists.isparam('yunits'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('fcn')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('yunits')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('fcn'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end + %%%%%%%%%% SET 'From Values' + pn = 12; + [atest, msg] = checkParamNumber(io, pn, 6); + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('vals'), atest = false; end + if ~io(pn).plists.isparam('n'), atest = false; end + if ~io(pn).plists.isparam('yunits'), atest = false; end + % Check default value + if ~isEmptyDouble(io(pn).plists.find('vals')), atest = false; end + if ~isequal(io(pn).plists.find('n'), 1), atest = false; end + if ~isEmptyChar(io(pn).plists.find('yunits')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('vals'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('n'), {[1]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end + %%%%%%%%%% SET 'From XY Values' + pn = 13; + [atest, msg] = checkParamNumber(io, pn, 11); + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('type'), atest = false; end + if ~io(pn).plists.isparam('fs'), atest = false; end + if ~io(pn).plists.isparam('t0'), atest = false; end + if ~io(pn).plists.isparam('toffset'), atest = false; end + if ~io(pn).plists.isparam('xvals'), atest = false; end + if ~io(pn).plists.isparam('yvals'), atest = false; end + if ~io(pn).plists.isparam('xunits'), atest = false; end + if ~io(pn).plists.isparam('yunits'), atest = false; end + if ~io(pn).plists.isparam('t0'), atest = false; end + % Check default value + if ~isequal(io(pn).plists.find('type'), ''), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('fs')), atest = false; end + if ~isequal(double(time(io(pn).plists.find('t0'))), 0), atest = false; end + if ~isequal(io(pn).plists.find('toffset'), 0), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('xvals')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('yvals')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('xunits')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('yunits')), atest = false; end + if ~isequal(io(pn).plists.find('t0'), '1970-01-01 00:00:00.000'), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('type'), {'', 'tsdata', 'fsdata', 'xydata', 'cdata'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('xvals'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('yvals'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('t0'), {'1970-01-01 00:00:00.000'}), atest = false; end + %%%%%%%%%% SET 'From Time-series Function' + pn = 14; + [atest, msg] = checkParamNumber(io, pn, 9); + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('tsfcn'), atest = false; end + if ~io(pn).plists.isparam('fs'), atest = false; end + if ~io(pn).plists.isparam('nsecs'), atest = false; end + if ~io(pn).plists.isparam('t0'), atest = false; end + if ~io(pn).plists.isparam('xunits'), atest = false; end + if ~io(pn).plists.isparam('yunits'), atest = false; end + % Check default value + if ~isequal(io(pn).plists.find('tsfcn'), 't'), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('fs')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('nsecs')), atest = false; end + if ~isequal(double(time(io(pn).plists.find('t0'))), 0), atest = false; end + if ~isequal(io(pn).plists.find('xunits'), 's'), atest = false; end + if ~isEmptyChar(io(pn).plists.find('yunits')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('tsfcn'), {'t'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('nsecs'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('t0'), {'1970-01-01 00:00:00.000'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {'s'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end + %%%%%%%%%% SET 'From XY Function' + pn = 15; + [atest, msg] = checkParamNumber(io, pn, 7); + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('xyfcn'), atest = false; end + if ~io(pn).plists.isparam('x'), atest = false; end + if ~io(pn).plists.isparam('xunits'), atest = false; end + if ~io(pn).plists.isparam('yunits'), atest = false; end + % Check default value + if ~isequal(io(pn).plists.find('xyfcn'), 'x'), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('x')), atest = false; end + if ~isequal(io(pn).plists.find('xunits'), ''), atest = false; end + if ~isequal(io(pn).plists.find('yunits'), ''), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('xyfcn'), {'x'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('x'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end + %%%%%%%%%% SET 'From Frequency-series Function' + pn = 16; + [atest, msg] = checkParamNumber(io, pn, 11); + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('fsfcn'), atest = false; end + if ~io(pn).plists.isparam('f1'), atest = false; end + if ~io(pn).plists.isparam('f2'), atest = false; end + if ~io(pn).plists.isparam('nf'), atest = false; end + if ~io(pn).plists.isparam('scale'), atest = false; end + if ~io(pn).plists.isparam('f'), atest = false; end + if ~io(pn).plists.isparam('xunits'), atest = false; end + if ~io(pn).plists.isparam('yunits'), atest = false; end + % Check default value + if ~isequal(io(pn).plists.find('fsfcn'), 'f'), atest = false; end + if ~isequal(io(pn).plists.find('f1'), 1e-9), atest = false; end + if ~isequal(io(pn).plists.find('f2'), 10000), atest = false; end + if ~isequal(io(pn).plists.find('nf'), 1e3), atest = false; end + if ~isequal(io(pn).plists.find('scale'), 'log'), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('f')), atest = false; end + if ~isequal(io(pn).plists.find('xunits'), 'Hz'), atest = false; end + if ~isEmptyChar(io(pn).plists.find('yunits')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('fsfcn'), {'f'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('f1'), {1e-9}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('f2'), {1e4}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('nf'), {1e3}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('scale'), {'lin', 'log'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('f'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {'Hz'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end + %%%%%%%%%% SET 'From Window' + pn = 17; + [atest, msg] = checkParamNumber(io, pn, 8); + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('win'), atest = false; end + if ~io(pn).plists.isparam('length'), atest = false; end + if ~io(pn).plists.isparam('psll'), atest = false; end + if ~io(pn).plists.isparam('levelorder'), atest = false; end + if ~io(pn).plists.isparam('yunits'), atest = false; end + % Check default value + if ~strcmpi(io(pn).plists.find('win'), char(prefs.getMiscPrefs.getDefaultWindow)), atest = false; end + if ~isequal(io(pn).plists.find('yunits'), ''), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('win'), specwin.getTypes), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end + %%%%%%%%%% SET 'From Waveform' + pn = 18; + [atest, msg] = checkParamNumber(io, pn, 22); + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('waveform'), atest = false; end + if ~io(pn).plists.isparam('a'), atest = false; end + if ~io(pn).plists.isparam('f'), atest = false; end + if ~io(pn).plists.isparam('phi'), atest = false; end + if ~io(pn).plists.isparam('toff'), atest = false; end + if ~io(pn).plists.isparam('gaps'), atest = false; end + if ~io(pn).plists.isparam('type'), atest = false; end + if ~io(pn).plists.isparam('sigma'), atest = false; end + if ~io(pn).plists.isparam('f0'), atest = false; end + if ~io(pn).plists.isparam('f1'), atest = false; end + if ~io(pn).plists.isparam('t1'), atest = false; end + if ~io(pn).plists.isparam('bw'), atest = false; end + if ~io(pn).plists.isparam('duty'), atest = false; end + if ~io(pn).plists.isparam('width'), atest = false; end + if ~io(pn).plists.isparam('fs'), atest = false; end + if ~io(pn).plists.isparam('nsecs'), atest = false; end + if ~io(pn).plists.isparam('t0'), atest = false; end + if ~io(pn).plists.isparam('xunits'), atest = false; end + if ~io(pn).plists.isparam('yunits'), atest = false; end + % Check default value + if ~isequal(io(pn).plists.find('waveform'), 'sine wave'), atest = false; end + if ~isequal(io(pn).plists.find('a'), 1), atest = false; end + if ~isequal(io(pn).plists.find('f'), 1), atest = false; end + if ~isequal(io(pn).plists.find('phi'), 0), atest = false; end + if ~isequal(io(pn).plists.find('toff'), 0), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('gaps')), atest = false; end + if ~isequal(io(pn).plists.find('type'), 'Normal'), atest = false; end + if ~isequal(io(pn).plists.find('sigma'), 1), atest = false; end + if ~isequal(io(pn).plists.find('f0'), 1), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('f1')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('t1')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('bw')), atest = false; end + if ~isequal(io(pn).plists.find('duty'), 50), atest = false; end + if ~isequal(io(pn).plists.find('width'), 0.5), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('fs')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('nsecs')), atest = false; end + if ~isequal(double(time(io(pn).plists.getOptionsForParam('t0'))), 0), atest = false; end + if ~isequal(io(pn).plists.find('xunits'), 's'), atest = false; end + if ~isequal(io(pn).plists.find('yunits'), ''), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('waveform'), {'sine wave', 'noise', 'chirp', 'gaussian pulse', 'square wave', 'sawtooth'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('a'), {1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('f'), {1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('phi'), {0}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('toff'), {0}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('gaps'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('type'), {'Normal', 'Uniform'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('sigma'), {1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('f0'), {1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('f1'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('t1'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('bw'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('duty'), {50}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('width'), {0.5}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('nsecs'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('t0'), {'1970-01-01 00:00:00.000'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {'s'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end + %%%%%%%%%% SET 'From Polynomial' + pn = 19; + [atest, msg] = checkParamNumber(io, pn, 13); + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('polyval'), atest = false; end + if ~io(pn).plists.isparam('nsecs'), atest = false; end + if ~io(pn).plists.isparam('fs'), atest = false; end + if ~io(pn).plists.isparam('t0'), atest = false; end + if ~io(pn).plists.isparam('t'), atest = false; end + if ~io(pn).plists.isparam('x'), atest = false; end + if ~io(pn).plists.isparam('f'), atest = false; end + if ~io(pn).plists.isparam('type'), atest = false; end + if ~io(pn).plists.isparam('xunits'), atest = false; end + if ~io(pn).plists.isparam('yunits'), atest = false; end + % Check default value + if ~isEmptyDouble(io(pn).plists.find('polyval')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('nsecs')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('fs')), atest = false; end + if ~isequal(io(pn).plists.find('t0'), '1970-01-01 00:00:00.000'), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('t')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('x')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('f')), atest = false; end + if ~isequal(io(pn).plists.find('type'), 'tsdata'), atest = false; end + if ~isequal(io(pn).plists.find('xunits'), 's'), atest = false; end + if ~isEmptyChar(io(pn).plists.find('yunits')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('polyval'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('nsecs'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('t0'), {'1970-01-01 00:00:00.000'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('t'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('x'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('f'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('type'), {'tsdata', 'fsdata', 'xydata', 'cdata'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {'s'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end + %%%%%%%%%% SET 'From Pzmodel' + pn = 20; + [atest, msg] = checkParamNumber(io, pn, 9); + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('pzmodel'), atest = false; end + if ~io(pn).plists.isparam('nsecs'), atest = false; end + if ~io(pn).plists.isparam('fs'), atest = false; end + if ~io(pn).plists.isparam('t0'), atest = false; end + if ~io(pn).plists.isparam('xunits'), atest = false; end + if ~io(pn).plists.isparam('yunits'), atest = false; end + % Check default value + if ~eq(io(pn).plists.find('pzmodel'), pzmodel(), ple1), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('nsecs')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('fs')), atest = false; end + if ~isequal(io(pn).plists.find('t0'), '1970-01-01 00:00:00.000'), atest = false; end + if ~isequal(io(pn).plists.find('xunits'), 's'), atest = false; end + if ~isEmptyChar(io(pn).plists.find('yunits')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('nsecs'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('t0'), {'1970-01-01 00:00:00.000'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {'s'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end + %%%%%%%%%% SET 'From smodel' + pn = 21; + [atest, msg] = checkParamNumber(io, pn, 7); + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('model'), atest = false; end + if ~io(pn).plists.isparam('xunits'), atest = false; end + if ~io(pn).plists.isparam('x'), atest = false; end + if ~io(pn).plists.isparam('type'), atest = false; end + % Check default value + if ~eq(io(pn).plists.find('model'), smodel(), ple1), atest = false; end + if ~isequal(io(pn).plists.find('xunits'), 's'), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('x')), atest = false; end + if ~isequal(io(pn).plists.find('type'), 'tsdata'), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {'s'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('x'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('type'), {'tsdata', 'fsdata', 'xydata', 'cdata'}), atest = false; end + + %%%%%%%%%% SET 'From pest' + pn = 22; + [atest, msg] = checkParamNumber(io, pn, 5); + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('pest'), atest = false; end + if ~io(pn).plists.isparam('parameter'), atest = false; end + % Check default value + if ~eq(io(pn).plists.find('pest'), []), atest = false; end + if ~isequal(io(pn).plists.find('parameter'), ''), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('pest'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('parameter'), {''}), atest = false; end + %%%%%%%%%% SET 'From Parameter' + pn = 23; + [atest, msg] = checkParamNumber(io, pn, 5); + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('parameter'), atest = false; end + if ~io(pn).plists.isparam('key'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('parameter')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('key')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('parameter'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('key'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename, msg); + end % END UTP_01 + + % check parameter number + function [atest, msg] = checkParamNumber(sets, setNum, paramNum) + atest = true; + msg = ''; + if sets(setNum).plists.nparams ~= paramNum + atest = false; + msg = sprintf('Set %d plist does not have %d parameters', setNum, paramNum); + end + end + + %% UTP_08 + + % + % + % Tests that the ao method properly applies history to the + % ASCII-file constructor. + % + % + function result = utp_08 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + try + % + fs = 5; + Nsecs = 2; + t = linspace(0, Nsecs-1/fs, Nsecs*fs); + x = randn(1,Nsecs*fs) + 2*sin(2*pi*45.*t); + out = [t;x].'; + + %---- Save data as ascii file + name = 'data'; + filename1 = sprintf('%s.txt', name); + save(filename1, 'out', '-ASCII', '-DOUBLE', '-TABS'); + filename2 = sprintf('%s.dat', name); + save(filename2, 'out', '-ASCII', '-DOUBLE', '-TABS'); + + out1 = ao(filename1); + out2 = ao(filename2); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ao'. + % 2) Check that the rebuilt objects are the same as 'out1' and 'ouit2' + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'ao'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'ao'), atest = false; end + % Check that the data-object is a cdata-object + if ~isa(out1.data, 'cdata'), atest = false; end + if ~isa(out2.data, 'cdata'), atest = false; end + % Check that output contains the right values + if ~isequal(out1.data.getY, out), atest = false; end + if ~isequal(out2.data.getY, out), atest = false; end + % Check the rebuilt object + if ~eq(mout1, out1, ple1), atest = false; end + if ~eq(mout2, out2, ple1), atest = false; end + % + % delete test file + delete(filename1); + delete(filename2); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + + %% UTP_09 + + % + % + % Tests that the ao method properly applies history to the complex + % ASCII-file constructor. + % + % + function result = utp_09 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + try + % + a1 = ao(1:123, randn(123,1)+randn(123,1)*1i, plist('type', 'fsdata')); + filename1 = 'complex1.txt'; + filename2 = 'complex2.txt'; + filename3 = 'complex3.txt'; + filename4 = 'complex4.txt'; + filename5 = 'complex5.txt'; + + %---- Save: f, real, imag + export1 = [a1.x real(a1.y) imag(a1.y)]; + save(filename1, 'export1', '-ASCII', '-DOUBLE', '-TABS'); + %---- Save: f, abs, deg + export2 = [a1.x abs(a1.y) (180/pi) * (angle(a1.y))]; + save(filename2, 'export2', '-ASCII', '-DOUBLE', '-TABS'); + %---- Save: f, abs, rad + export3 = [a1.x abs(a1.y) angle(a1.y)]; + save(filename3, 'export3', '-ASCII', '-DOUBLE', '-TABS'); + %---- Save: f, dB, deg + export4 = [a1.x 20.*log10(abs(a1.y)) (180/pi) * (angle(a1.y))]; + save(filename4, 'export4', '-ASCII', '-DOUBLE', '-TABS'); + %---- Save: f, dB, rad + export5 = [a1.x angle(a1.y) 20.*log10(abs(a1.y)) angle(a1.y) 20.*log10(abs(a1.y)) angle(a1.y) 20.*log10(abs(a1.y))]; + save(filename5, 'export5', '-ASCII', '-DOUBLE', '-TABS'); + + out1 = ao(filename1, plist('complex_type', 'real/imag')); + out2 = ao(filename2, plist('complex_type', 'abs/deg')); + out3 = ao(filename3, plist('complex_type', 'abs/rad')); + out4 = ao(filename4, plist('complex_type', 'dB/deg')); + out5 = ao(filename5, plist('complex_type', 'dB/rad', 'columns', [1 7 4])); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + mout5 = rebuild(out5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ao'. + % 2) Check that the read data are correct + % 3) Check that the rebuilt object is the same as in 'out1..5' + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'ao'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'ao'), atest = false; end + if ~strcmp(out3.hist.methodInfo.mname, 'ao'), atest = false; end + if ~strcmp(out4.hist.methodInfo.mname, 'ao'), atest = false; end + if ~strcmp(out5.hist.methodInfo.mname, 'ao'), atest = false; end + % Check that output contains the correct values + % 'out1' -> f, real, imag + if ~isequal(out1.x, a1.x), atest = false; end + if any(abs(out1.y - a1.y) > TOL), atest = false; end + % 'out2' -> f, abs, deg + if ~isequal(out2.x, a1.x), atest = false; end + if any(abs(out2.y - a1.y) > TOL), atest = false; end + % 'out3' -> f, abs, rad + if ~isequal(out3.x, a1.x), atest = false; end + if any(abs(out3.y - a1.y) > TOL), atest = false; end + % 'out4' -> f, dB, deg + if ~isequal(out4.x, a1.x), atest = false; end + if any(abs(out4.y - a1.y) > TOL), atest = false; end + % 'out5' -> f, dB, rad + if ~isequal(out5.x, a1.x), atest = false; end + if any(abs(out5.y - a1.y) > TOL), atest = false; end + % Check the re-built objects + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + if ~eq(mout4, out4, ple2), atest = false; end + if ~eq(mout5, out5, ple2), atest = false; end + % + % delete test file + delete(filename1); + delete(filename2); + delete(filename3); + delete(filename4); + delete(filename5); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_13 + + % + % + % Tests that the ao method properly applies history to the vals constructor. + % + % + function result = utp_13 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + try + % + vals = [1 2 3 4 5; 1 2 3 4 5]; + out = ao(vals); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ao'. + % 2) Check that the rebuilt object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'ao'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + %% UTP_15 + + % + % + % Tests that the ao method properly applies history to the plist(fcn) constructor. + % + % + function result = utp_15 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + try + % + fcn = 'complex(randn(100,1), randn(100,1))'; + out = ao(plist('fcn', fcn)); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ao'. + % 2) Check that the rebuilt object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'ao'), atest = false; end + % Check values of the AO + if isreal(out.data.getY), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_15 + + + %% UTP_16 + + % + % + % Tests that the ao method properly applies history to the plist(vals) constructor. + % + % + function result = utp_16 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + try + % + vals = [1 2 3 4 5; 6 7 8 9 0]; + out = ao(plist('vals', vals)); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ao'. + % 2) Check that the rebuilt object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'ao'), atest = false; end + % Check values of the AO + if ~eq(out.data.getY, vals), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_16 + + + %% UTP_17 + + % + % + % Tests that the ao method properly applies history to the plist(x/y-vals) constructor. + % + % + function result = utp_17 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + try + % + xvals = 0:99; + yvals = randn(100,1); + out = ao(plist('xvals', xvals, 'yvals', yvals)); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ao'. + % 2) Check that the rebuilt object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'ao'), atest = false; end + % Check values of the AO + if ~eq(out.data.getX, xvals'), atest = false; end + if ~eq(out.data.getY, yvals), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_17 + + + %% UTP_18 + + % + % + % Tests that the ao method properly applies history to the plist(tsfcn) constructor. + % + % + function result = utp_18 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + try + % + tsfcn = 'sin(2*pi*7.433*t) + randn(size(t))'; + out = ao(plist('tsfcn', tsfcn, 'nsecs', 10, 'fs', 12.3)); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ao'. + % 2) Check that the rebuilt object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'ao'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_18 + + + %% UTP_19 + + % + % + % Tests that the ao method properly applies history to the plist(fsfcn) constructor. + % + % + function result = utp_19 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + try + % + fsfcn1 = '1e-15.*(1e-3./f.^2 + 1e-10./f.^4)'; + fsfcn2 = '1./f.^2'; + out1 = ao(plist('fsfcn', fsfcn1, 'nf', 100)); + out2 = ao(plist('fsfcn', fsfcn2, 'nf', 100, 'scale', 'lin')); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ao'. + % 2) Check that the rebuilt objects are the same as 'out1' and 'out2' + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'ao'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'ao'), atest = false; end + % Check the rebuilt object + if ~eq(mout1, out1, ple1), atest = false; end + if ~eq(mout2, out2, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_19 + + + %% UTP_20 + + % + % + % Tests that the ao method properly applies history to the plist(win) constructor. + % + % + function result = utp_20 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + msg = ''; + try + % + win = specwin('Hamming', 10); + out1 = ao(plist('win', win)); + mout1 = rebuild(out1); + out2 = ao(plist('win', 'Kaiser', 'length', 53, 'psll', 75)); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + msg = err.message; + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to 'ao'. + % 2) Check that the rebuilt object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'ao'), atest = false; msg = 'last history step is not an ao constructor'; end + if ~strcmp(out2.hist.methodInfo.mname, 'ao'), atest = false; msg = 'last history step is not an ao constructor'; end + % Check data values + if ~isequal(win.win.', out1.data.getY), atest = false; msg = 'Window values are different when rebuilt'; end + % Check the rebuilt object + if ~eq(mout1, out1, ple1), atest = false; msg = '1st rebuilt object is different'; end + if ~eq(mout2, out2, ple1), atest = false; msg = '2nd rebuilt object is different'; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename, msg); + end % END UTP_20 + + + %% UTP_21 + + % + % + % Tests that the ao method properly applies history to the plist(waveform) constructor. + % + % + function result = utp_21 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + try + % + nsecs = 10; + fs = 10; + % Sine wave + pl_sin = plist('nsecs', nsecs, 'fs', fs, 'waveform', 'sine wave' , 'phi', 30, 'f', 1.23); + % Noise normal + pl_noise_norm = plist('nsecs', nsecs, 'fs', fs, 'waveform', 'noise' , 'type', 'Normal'); + % Noise uniform + pl_noise_uni = plist('nsecs', nsecs, 'fs', fs, 'waveform', 'noise' , 'type', 'Uniform'); + % Chirp + pl_chirp = plist('nsecs', nsecs, 'fs', fs, 'waveform', 'chirp' , 'f0', 1, 'f1', 50, 't1', 100); + % Gaussian pulse + pl_gauss = plist('nsecs', nsecs, 'fs', fs, 'waveform', 'Gaussian pulse' , 'f0', 10, 'bw', 100); + % Square wave + pl_square = plist('nsecs', nsecs, 'fs', fs, 'waveform', 'Square wave' , 'f', 1, 'duty', 50); + % Sawtooth + pl_saw = plist('nsecs', nsecs, 'fs', fs, 'waveform', 'Sawtooth' , 'width', 0.5, 'f', 1); + out_sin = ao(pl_sin); + out_nn = ao(pl_noise_norm); + out_nu = ao(pl_noise_uni); + out_chirp = ao(pl_chirp); + out_gauss = ao(pl_gauss); + out_square = ao(pl_square); + out_saw = ao(pl_saw); + + mout_sin = rebuild(out_sin); + mout_nn = rebuild(out_nn); + mout_nu = rebuild(out_nu); + mout_chirp = rebuild(out_chirp); + mout_gauss = rebuild(out_gauss); + mout_square = rebuild(out_square); + mout_saw = rebuild(out_saw); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ao'. + % 2) Check that the rebuilt objects are the same as 'out_...'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out_sin.hist.methodInfo.mname, 'ao'), atest = false; end + if ~strcmp(out_nn.hist.methodInfo.mname, 'ao'), atest = false; end + if ~strcmp(out_nu.hist.methodInfo.mname, 'ao'), atest = false; end + if ~strcmp(out_chirp.hist.methodInfo.mname, 'ao'), atest = false; end + if ~strcmp(out_gauss.hist.methodInfo.mname, 'ao'), atest = false; end + if ~strcmp(out_square.hist.methodInfo.mname, 'ao'), atest = false; end + if ~strcmp(out_saw.hist.methodInfo.mname, 'ao'), atest = false; end + % Check the rebuilt object + if ~eq(mout_sin, out_sin, ple1), atest = false; end + if ~eq(mout_nn, out_nn, ple1), atest = false; end + if ~eq(mout_nu, out_nu, ple1), atest = false; end + if ~eq(mout_chirp, out_chirp, ple1), atest = false; end + if ~eq(mout_gauss, out_gauss, ple1), atest = false; end + if ~eq(mout_square, out_square, ple1), atest = false; end + if ~eq(mout_saw, out_saw, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_21 + + + + %% UTP_23 + + % + % + % Tests that the ao method properly applies history to the plist(polynomial) constructor. + % + % + function result = utp_23 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + try + % + fs = 10; + Nsecs = 20; + coeffs = ao([2 0 1]); + out1 = ao(plist('polyval', coeffs, 'fs', fs, 'Nsecs', Nsecs)); + out2 = ao(plist('polyval', coeffs.y, 'fs', fs, 'Nsecs', Nsecs)); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ao'. + % 2) Check that the rebuilt object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'ao'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'ao'), atest = false; end + % Check data values + t = [0 : 1/fs : Nsecs-1/fs].'; + y = polyval(coeffs.y,t); + if ~isequal(out1.data.getY, y), atest = false; end + if ~isequal(out2.data.getY, y), atest = false; end + if ~isequal(out1.data.getX, t), atest = false; end + if ~isequal(out2.data.getX, t), atest = false; end + % Check the rebuilt object + if ~eq(mout1, out1, ple1), atest = false; end + if ~eq(mout2, out2, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_23 + + + %% UTP_25 + + % + % + % Tests that the ao method properly applies history to the plist(specwin) constructor. + % Tests that the ao method properly uses the specwin values. + % + % + function result = utp_25 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + stest = true; + atest = true; + msg = ''; + + % Test Kaiser window + try + % + win = specwin('kaiser', randi(1000, 1), 10); + out = ao(win); + mout = rebuild(out); + % + catch err + disp(err.message) + msg = err.message; + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ao'. + % 2) Check that the object contains the same data as the window. + % 3) Check that the rebuilt object is the same as 'out'. + % + % + + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'ao'), msg = 'last history step is not the ao constructor'; atest = false; end + % Check data values + if ~isequal(win.win', out.data.getY), msg = 'window values are different in the resulting ao'; atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), msg = ['the rebuilt object is not the same as the original: ' lastwarn]; atest = false; end + % + else + atest = false; + end + + win_list = specwin.getTypes; + + % Test standard windows + for kk = 1:numel(win_list)-2 + try + % + win = specwin(win_list{kk}, randi(1000, 1)); + out = ao(win); + mout = rebuild(out); + % + + catch err + disp(err.message) + msg = err.message; + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ao'. + % 2) Check that the object contains the same data as the window. + % 3) Check that the rebuilt object is the same as 'out'. + % + % + + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'ao'), msg = 'last history step is not the ao constructor'; atest = false; end + % Check data values + if ~isequal(win.win', out.data.getY), msg = 'window values are different in the resulting ao'; atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), msg = ['the rebuilt object is not the same as the original: ' lastwarn]; atest = false; end + % + else + atest = false; + end + + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename, msg); + end % END UTP_25 + + + %% UTP_26 + + % + % + % Tests that the ao method properly applies history to the data-object constructor. + % + % + function result = utp_26 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + try + % + y = randn(100,1); + m = randn(3,2); + + out1 = ao(cdata(m)); + out2 = ao(fsdata(y)); + out3 = ao(tsdata(y)); + out4 = ao(xydata(y)); + out5 = ao(xyzdata); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ao'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'ao'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'ao'), atest = false; end + if ~strcmp(out3.hist.methodInfo.mname, 'ao'), atest = false; end + if ~strcmp(out4.hist.methodInfo.mname, 'ao'), atest = false; end + if ~strcmp(out5.hist.methodInfo.mname, 'ao'), atest = false; end + % Check data values + if ~isa(out1.data, 'cdata'), atest = false; end + if ~isa(out2.data, 'fsdata'), atest = false; end + if ~isa(out3.data, 'tsdata'), atest = false; end + if ~isa(out4.data, 'xydata'), atest = false; end + if ~isa(out5.data, 'xyzdata'), atest = false; end + if ~eq(out1.data.getY, m), atest = false; end + if ~eq(out2.data.getY, y), atest = false; end + if ~eq(out3.data.getY, y), atest = false; end + if ~eq(out4.data.getY, y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_26 + + %% UTP_28 + + % + % + % Tests that the ao method properly applies history to the x-vector, y-vector constructor. + % + % + function result = utp_28 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + try + % + x = 0:99; + y = randn(100,1); + + out = ao(x, y); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ao'. + % 2) Check that the rebuilt object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'ao'), atest = false; end + % Check data values + if ~eq(out.data.getX, x'), atest = false; end + if ~eq(out.data.getY, y), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_28 + + + %% UTP_29 + + % + % + % Tests that the ao method properly applies history to the filename + + % plist constructor. + % + % + function result = utp_29 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + try + % + %---- Make test file + fs = 10; + Nsecs = 10; + t = linspace(0, Nsecs-1/fs, Nsecs*fs); + x1 = randn(1,Nsecs*fs) + 2*sin(2*pi*45.*t); + x2 = randn(1,Nsecs*fs) + 2*sin(2*pi*45.*t); + + %---- Save data as ascii file + filename = 'data.txt'; + fd = fopen(filename, 'w+'); + % write header + fprintf(fd, '// A comment that should be read appropriately.\n'); + fprintf(fd, '// \n'); + fprintf(fd, '// M Hewitson\n'); + % write data + for j=1:length(t) + fprintf(fd, '%.17g\t%.17g\t%.17g\n', t(j), x1(j), x2(j)); + end + % close file + fclose(fd); + + desc = 'ao from filename'; + xunits = 's'; + yunits = 'V'; + + pl = plist(... + 'description', desc,... + 'type', 'tsdata', ... + 'xunits', xunits, ... + 'yunits', yunits, ... + 'columns', [1 2 1 3], ... + 'comment_char', '//'); + + out = ao(filename, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ao'. + % 2) Check that the rebuilt object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out(1).hist.methodInfo.mname, 'ao'), atest = false; end + if ~strcmp(out(2).hist.methodInfo.mname, 'ao'), atest = false; end + % Check data values + if ~isa(out(1).data, 'tsdata'), atest = false; end + if ~isa(out(2).data, 'tsdata'), atest = false; end + if any(abs(out(1).data.getX - t.') > TOL), atest = false; end + if ~isequal(out(1).data.getY, x1.'), atest = false; end + if any(abs(out(2).data.getX - t.') > TOL), atest = false; end + if ~isequal(out(2).data.getY, x2.'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), atest = false; end + % + delete(filename); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_29 + + + %% UTP_30 + + % + % + % Tests that the ao method properly applies history to the filename + + % plist constructor. + % + % + function result = utp_30 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + try + % + %---- Make test file + fs = 10; + Nsecs = 10; + t = linspace(0, Nsecs-1/fs, Nsecs*fs); + x1 = .1*randn(1,Nsecs*fs) + 2*sin(2*pi*45.*t) + randn(1,Nsecs*fs)*1i; + x2 = .1*randn(1,Nsecs*fs) + 2*sin(2*pi*45.*t) + randn(1,Nsecs*fs)*1i; + + %---- Save data as ascii file + filename = 'complex.txt'; + fd = fopen(filename, 'w+'); + % write header + fprintf(fd, '// A comment that should be read appropriately.\n'); + fprintf(fd, '// \n'); + fprintf(fd, '// M Hewitson\n'); + % write data + for j=1:length(t) + + %---- Save: f, abs, rad, abs, rad + fprintf(fd, '%.17g\t%.17g\t%.17g\t%.17g\t%.17g\n', t(j), abs(x1(j)), angle(x1(j)), abs(x2(j)), angle(x2(j))); + end + % close file + fclose(fd); + + desc = 'ao from complex data'; + xunits = 'Hz'; + yunits = 'V'; + + pl = plist(... + 'complex_type', 'abs/rad', ... + 'columns', [1 2 3 1 4 5], ... + 'type', 'xydata', ... + 'description', desc,... + 'xunits', xunits, ... + 'yunits', yunits, ... + 'comment_char', '//'); + + out = ao(filename, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ao'. + % 2) Check the read data + % 3) Check that the rebuilt object is the same as 'out' + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out(1).hist.methodInfo.mname, 'ao'), atest = false; end + if ~strcmp(out(2).hist.methodInfo.mname, 'ao'), atest = false; end + % Check data values + if ~isa(out(1).data, 'xydata'), atest = false; end + if ~isa(out(2).data, 'xydata'), atest = false; end + % 'out(1)' -> f, abs, rad + if ~isequal(out(1).x, t.'), atest = false; end + if any(abs(out(1).y - x1.') > TOL), atest = false; end + if ~eq(out(1).yunits, unit(yunits)), atest = false; end + if ~eq(out(1).xunits, unit(xunits)), atest = false; end + if ~strcmp(out(1).description, desc), atest = false; end + % 'out(2)' -> f, abs, rad + if ~isequal(out(2).x, t.'), atest = false; end + if any(abs(out(2).y - x2.') > TOL), atest = false; end + if ~eq(out(2).yunits, unit(yunits)), atest = false; end + if ~eq(out(2).xunits, unit(xunits)), atest = false; end + if ~strcmp(out(2).description, desc), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple1), atest = false; end + % + % delete test file + delete(filename); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_30 + + + %% UTP_31 + + % + % + % Tests that the ao method properly applies history to the filename + plist constructor. + % + % + function result = utp_31 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + try + % + fs = 10; + Nsecs = 10; + t0 = time('2008-02-15 14:00:00'); + col = [2 3]; + x1 = randn(1,Nsecs*fs); + x2 = randn(1,Nsecs*fs); + x3 = randn(1,Nsecs*fs); + + %---- Save data as ascii file + filename = 'data.txt'; + fd = fopen(filename, 'w+'); + % write header + fprintf(fd, '%% A comment that should be read appropriately.\n'); + fprintf(fd, '%% \n'); + fprintf(fd, '%% M Hewitson\n'); + % write data + for j=1:length(x1) + fprintf(fd, '%.17g\t%.17g\t%.17g\n', x1(j), x2(j), x3(j)); + end + % close file + fclose(fd); + + % Build plist + desc = 'ao from filename'; + xunits = 's'; + yunits = {'V', 'V^2'}; + + pl = plist(... + 'description', desc,... + 'type', 'tsdata', ... + 'xunits', xunits, ... + 'yunits', yunits, ... + 'columns', col, ... + 'fs', fs, ... + 't0', {t0, t0+20}, ... + 'comment_char', '%'); + + out = ao(filename, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ao'. + % 2) Check that the rebuilt object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out(1).hist.methodInfo.mname, 'ao'), atest = false; end + if ~strcmp(out(2).hist.methodInfo.mname, 'ao'), atest = false; end + % Check data values + if ~isa(out(1).data, 'tsdata'), atest = false; end + if ~isa(out(2).data, 'tsdata'), atest = false; end + if ~isequal(out(1).data.getY, x2.'), atest = false; end + if ~isequal(out(2).data.getY, x3.'), atest = false; end + if ~eq(unit(xunits), out(1).data.xunits), atest = false; end + if ~eq(unit(yunits{1}), out(1).data.yunits), atest = false; end + if ~eq(unit(xunits), out(2).data.xunits), atest = false; end + if ~eq(unit(yunits{2}), out(2).data.yunits), atest = false; end + if ~eq(out(1).data.t0, t0, ple1), atest = false; end + if ~eq(out(2).data.t0, t0 + 20, ple1), atest = false; end + if ~out(1).data.fs == fs, atest = false; end + if ~out(2).data.fs == fs, atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), atest = false; end + % + % delete test file + delete(filename) + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_31 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_asin.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_asin.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,128 @@ +% UTP_AO_ASIN a set of UTPs for the ao/asin method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_asin.m,v 1.13 2011/04/17 09:50:21 hewitson Exp $ +% + +% +% +% The asin method of the ao class computes the inverse sine of the y +% and/or x data. +% +% + +function results = utp_ao_asin(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'asin'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple2)]; % Test the modify call works + results = [results utp_08(mthd, at1, ple2)]; % Test with additional plist with the key 'axis' + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at1, at2, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(asin(in.data.getY), out.data.getY) + atest = false; + end + end + + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_atan.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_atan.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,128 @@ +% UTP_AO_ATAN a set of UTPs for the ao/atan method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_atan.m,v 1.13 2011/04/17 09:50:21 hewitson Exp $ +% + +% +% +% The atan method of the ao class computes the inverse tangent of the y +% and/or x data. +% +% + +function results = utp_ao_atan(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'atan'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple2)]; % Test the modify call works + results = [results utp_08(mthd, at1, ple2)]; % Test with additional plist with the key 'axis' + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at1, at2, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(atan(in.data.getY), out.data.getY) + atest = false; + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_atan2.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_atan2.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,268 @@ +% UTP_AO_ATAN2 a set of UTPs for the ao/atan2 method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_atan2.m,v 1.3 2009/07/20 15:14:11 ingo Exp $ +% + +% +% +% The atan2 method of the ao class computes the the four quadrant +% arctangent of the real parts of the elements of X and Y. +% +% + +function results = utp_ao_atan2(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'atan2'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + at1 = ao(1:30, randn(30,1), 1); + at2 = ao(1:30, randn(30,1), 1); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Test history is working + results = [results utp_04]; % Test the modify call works + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the atan2 method works only with two AOs as input.. + % + % + function result = utp_02 + + % + % + % Tests that the atan2 method works only with two AOs as input.. + % + % + + try + % + out = atan2(at1, at2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Check the output data + if ~isequal(out.y, atan2(at1.y, at2.y)), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the atan2 method properly applies history. + % + % + function result = utp_03 + + % + % + % Test that the result of applying the atan2 method can be processed + % back. + % + % + + try + % + out = atan2(at1,at2); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'atan2'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'atan2'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the atan2 method can not be used as a modifier method. + % + % + function result = utp_04 + + % + % + % Tests that the atan2 method can not be used as a modifier method. The + % command should fail. + % + % + + try + % + % copy at1 to work with + amodi = ao(at1); + aeq = ao(at1); + out = aeq.atan2(at2); + amodi.atan2(at2); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_average.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_average.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,927 @@ +% UTP_AO_AVERAGE a set of UTPs for the ao/average method +% +% M Hueller 24-02-1 +% +% $Id: utp_ao_average.m,v 1.2 2011/04/17 15:46:21 ingo Exp $ +% + +% +% +% The average method of the ao class averages aos point-by-point +% +% + +function results = utp_ao_average(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'average'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Set the same y-units for the test AOs + at1.setYunits('uHz'); + at2.setYunits('uHz'); + at3.setYunits('uHz'); + at4.setYunits('uHz'); + at5.setYunits('uHz'); + at6.setYunits('uHz'); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06(mthd, at1, at5, ple2)]; % Test history is working + results = [results utp_07]; % Test the modify call does not work + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_18]; % Test with single input + + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the average method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Tests that the average method works with a vector of AOs as input. + % + % + + try + % + % Pick units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + u = unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))]); + + % tsdata: settings + fs = 3; + ts_pl = plist('fs', fs, 'nsecs', 30, 'waveform', 'sine wave', 'f', 10, 'yunits', u); + ts_a1 = ao(ts_pl); + ts_a2 = ao(ts_pl); + ts_a3 = ao(ts_pl); + ts_a1.setT0('14:00:00'); + ts_a2.setT0('14:00:05'); + ts_a3.setT0('14:00:10'); + + % tsdata: call the method with a vector of inputs + ts_out = average([ts_a1, ts_a2, ts_a3]); + + % fsdata: settings + fs_pl = plist('fsfcn', '1./f.^2', 'scale', 'lin', 'nf', 100, 'yunits', u); + fs_a1 = ao(fs_pl); + fs_a2 = 2*ao(fs_pl); + + % tsdata: call the method with a vector of inputs + fs_out = average([fs_a1, fs_a2]); + + % xydata: settings + xy_pl = plist('X', [1:50,52:2:100,110:10:1000], 'xyfcn', 'log(x)', 'yunits', u); + xy_a1 = ao(xy_pl); + xy_a2 = ao(xy_pl.pset('xyfcn', 'log10(x)')); + xy_a3 = ao(xy_pl.pset('xyfcn', 'exp(-x)')); + + % xydata: call the method with a vector of inputs + xy_out = average([xy_a1, xy_a2, xy_a3]); + + % cdata: settings + c_pl = plist('yunits', u); + c_a1 = ao([1 2 3], c_pl); + c_a2 = ao([4 3 2], c_pl); + c_a3 = ao([7 4 9], c_pl); + c_a4 = ao([-4 -1 2], c_pl); + + % cdata: call the method with a vector of inputs + c_out = average([c_a1, c_a2, c_a3, c_a4]); + + % Rebuild the objects + ts_mout = rebuild(ts_out); + fs_mout = rebuild(fs_out); + xy_mout = rebuild(xy_out); + c_mout = rebuild(c_out); + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the outputs have exactly one AO + % 2) Check that the outputs have the correct data. + % 3) Check the rebuilt objects + % + % + + atest = true; + + if stest + % + % Check that the output is exactly one AO + if numel(ts_out) ~= 1, atest = false; end + if numel(fs_out) ~= 1, atest = false; end + if numel(xy_out) ~= 1, atest = false; end + if numel(c_out) ~= 1, atest = false; end + if ~isa(ts_out, 'ao'), atest = false; end + if ~isa(fs_out, 'ao'), atest = false; end + if ~isa(xy_out, 'ao'), atest = false; end + if ~isa(c_out, 'ao'), atest = false; end + + % Check output data: x + if ~isequal(ts_out.x, ts_a1.x), atest = false; end + if ~isequal(fs_out.x, fs_a1.x), atest = false; end + if ~isequal(xy_out.x, xy_a1.x), atest = false; end + + % Check output data: t0 + if ~isequal(ts_out.t0, ts_a1.t0), atest = false; end + + % Check output data: y + ts_data_in = [ts_a1.y ts_a2.y ts_a3.y]; + if ~isequal(ts_out.y, mean(ts_data_in, 2)), atest = false; end + fs_data_in = [fs_a1.y fs_a2.y]; + if ~isequal(fs_out.y, mean(fs_data_in, 2)), atest = false; end + xy_data_in = [xy_a1.y xy_a2.y xy_a3.y]; + if ~isequal(xy_out.y, mean(xy_data_in, 2)), atest = false; end + c_data_in = [c_a1.y c_a2.y c_a3.y c_a4.y]; + if ~isequal(c_out.y, mean(c_data_in, 2)), atest = false; end + + % Check output data: dy + if ~isequal(ts_out.dy, std(ts_data_in, 0, 2)/sqrt(3)), atest = false; end + if ~isequal(fs_out.dy, std(fs_data_in, 0, 2)/sqrt(2)), atest = false; end + if ~isequal(xy_out.dy, std(xy_data_in, 0, 2)/sqrt(3)), atest = false; end + if ~isequal(c_out.dy, std(c_data_in, 0, 2)/sqrt(4)), atest = false; end + + % Check output data: xunits + if ~isequal(ts_out.xunits, ts_a1.xunits), atest = false; end + if ~isequal(fs_out.xunits, fs_a1.xunits), atest = false; end + if ~isequal(xy_out.xunits, xy_a1.xunits), atest = false; end + + % Check output data: yunits + if ~isequal(ts_out.yunits, ts_a1.yunits), atest = false; end + if ~isequal(fs_out.yunits, fs_a1.yunits), atest = false; end + if ~isequal(xy_out.yunits, xy_a1.yunits), atest = false; end + if ~isequal(c_out.yunits, c_a1.yunits), atest = false; end + + % Check the re-built objects + if ~eq(ts_out, ts_mout, ple2), atest = false; end + if ~eq(fs_out, fs_mout, ple2), atest = false; end + if ~eq(xy_out, xy_mout, ple2), atest = false; end + if ~eq(c_out, c_mout, ple2), atest = false; end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the average method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Tests that the average method works with a matrix of AOs as input. + % + % + + try + % + % Pick units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + u = unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))]); + + % tsdata: settings + fs = 3; + ts_pl = plist('fs', fs, 'nsecs', 30, 'waveform', 'sine wave', 'f', 10, 'yunits', u); + ts_a1 = ao(ts_pl); + ts_a2 = ao(ts_pl); + ts_a3 = ao(ts_pl); + ts_a1.setT0('14:00:00'); + ts_a2.setT0('14:00:05'); + ts_a3.setT0('14:00:10'); + + % tsdata: call the method with a list of inputs + ts_out = average([ts_a1, ts_a2, ts_a3; ts_a1, ts_a2, ts_a3]); + + % tsdata: settings + fs_pl = plist('fsfcn', '1./f.^2', 'scale', 'lin', 'nf', 100, 'yunits', u); + fs_a1 = ao(fs_pl); + fs_a2 = 2*ao(fs_pl); + + % fsdata: call the method with a list of inputs + fs_out = average([fs_a1, fs_a2; fs_a1, fs_a2]); + + % xydata: settings + xy_pl = plist('X', [1:50,52:2:100,110:10:1000], 'xyfcn', 'log(x)', 'yunits', u); + xy_a1 = ao(xy_pl); + xy_a2 = ao(xy_pl.pset('xyfcn', 'log10(x)')); + xy_a3 = ao(xy_pl.pset('xyfcn', 'exp(-x)')); + + % xydata: call the method with a list of inputs + xy_out = average([xy_a1, xy_a2, xy_a3; xy_a1, xy_a2, xy_a3]); + + % cdata: settings + c_pl = plist('yunits', u); + c_a1 = ao([1 2 3], c_pl); + c_a2 = ao([4 3 2], c_pl); + c_a3 = ao([7 4 9], c_pl); + c_a4 = ao([-4 -1 2], c_pl); + + % cdata: call the method with a list of inputs + c_out = average([c_a1, c_a2, c_a3, c_a4; c_a1, c_a2, c_a3, c_a4]); + + % Rebuild the objects + ts_mout = rebuild(ts_out); + fs_mout = rebuild(fs_out); + xy_mout = rebuild(xy_out); + c_mout = rebuild(c_out); + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the outputs have exactly one AO + % 2) Check that the outputs have the correct data. + % 3) Check the rebuilt objects + % + % + + TOL = 1e-15; + atest = true; + + if stest + % + % Check that the output is exactly one AO + if numel(ts_out) ~= 1, atest = false; end + if numel(fs_out) ~= 1, atest = false; end + if numel(xy_out) ~= 1, atest = false; end + if numel(c_out) ~= 1, atest = false; end + if ~isa(ts_out, 'ao'), atest = false; end + if ~isa(fs_out, 'ao'), atest = false; end + if ~isa(xy_out, 'ao'), atest = false; end + if ~isa(c_out, 'ao'), atest = false; end + + % Check output data: x + if ~isequal(ts_out.x, ts_a1.x), atest = false; end + if ~isequal(fs_out.x, fs_a1.x), atest = false; end + if ~isequal(xy_out.x, xy_a1.x), atest = false; end + + % Check output data: t0 + if ~isequal(ts_out.t0, ts_a1.t0), atest = false; end + + % Check output data: y + ts_data_in = [ts_a1.y ts_a2.y ts_a3.y ts_a1.y ts_a2.y ts_a3.y]; + if ~isequal(ts_out.y, mean(ts_data_in, 2)), atest = false; end + fs_data_in = [fs_a1.y fs_a2.y fs_a1.y fs_a2.y]; + if ~isequal(fs_out.y, mean(fs_data_in, 2)), atest = false; end + xy_data_in = [xy_a1.y xy_a2.y xy_a3.y xy_a1.y xy_a2.y xy_a3.y]; + if any(abs(xy_out.y - mean(xy_data_in, 2)) > TOL), atest = false; end + c_data_in = [c_a1.y c_a2.y c_a3.y c_a4.y c_a1.y c_a2.y c_a3.y c_a4.y]; + if ~isequal(c_out.y, mean(c_data_in, 2)), atest = false; end + + % Check output data: dy + if ~isequal(ts_out.dy, std(ts_data_in, 0, 2)/sqrt(6)), atest = false; end + if any(abs(fs_out.dy - std(fs_data_in, 0, 2)/sqrt(4)) > TOL), atest = false; end + if any(abs(xy_out.dy - std(xy_data_in, 0, 2)/sqrt(6)) > TOL), atest = false; end + if ~isequal(c_out.dy, std(c_data_in, 0, 2)/sqrt(8)), atest = false; end + + % Check output data: xunits + if ~isequal(ts_out.xunits, ts_a1.xunits), atest = false; end + if ~isequal(fs_out.xunits, fs_a1.xunits), atest = false; end + if ~isequal(xy_out.xunits, xy_a1.xunits), atest = false; end + + % Check output data: yunits + if ~isequal(ts_out.yunits, ts_a1.yunits), atest = false; end + if ~isequal(fs_out.yunits, fs_a1.yunits), atest = false; end + if ~isequal(xy_out.yunits, xy_a1.yunits), atest = false; end + if ~isequal(c_out.yunits, c_a1.yunits), atest = false; end + + % Check the re-built objects + if ~eq(ts_out, ts_mout, ple2), atest = false; end + if ~eq(fs_out, fs_mout, ple2), atest = false; end + if ~eq(xy_out, xy_mout, ple2), atest = false; end + if ~eq(c_out, c_mout, ple2), atest = false; end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the average method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Tests that the average method works with a list of AOs as input. + % + % + + try + % + % Pick units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + u = unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))]); + + % tsdata: settings + fs = 3; + ts_pl = plist('fs', fs, 'nsecs', 30, 'waveform', 'sine wave', 'f', 10, 'yunits', u); + ts_a1 = ao(ts_pl); + ts_a2 = ao(ts_pl); + ts_a3 = ao(ts_pl); + ts_a1.setT0('14:00:00'); + ts_a2.setT0('14:00:05'); + ts_a3.setT0('14:00:10'); + + % tsdata: call the method with a list of inputs + ts_out = average(ts_a1, ts_a2, ts_a3); + + % fsdata: settings + fs_pl = plist('fsfcn', '1./f.^2', 'scale', 'lin', 'nf', 100, 'yunits', u); + fs_a1 = ao(fs_pl); + fs_a2 = 2*ao(fs_pl); + + % fsdata: call the method with a list of inputs + fs_out = average(fs_a1, fs_a2); + + % xydata: settings + xy_pl = plist('X', [1:50,52:2:100,110:10:1000], 'xyfcn', 'log(x)', 'yunits', u); + xy_a1 = ao(xy_pl); + xy_a2 = ao(xy_pl.pset('xyfcn', 'log10(x)')); + xy_a3 = ao(xy_pl.pset('xyfcn', 'exp(-x)')); + + % xydata: call the method with a list of inputs + xy_out = average(xy_a1, xy_a2, xy_a3); + + % cdata: settings + c_pl = plist('yunits', u); + c_a1 = ao([1 2 3], c_pl); + c_a2 = ao([4 3 2], c_pl); + c_a3 = ao([7 4 9], c_pl); + c_a4 = ao([-4 -1 2], c_pl); + + % cdata: call the method with a list of inputs + c_out = average(c_a1, c_a2, c_a3, c_a4); + + % Rebuild the objects + ts_mout = rebuild(ts_out); + fs_mout = rebuild(fs_out); + xy_mout = rebuild(xy_out); + c_mout = rebuild(c_out); + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the outputs have exactly one AO + % 2) Check that the outputs have the correct data. + % 3) Check the rebuilt objects + % + % + + atest = true; + + if stest + % + % Check that the output is exactly one AO + if numel(ts_out) ~= 1, atest = false; end + if numel(fs_out) ~= 1, atest = false; end + if numel(xy_out) ~= 1, atest = false; end + if numel(c_out) ~= 1, atest = false; end + if ~isa(ts_out, 'ao'), atest = false; end + if ~isa(fs_out, 'ao'), atest = false; end + if ~isa(xy_out, 'ao'), atest = false; end + if ~isa(c_out, 'ao'), atest = false; end + + + % Check output data: x + if ~isequal(ts_out.x, ts_a1.x), atest = false; end + if ~isequal(fs_out.x, fs_a1.x), atest = false; end + if ~isequal(xy_out.x, xy_a1.x), atest = false; end + + % Check output data: t0 + if ~isequal(ts_out.t0, ts_a1.t0), atest = false; end + + % Check output data: y + ts_data_in = [ts_a1.y ts_a2.y ts_a3.y]; + if ~isequal(ts_out.y, mean(ts_data_in, 2)), atest = false; end + fs_data_in = [fs_a1.y fs_a2.y]; + if ~isequal(fs_out.y, mean(fs_data_in, 2)), atest = false; end + xy_data_in = [xy_a1.y xy_a2.y xy_a3.y]; + if ~isequal(xy_out.y, mean(xy_data_in, 2)), atest = false; end + c_data_in = [c_a1.y c_a2.y c_a3.y c_a4.y]; + if ~isequal(c_out.y, mean(c_data_in, 2)), atest = false; end + + % Check output data: dy + if ~isequal(ts_out.dy, std(ts_data_in, 0, 2)/sqrt(3)), atest = false; end + if ~isequal(fs_out.dy, std(fs_data_in, 0, 2)/sqrt(2)), atest = false; end + if ~isequal(xy_out.dy, std(xy_data_in, 0, 2)/sqrt(3)), atest = false; end + if ~isequal(c_out.dy, std(c_data_in, 0, 2)/sqrt(4)), atest = false; end + + % Check output data: xunits + if ~isequal(ts_out.xunits, ts_a1.xunits), atest = false; end + if ~isequal(fs_out.xunits, fs_a1.xunits), atest = false; end + if ~isequal(xy_out.xunits, xy_a1.xunits), atest = false; end + + % Check output data: yunits + if ~isequal(ts_out.yunits, ts_a1.yunits), atest = false; end + if ~isequal(fs_out.yunits, fs_a1.yunits), atest = false; end + if ~isequal(xy_out.yunits, xy_a1.yunits), atest = false; end + if ~isequal(c_out.yunits, c_a1.yunits), atest = false; end + + % Check the re-built objects + if ~eq(ts_out, ts_mout, ple2), atest = false; end + if ~eq(fs_out, fs_mout, ple2), atest = false; end + if ~eq(xy_out, xy_mout, ple2), atest = false; end + if ~eq(c_out, c_mout, ple2), atest = false; end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the average method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Tests that the average method works with a mix of different shaped AOs as + % input. + % + % + + try + % + fs = .3; + pl = plist('fs', fs, 'nsecs', 300, 'waveform', 'sine wave', 'f', .1); + a1 = ao(pl); + a2 = ao(pl); + a3 = ao(pl); + a4 = ao(pl); + a5 = ao(pl); + a6 = ao(pl); + a1.setT0('14:00:20'); + a2.setT0('14:01:40'); + a3.setT0('14:02:00'); + a4.setT0('14:00:00'); + a5.setT0('14:01:20'); + a6.setT0('14:00:40'); + out = average(a1, [a2, a3; a4, a5], [a6;a1]); + % Rebuild the object + mout = rebuild(out); + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one AO + % 2) Check that the output have the correct data. + % + % + + atest = true; + aoin = [a1, reshape([a2, a3; a4, a5], 1, []), a6, a1]; + if stest + % + % Check that the output is exact one AO + if numel(out) ~= 1, atest = false; end + if ~isa(out, 'ao'), atest = false; end + + % Check output data: x + if ~isequal(out.x, a1.x), atest = false; end + + % Check output data: t0 + if ~isequal(out.t0, a1.t0), atest = false; end + + % Check output data: y + data_in = [aoin(:).y]; + if ~isequal(out.y, mean(data_in, 2)), atest = false; end + + % Check output data: dy + if ~isequal(out.dy, std(data_in, 0, 2)/sqrt(7)), atest = false; end + + % Check output data: xunits + if ~isequal(out.xunits, a1.xunits), atest = false; end + + % Check output data: yunits + if ~isequal(out.yunits, a1.yunits), atest = false; end + + % Check the re-built object + if ~eq(out, mout, ple2), atest = false; end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + + %% UTP_07 + + % + % + % Tests that the average method cannot modify the input AO. + % The method must throw an error for the modifier call. + % + % + function result = utp_07 + + % + % + % Test that the average method cannot modify the input AO by calling with + % no output + % + % + + try + % + % prepare one ao to work with + fs = 3; + pl = plist('fs', fs, 'nsecs', 30, 'waveform', 'sine wave', 'f', 10); + a1 = ao(pl); + a2 = ao(pl); + + % modify a1 + a1.average(a2); + % + stest = false; + catch + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the average method keeps the data shape of the input + % object. The input AO must be an AO with row data and an AO with + % column data. + % + % + + try + % + fs = 3; + pl = plist('fs', fs, 'nsecs', 30, 'waveform', 'sine wave', 'f', 10); + a1 = ao(pl); + a2 = ao(pl); + a2 = a2.'; + a1.setT0('14:00:05'); + a2.setT0('14:00:00'); + out1 = average(a1, a2); + out2 = average(a2, a1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,1) == 1, atest = false; end + if size(out2.data.y,2) == 1, atest = false; end + + % Check the output data: y values + if out1.data.y ~= out2.data.y', atest = false; end + + % Check the output data: y uncertanties + if out1.data.dy ~= out2.data.dy', atest = false; end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_18 + + % + % + % Tests that the average method works with a single AO as input. + % + % + function result = utp_18 + + % + % + % Tests that the average method works with a single AO as input. + % + % + + try + % + % Pick units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + u = unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))]); + + % tsdata: settings + fs = 3; + ts_pl = plist('fs', fs, 'nsecs', 30, 'waveform', 'sine wave', 'f', 10, 'yunits', u); + ts_a1 = ao(ts_pl); + ts_a1.setT0('14:00:00'); + + % tsdata: call the method with a list of inputs + ts_out = average(ts_a1); + + % fsdata: settings + fs_pl = plist('fsfcn', '1./f.^2', 'scale', 'lin', 'nf', 100, 'yunits', u); + fs_a1 = ao(fs_pl); + + % fsdata: call the method with a list of inputs + fs_out = average(fs_a1); + + % xydata: settings + xy_pl = plist('X', [1:50,52:2:100,110:10:1000], 'xyfcn', 'log(x)', 'yunits', u); + xy_a1 = ao(xy_pl); + + % xydata: call the method with a list of inputs + xy_out = average(xy_a1); + + % cdata: settings + c_pl = plist('yunits', u); + c_a1 = ao([1 2 3], c_pl); + + % cdata: call the method with a list of inputs + c_out = average(c_a1); + + % Rebuild the objects + ts_mout = rebuild(ts_out); + fs_mout = rebuild(fs_out); + xy_mout = rebuild(xy_out); + c_mout = rebuild(c_out); + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the outputs have exactly one AO + % 2) Check that the outputs have the correct data. + % 3) Check the rebuilt objects + % + % + + atest = true; + + if stest + % + % Check that the output is exactly one AO + if numel(ts_out) ~= 1, atest = false; end + if numel(fs_out) ~= 1, atest = false; end + if numel(xy_out) ~= 1, atest = false; end + if numel(c_out) ~= 1, atest = false; end + if ~isa(ts_out, 'ao'), atest = false; end + if ~isa(fs_out, 'ao'), atest = false; end + if ~isa(xy_out, 'ao'), atest = false; end + if ~isa(c_out, 'ao'), atest = false; end + + + % Check output data: x + if ~isequal(ts_out.x, ts_a1.x), atest = false; end + if ~isequal(fs_out.x, fs_a1.x), atest = false; end + if ~isequal(xy_out.x, xy_a1.x), atest = false; end + + % Check output data: t0 + if ~isequal(ts_out.t0, ts_a1.t0), atest = false; end + + % Check output data: y + if ~isequal(ts_out.y, ts_a1.y), atest = false; end + if ~isequal(fs_out.y, fs_a1.y), atest = false; end + if ~isequal(xy_out.y, xy_a1.y), atest = false; end + if ~isequal(c_out.y, c_a1.y), atest = false; end + + % Check output data: dy + if ~isequal(ts_out.dy, ts_a1.dy), atest = false; end + if ~isequal(fs_out.dy, fs_a1.dy), atest = false; end + if ~isequal(xy_out.dy, xy_a1.dy), atest = false; end + if ~isequal(c_out.dy, c_a1.dy), atest = false; end + + % Check output data: xunits + if ~isequal(ts_out.xunits, ts_a1.xunits), atest = false; end + if ~isequal(fs_out.xunits, fs_a1.xunits), atest = false; end + if ~isequal(xy_out.xunits, xy_a1.xunits), atest = false; end + + % Check output data: yunits + if ~isequal(ts_out.yunits, ts_a1.yunits), atest = false; end + if ~isequal(fs_out.yunits, fs_a1.yunits), atest = false; end + if ~isequal(xy_out.yunits, xy_a1.yunits), atest = false; end + if ~isequal(c_out.yunits, c_a1.yunits), atest = false; end + + % Check the re-built objects + if ~eq(ts_out, ts_mout, ple2), atest = false; end + if ~eq(fs_out, fs_mout, ple2), atest = false; end + if ~eq(xy_out, xy_mout, ple2), atest = false; end + if ~eq(c_out, c_mout, ple2), atest = false; end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_18 +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_bin_data.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_bin_data.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,550 @@ +% UTP_AO_BIN_DATA a set of UTPs for the ao/bin_data method +% +% M Hueller 06-08-09 +% +% $Id: utp_ao_bin_data.m,v 1.9 2011/05/10 16:48:35 mauro Exp $ +% + +% +% +% The bin_data method of the ao class rebins aos data, on +% logarithmic scale, linear scale, or arbitrarly chosen +% +% + +function results = utp_ao_bin_data(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'bin_data'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Prepare once some test data + [a, S_lin,S_log] = prepare_test_data; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, plist('neval',true), ple1)]; % Test the modify call works + results = [results utp_10(mthd, at5, at6, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + results = [results utp_17]; % Test units handling & parameter support + results = [results utp_18]; % Test units handling & parameter support + results = [results utp_19]; % Test units handling & parameter support + results = [results utp_20]; % Test vector with bins support + results = [results utp_21]; % Test ao with bins support + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 7, atest = false; end + % Check key + if ~io(3).plists.isparam('method'), atest = false; end + if ~io(3).plists.isparam('xscale'), atest = false; end + if ~io(3).plists.isparam('resolution'), atest = false; end + if ~io(3).plists.isparam('xvals'), atest = false; end + if ~io(3).plists.isparam('weights'), atest = false; end + if ~io(3).plists.isparam('range'), atest = false; end + if ~io(3).plists.isparam('inherit_dy'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('method'), 'MEAN'), atest = false; end + if ~isequal(io(3).plists.find('xscale'), 'LOG'), atest = false; end + if ~isequal(io(3).plists.find('resolution'), 10), atest = false; end + if ~isequal(io(3).plists.find('xvals'), []), atest = false; end + if ~isequal(io(3).plists.find('weights'), []), atest = false; end + if ~isequal(io(3).plists.find('range'), []), atest = false; end + if ~isequal(io(3).plists.find('inherit_dy'), 'yes'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('method'), {'MEAN', 'MEDIAN', 'MAX', 'MIN', 'RMS', 'WMEAN'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('xscale'), {'LOG', 'LIN'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('resolution'), {10}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('xvals'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('weights'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('range'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('inherit_dy'), {'yes', 'no'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_17 + + % + % + % Tests handling of units: + % 1) rebinning of the PSD data + % 2) rebinning of the LPSD data + % 3) compares the units of the input and output + % + + % + function result = utp_17 + + % + % + % 1) Rebinning the data + % + % + + % + try + + % Rebin the data + % Use resolution and x + resolution = utils.math.randelement([1 2 5 10],1); + bin_scale = utils.math.randelement({'LOG','LOG'},1); + bin_scale = bin_scale{:}; + + pl_bin = plist(... + 'resolution', resolution, ... + 'x_scale', bin_scale); + + b_lin = S_lin.bin_data(pl_bin); + b_log = S_log.bin_data(pl_bin); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (rebinned PSD yunits) equals (input PSD yunits) + % 2) Check that (rebinned PSD xunits) equals (input PSD xunits) + % 3) Check that (rebinned LPSD yunits) equals (input LPSD yunits) + % 4) Check that (rebinned LPSD xunits) equals (input LPSD xunits) + % + % + + % + atest = true; + + if stest + if ne(S_lin.yunits, b_lin.yunits) || ne(S_lin.xunits, b_lin.xunits) + atest = false; + end + if ne(S_log.yunits, b_log.yunits) || ne(S_log.xunits, b_log.xunits) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_17 + + + %% UTP_18 + + % + % + % Tests handling of units: + % 1) rebinning of the PSD data + % 2) rebinning of the LPSD data + % 3) compares the units of the input and output + % + + % + function result = utp_18 + + % + % + % 1) Rebinning the data + % + % + + % + try + + % Rebin the data + % Use resolution and x + resolution = utils.math.randelement([1 2 5 10],1); + + pl_bin = plist(... + 'resolution', resolution); + + b_lin = S_lin.bin_data(pl_bin); + b_log = S_log.bin_data(pl_bin); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (rebinned PSD yunits) equals (input PSD yunits) + % 2) Check that (rebinned PSD xunits) equals (input PSD xunits) + % 3) Check that (rebinned LPSD yunits) equals (input LPSD yunits) + % 4) Check that (rebinned LPSD xunits) equals (input LPSD xunits) + % + % + + % + atest = true; + + if stest + if ne(S_lin.yunits, b_lin.yunits) || ne(S_lin.xunits, b_lin.xunits) + atest = false; + end + if ne(S_log.yunits, b_log.yunits) || ne(S_log.xunits, b_log.xunits) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_18 + + + %% UTP_19 + + % + % + % Tests handling of units: + % 1) rebinning of the PSD data + % 2) rebinning of the LPSD data + % 3) compares the units of the input and output + % + + % + function result = utp_19 + + % + % + % 1) Rebinning the data + % + % + + % + try + + % Rebin the data + % Use resolution and x + bin_scale = utils.math.randelement({'LOG','LOG'},1); + bin_scale = bin_scale{:}; + + pl_bin = plist(... + 'x_scale', bin_scale); + + b_lin = S_lin.bin_data(pl_bin); + b_log = S_log.bin_data(pl_bin); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (rebinned PSD yunits) equals (input PSD yunits) + % 2) Check that (rebinned PSD xunits) equals (input PSD xunits) + % 3) Check that (rebinned LPSD yunits) equals (input LPSD yunits) + % 4) Check that (rebinned LPSD xunits) equals (input LPSD xunits) + % + % + + % + atest = true; + + if stest + if ne(S_lin.yunits, b_lin.yunits) || ne(S_lin.xunits, b_lin.xunits) + atest = false; + end + if ne(S_log.yunits, b_log.yunits) || ne(S_log.xunits, b_log.xunits) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_19 + + %% UTP_20 + + % + % + % Tests handling of units: + % 1) rebinning of the PSD data + % 2) rebinning of the LPSD data + % + + % + function result = utp_20 + + % + % + % 1) Rebinning the data + % + % + + % + try + + % Rebin the data + % Use vector of x values + n_bins = 25; + x_vals_lin = linspace(min(S_lin.x), max(S_lin.x), n_bins); + x_vals_log = logspace(min(S_lin.x), max(S_lin.x), n_bins); + + pl_bin_lin = plist(... + 'x_vals', x_vals_lin); + pl_bin_log = plist(... + 'x_vals', x_vals_log); + + b_lin_lin = S_lin.bin_data(pl_bin_lin); + b_log_lin = S_log.bin_data(pl_bin_lin); + b_lin_log = S_lin.bin_data(pl_bin_log); + b_log_log = S_log.bin_data(pl_bin_log); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % Nothing to check + % + % + + % + atest = true; + + if stest + + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_20 + + %% UTP_21 + + % + % + % Tests handling of units: + % 1) rebinning of the PSD data + % 2) rebinning of the LPSD data + % + + % + function result = utp_21 + + % + % + % 1) Rebinning the data + % + % + + % + try + + % Rebin the data + % Use vector of x values + n_bins = 25; + x_vals_lin = ao(linspace(min(S_lin.x), max(S_lin.x), n_bins), randn(n_bins,1), ... + plist('type', 'xydata', 'xunits', S_lin.xunits)); + x_vals_log = ao(logspace(min(S_lin.x), max(S_lin.x), n_bins), randn(n_bins,1), ... + plist('type', 'xydata', 'xunits', S_lin.xunits)); + + pl_bin_lin = plist(... + 'x_vals', x_vals_lin); + pl_bin_log = plist(... + 'x_vals', x_vals_log); + + b_lin_lin = S_lin.bin_data(pl_bin_lin); + b_log_lin = S_log.bin_data(pl_bin_lin); + b_lin_log = S_lin.bin_data(pl_bin_log); + b_log_log = S_log.bin_data(pl_bin_log); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % Nothing to check + % + % + + % + atest = true; + + if stest + + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_21 + + %% Local helper functions + + %% Algorithm test for UTP 02,03,04 + + function atest = algo_test_y(in, out, pli) + atest = true; + if numel(in.data.getY) < numel(out.data.getY) + atest = false; + end + if isa(in.data, 'data2D') + if numel(in.data.getX) < numel(out.data.getX) + atest = false; + end + end + end + + %% FUnction to prepare test data + function [a, S_lin, S_log] = prepare_test_data + % Build time-series test data + fs = 1; + nsecs = 86400; + sigma_distr = 4.69e-12; + mu_distr = -5.11e-14; + + % White noise + type = 'Normal'; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_const = ao(mu_distr); + a = a_n + a_const; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the PSD and LPSD of the time-series data + win = specwin('BH92'); + olap = win.rov; + detrend = 0; + n_pts = nsecs*fs/10; + scale = 'PSD'; + pl_psd = plist('Win', win, 'olap', olap, ... + 'Nfft', n_pts, 'order', detrend, 'scale', scale); + + S_lin = a.psd(pl_psd); + S_log = a.lpsd(pl_psd); + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_bsubmit.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_bsubmit.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,542 @@ +% UTP_AO_BSUBMIT a set of UTPs for the ao/bsubmit method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_bsubmit.m,v 1.15 2010/08/18 09:25:55 ingo Exp $ +% + +% +% +% The bsubmit method of the ao class submits a collection of objects in +% binary form to an LTPDA Repository. The type of the objects are +% independent. +% +% + +function results = utp_ao_bsubmit(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'bsubmit'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + plForAutoTest = plist('no dialog', true, 'use selector', false); + + connPl = utpGetConnectionPlist(); + rm = LTPDARepositoryManager(); + conn = rm.getConnection(connPl); + try + + experiment_title = 'utp_ao_bsubmit: submit ao'; + experiment_description = 'utp_ao_bsubmit: description'; + analysis_description = ''; + quantity = 'none'; + keywords = 'none'; + reference_ids = ''; + additional_comments = 'none'; + additional_authors = 'no one'; + + plSinfo = plist(... + 'experiment_title', experiment_title, ... + 'experiment_description', experiment_description, ... + 'analysis_description', analysis_description, ... + 'quantity', quantity, ... + 'keywords', keywords, ... + 'reference_ids', reference_ids, ... + 'additional_comments', additional_comments, ... + 'additional_authors', additional_authors); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test output of the data + catch + end + + % Close connection + utpCloseConnection(conn); + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 15, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('sinfo filename'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isEmptyChar(io(3).plists.find('sinfo filename')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the bsubmit method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the bsubmit method works for a vector of AOs as input. + % + % + + try + % + [ids, cids] = bsubmit(atvec, connPl, plSinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(atvec), atest = false; end + if numel(robjs2) ~= numel(atvec), atest = false; end + if numel(robjs3) ~= numel(atvec), atest = false; end + % Check the retrieved object against the submitted + if ~eq(atvec, [robjs1{:}]), atest = false; end + if ~eq(atvec, [robjs2{:}]), atest = false; end + if ~eq(atvec, [robjs3{:}]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the bsubmit method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Tests that the bsubmit method works with a matrix of AOs as input. + % + % + + try + % + [ids, cids] = bsubmit(atmat, connPl, plSinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3), ids(4), ids(5), ids(6)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(atmat), atest = false; end + if numel(robjs2) ~= numel(atmat), atest = false; end + if numel(robjs3) ~= numel(atmat), atest = false; end + % Check the retrieved object against the submitted + if ~eq(atmat, reshape([robjs1{:}], size(atmat))), atest = false; end + if ~eq(atmat, reshape([robjs2{:}], size(atmat))), atest = false; end + if ~eq(atmat, reshape([robjs3{:}], size(atmat))), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the bsubmit method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Tests that the bsubmit method works with a list of AOs as input. Use + % for this a mix of different object types. + % + % + + try + % + pl = smodel('a'); + iir = miir(plist('type', 'highpass')); + [ids, cids] = bsubmit(at1, pl, iir, connPl, plSinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 3, atest = false; end + if numel(robjs2) ~= 3, atest = false; end + if numel(robjs3) ~= 3, atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, at1), atest = false; end + if ~eq(robjs1{2}, pl), atest = false; end + if ~eq(robjs1{3}, iir), atest = false; end + % Check robjs2 + if ~eq(robjs2{1}, at1), atest = false; end + if ~eq(robjs2{2}, pl), atest = false; end + if ~eq(robjs2{3}, iir), atest = false; end + % Check robjs3 + if ~eq(robjs3{1}, at1), atest = false; end + if ~eq(robjs3{2}, pl), atest = false; end + if ~eq(robjs3{3}, iir), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the abs method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Tests that the bsubmit method works with a list of AOs as input. Use + % for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = bsubmit(pl, atmat, iir, atvec, connPl, plSinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 2 + numel(atmat) + numel(atvec), atest = false; end + if numel(robjs2) ~= 2 + numel(atmat) + numel(atvec), atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, atmat(1)), atest = false; end + if ~eq(robjs1{2}, atmat(2)), atest = false; end + if ~eq(robjs1{3}, atmat(3)), atest = false; end + if ~eq(robjs1{4}, atmat(4)), atest = false; end + if ~eq(robjs1{5}, atmat(5)), atest = false; end + if ~eq(robjs1{6}, atmat(6)), atest = false; end + if ~eq(robjs1{7}, iir), atest = false; end + if ~eq(robjs1{8}, atvec(1)), atest = false; end + if ~eq(robjs1{9}, atvec(2)), atest = false; end + if ~eq(robjs1{10}, atvec(3)), atest = false; end + if ~eq(robjs1{11}, pl), atest = false; end + % Check robjs2 + if ~eq(robjs2{1}, atmat(1)), atest = false; end + if ~eq(robjs2{2}, atmat(2)), atest = false; end + if ~eq(robjs2{3}, atmat(3)), atest = false; end + if ~eq(robjs2{4}, atmat(4)), atest = false; end + if ~eq(robjs2{5}, atmat(5)), atest = false; end + if ~eq(robjs2{6}, atmat(6)), atest = false; end + if ~eq(robjs2{7}, iir), atest = false; end + if ~eq(robjs2{8}, atvec(1)), atest = false; end + if ~eq(robjs2{9}, atvec(2)), atest = false; end + if ~eq(robjs2{10}, atvec(3)), atest = false; end + if ~eq(robjs2{11}, pl), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tthe bsubmit method properly applies history. + % + % + function result = utp_06 + + % + % + % Tthe bsubmit method properly applies history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the bsubmit method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [ids, cids] = bsubmit(at1, at2, connPl, plSinfo, plForAutoTest); + + [o1, o2] = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + o3 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the output + if ~eq(o1, at1), atest = false; end + if ~eq(o2, at2), atest = false; end + if ~eq(o3{1}, at1), atest = false; end + if ~eq(o3{2}, at2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_cat.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_cat.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,221 @@ +% UTP_AO_CAT a set of UTPs for the ao/cat method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_cat.m,v 1.3 2009/08/07 10:05:38 hewitson Exp $ +% + +% +% +% The cat method of the ao class concatenate AOs into a row vector. +% +% + +function results = utp_ao_cat(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'cat'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works not + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(in.data.getY, out.data.getY) + atest = false; + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_06 + + % + % + % The cat method doesn't apply history. + % + % + function result = utp_06 + + % + % + % The cat method doesn't apply history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % The cat method can not be used as a modifer method. + % + % + function result = utp_07 + + % + % + % The cat method can not be used as a modifer method. In this case + % throws the method an error. + % + % + + try + % + % copy at1 to work with + amodi = ao(at1); + aeq = ao(at1); + out = aeq.cat(); + amodi.cat(); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_char.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_char.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,357 @@ +% UTP_AO_CHAR a set of UTPs for the ao/char method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_char.m,v 1.3 2009/07/20 15:14:11 ingo Exp $ +% + +% +% +% The char method of the ao class converts the objects into one character string +% which contains information of the object. +% +% + +function results = utp_ao_char(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'char'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the char method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the char method works for a vector of AOs as input. + % + % + + try + % + out = char(atvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end; + for kk = 1:numel(atvec) + if isempty(strfind(out, atvec(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the char method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the char method works for a matrix of AOs as input. + % + % + + try + % + out = char(atmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(atmat) + if isempty(strfind(out, atmat(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the char method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the char method works for a list of AOs as input. + % + % + + try + % + out = char(at1,at2,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + aoin = [at1,at2,at3]; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(aoin) + if isempty(strfind(out, aoin(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the char method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the char method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = char(at1,atvec,at2,atmat,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + aoin = [at1,reshape(atvec,1,[]),at2,reshape(atmat,1,[]),at3]; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(aoin) + if isempty(strfind(out, aoin(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the char method properly applies history. + % + % + function result = utp_06 + + % + % + % The method char doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_cohere.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_cohere.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,2323 @@ +% UTP_AO_COHERE a set of UTPs for the ao/cohere method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_cohere.m,v 1.44 2011/07/22 12:29:58 mauro Exp $ +% + +% +% +% The cohere method of the ao class computes the coherence between two +% time-series AOs. +% +% + +function results = utp_ao_cohere(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'cohere'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Get default window from the preferences + prefs = getappdata(0, 'LTPDApreferences'); + defaultWinType = char(prefs.getMiscPrefs.getDefaultWindow); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input (only with two objects) + results = [results utp_03]; % Matrix input (not possible) + results = [results utp_04]; % List input (only with two objects) + results = [results utp_05]; % Test with mixed input (not possible) + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test the basic usage against MATLAB mscohere + + results = [results utp_11(mthd, [at1 at1], ple1)]; % Test plotinfo doesn't disappear + + results = [results utp_12]; % Test basic symmetry properties of cohere (C) + results = [results utp_13]; % Test basic symmetry properties of cohere (MS) + results = [results utp_14]; % Test basic symmetry properties of cohere (C) + results = [results utp_15]; % Test basic symmetry properties of cohere (MS) + results = [results utp_16]; % Test basic relationship (MS) <-> (C) + results = [results utp_17]; % Test units handling: complex cohere + results = [results utp_18]; % Test units handling: magnitude-squared cohere + results = [results utp_19]; % Test data lengths + results = [results utp_20]; % Test with single window + results = [results utp_21]; % Test number of averages: requested/obtained + results = [results utp_22]; % Test number of averages: correct number + results = [results utp_23]; % Test number of averages: syntax + results = [results utp_24]; % Test the basic usage against MATLAB mscohere + results = [results utp_25]; % Test Kaiser win and olap: (C) + results = [results utp_26]; % Test Kaiser win and olap: (MS) + results = [results utp_30]; % Special cases: same input + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 9, atest = false; end + % Check key + if ~io(3).plists.isparam('nfft'), atest = false; end + if ~io(3).plists.isparam('win'), atest = false; end + if ~io(3).plists.isparam('olap'), atest = false; end + if ~io(3).plists.isparam('type'), atest = false; end + if ~io(3).plists.isparam('order'), atest = false; end + if ~io(3).plists.isparam('navs'), atest = false; end + if ~io(3).plists.isparam('times'), atest = false; end + if ~io(3).plists.isparam('split'), atest = false; end + if ~io(3).plists.isparam('psll'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('nfft'), -1), atest = false; end + if ~strcmpi(io(3).plists.find('win'), defaultWinType), atest = false; end + if ~isequal(io(3).plists.find('olap'), -1), atest = false; end + if ~isequal(io(3).plists.find('type'), 'C'), atest = false; end + if ~isequal(io(3).plists.find('order'), 0), atest = false; end + if ~isequal(io(3).plists.find('navs'), -1), atest = false; end + if ~isEmptyDouble(io(3).plists.find('times')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('split')), atest = false; end + if ~isequal(io(3).plists.find('psll'), 200), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('nfft'), {-1}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('win'), specwin.getTypes), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('olap'), {-1}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('type'), {'C', 'MS'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('order'), {-1 0 1 2 3 4 5 6 7 8 9}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('navs'), {-1}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('times'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('split'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('psll'), {200}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the cohere method works with a vector of AOs as input. (only + % with two objects in the vector) + % + % + function result = utp_02 + + % + % + % Test that the cohere method works for a vector of AOs as input. + % + % + + try + % + avec = [at1 at5]; + out = cohere(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is equal to 1. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + + TOL = 1e-13; + + % Get shortest vector + lmin = min([length(at1.y), length(at5.y), length(at6.y)]); + % Set Nfft + Nfft = lmin; + % Get default window + if strcmpi(defaultWinType, 'kaiser') + win = specwin(defaultWinType, Nfft, find(ao.getInfo('cohere').plists, 'psll')); + else + win = specwin(defaultWinType, Nfft); + end + % Compute magnitude squared coherence estimate with MATLAB + % out: at1->at5 + [cxy, f] = mscohere(at1.y(1:lmin), at5.y(1:lmin), win.win, Nfft/2, Nfft, at1.fs); + if any(abs(out.y-cxy > TOL)), atest = false; end + if any(abs(out.x-f > TOL)), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Test that the cohere method doesn't work for a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the cohere method doesn't work for a matrix of AOs as input. + % + % + + try + % + amat = [at1 at2;at5 at6]; + out = cohere(amat); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the cohere method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the cohere method works for a list of AOs as input. + % + % + + try + % + out = cohere(at1,at5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is equal to 1. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + + TOL = 1e-13; + + % Get shortest vector + lmin = min([length(at1.y), length(at5.y)]); + % Set Nfft + Nfft = lmin; + % Get default window + if strcmpi(defaultWinType, 'kaiser') + win = specwin(defaultWinType, Nfft, find(ao.getInfo('cohere').plists, 'psll')); + else + win = specwin(defaultWinType, Nfft); + end + % Compute magnitude squared coherence estimate with MATLAB + % out: at1->at5 + [cxy, f] = mscohere(at1.y(1:lmin), at5.y(1:lmin), win.win, Nfft/2, Nfft, at1.fs); + if any(abs(out.y-cxy > TOL)), atest = false; end + if any(abs(out.x-f > TOL)), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Test that the cohere method doesn't work with an input of matrices + % and vectors and single AOs. + % + % + function result = utp_05 + + % + % + % Test that the cohere method doesn't work with an input of matrices + % and vectors and single AOs. + % + % + + try + % + out = cohere([at5 at6], [at5 at1; at6 at1], at6); + stest = false; + % + catch err + stest = true; + end + + % + % + % 1) Nothing to check + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the cohere method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the cohere method can be processed back + % to an m-file. + % + % + + try + % + out = cohere(at5,at6); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'cohere'. + % 2) Check that the re-built object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'cohere'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the cohere method can not modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the cohere method can not modify the input AO. + % The method must throw an error for the modifier call. + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + ain.cohere(at5); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the cohere method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = cohere(at5, at6); + out2 = cohere(at6, at5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the output data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y, 2) ~= 1, atest = false; end + if size(out2.data.y, 1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the cohere method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % This test is not longer necessary because the cohere method pass back + % always only one object. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Tests that the cohere method agrees with MATLAB's mscohere when + % configured to use the same parameters. + % + % + function result = utp_10 + + % + % + % Test that applying cohere works on two AOs. + % + % + + try + % + % Construct two test AOs + nsecs = 10; + fs = 1000; + pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'randn(size(t))'); + a1 = ao(pl); a2 = ao(pl); + % Filter one time-series + f2 = miir(plist('type', 'bandpass', 'fs', fs, 'order', 3, 'fc', [50 250])); + a1f = filter(a1, plist('filter', f2)); + % make some cross-power + a4 = a1f+a2; a4.setName; + % Compute coherence + Nfft = 2*fs; + win = specwin('Hanning', Nfft); + pl = plist('Nfft', Nfft, 'Win', win.type, 'order', -1, 'type', 'MS'); + out = cohere(a4,a1,pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that output agrees with the output of MATLAB's mscohere. + % 2) Check that the shape of the output data is equal to the input data + % + % + + atest = true; + if stest + % + % Compute coherence using MATLAB's cohere + [cxy, f] = mscohere(a4.y, a1.y, win.win, Nfft/2, Nfft, a1.fs); + if ne(cxy(:), out.y), atest = false; end + if ne(f, out.x), atest = false; end + if ne(out, out, ple2), atest = false; end + % Check the data shape + if size(a4.y,1) == 1 + if size(out.y,1) ~= 1, atest = false; end + else + if size(out.y,2) ~= 1, atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + + %% UTP_12 + + % + % + % Tests symmetry properties of complex-coherence: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) complex coherence of the white noise series + % 4) compare C(x,y) with conj(C(y,x)) + % 5) compare C(x,x) and C(y,y) with 1 + % + + % + function result = utp_12 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) complex coherence of the white noise + % + % + + % + try + + % Array of parameters to pick from + fs_list = [0.1;1;10]; + nsecs_list = [100:100:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + mu_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + mu_distr = utils.math.randelement(mu_distr_list, 1); + f = [1:5] / 100 * fs; + A = sigma_distr + sigma_distr*rand(1,1); + phi = 0 + 2*pi*rand(1,1); + + % White noise + type = 'Normal'; + a_n1 = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_n2 = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_const = ao(mu_distr); + a_wave = ao(plist('waveform', 'sine-wave', ... + 'fs', fs, 'nsecs', nsecs, 'f', f, 'A', A, 'phi', phi)); + a_1 = a_n1 + a_const + a_wave; + a_2 = a_n2 + a_wave; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the complex coherence of the time-series data + win_list = specwin.getTypes; + win_type = utils.math.randelement(win_list(~strcmpi(win_list, 'levelledhanning')), 1); + win_type = win_type{1}; + if strcmp(win_type, 'Kaiser') + win = specwin(win_type, 1, find(ao.getInfo('psd').plists, 'psll')); + else + win = specwin(win_type, 1); + end + olap = win.rov; + detrend = 0; + scale_type = 'C'; + n_pts = nsecs*fs/10; + + C12 = cohere(a_1, a_2, ... + plist('Win', win.type, 'olap', olap, 'Nfft', n_pts, 'order', detrend, 'type', scale_type)); + C21 = cohere(a_2, a_1, ... + plist('Win', win.type, 'olap', olap, 'Nfft', n_pts, 'order', detrend, 'type', scale_type)); + C21_cc = conj(C21); + C11 = cohere(a_1, a_1, ... + plist('Win', win.type, 'olap', olap, 'Nfft', n_pts, 'order', detrend, 'type', scale_type)); + C22 = cohere(a_2, a_2, ... + plist('Win', win.type, 'olap', olap, 'Nfft', n_pts, 'order', detrend, 'type', scale_type)); + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that C(x,y) equals conj(C(y,x)) + % 2) Check that C(x,x) equals 1 + % 2) Check that C(y,y) equals 1 + + % + + % + atest = true; + + if stest + if ~eq(C12.data, C21_cc.data, 'dy') || ... + ~isequal(C11.y, ones(size(C11.y))) || ... + ~isequal(C22.y, ones(size(C22.y))) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Tests symmetry properties of complex-coherence: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) magnitude-squared coherence of the white noise series + % 4) compare C(x,y) with C(y,x) + % 5) compare C(x,x) and C(y,y) with 1 + % + + % + function result = utp_13 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) magnitude-squared coherence of the white noise + % + % + + % + try + + % Array of parameters to pick from + fs_list = [0.1;1;10]; + nsecs_list = [100:100:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + mu_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + mu_distr = utils.math.randelement(mu_distr_list, 1); + f = [1:5] / 100 * fs; + A = sigma_distr + sigma_distr*rand(1,1); + phi = 0 + 2*pi*rand(1,1); + + % White noise + type = 'Normal'; + a_n1 = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_n2 = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_const = ao(mu_distr); + a_wave = ao(plist('waveform', 'sine-wave', ... + 'fs', fs, 'nsecs', nsecs, 'f', f, 'A', A, 'phi', phi)); + a_1 = a_n1 + a_const + a_wave; + a_2 = a_n2 + a_wave; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the magnitude-squared coherence of the time-series data + win_list = specwin.getTypes; + win_type = utils.math.randelement(win_list(~strcmpi(win_list, 'levelledhanning')), 1); + win_type = win_type{1}; + if strcmp(win_type, 'Kaiser') + win = specwin(win_type, 1, find(ao.getInfo('psd').plists, 'psll')); + else + win = specwin(win_type, 1); + end + olap = win.rov; + detrend = 0; + scale_type = 'MS'; + n_pts = nsecs*fs/10; + + C12 = cohere(a_1, a_2, ... + plist('Win', win.type, 'olap', olap, 'Nfft', n_pts, 'order', detrend, 'type', scale_type)); + C21 = cohere(a_2, a_1, ... + plist('Win', win.type, 'olap', olap, 'Nfft', n_pts, 'order', detrend, 'type', scale_type)); + C11 = cohere(a_1, a_1, ... + plist('Win', win.type, 'olap', olap, 'Nfft', n_pts, 'order', detrend, 'type', scale_type)); + C22 = cohere(a_2, a_2, ... + plist('Win', win.type, 'olap', olap, 'Nfft', n_pts, 'order', detrend, 'type', scale_type)); + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that C(x,y) equals C(y,x) + % 1) Check that C(x,x) equals 1 + % 1) Check that C(y,y) equals 1 + + % + + % + atest = true; + + if stest + if ~isequal(C12.data, C21.data) || ... + ~isequal(C11.y, ones(size(C11.y))) ... + || ~isequal(C22.y, ones(size(C22.y))) + atest = false; + end + if atest == false + fs + nsecs + sigma_distr + mu_distr + f + A + phi + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + %% UTP_14 + + % + % + % Tests symmetry properties of complex-coherence: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) complex coherence of the combination of white noise series + % 4) compare C(x,y) with 1 + % + + % + function result = utp_14 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) complex coherence of the combination of noise + % + % + + % + try + + % Array of parameters to pick from + fs_list = [0.1;1;10]; + nsecs_list = [100:100:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + mu_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + mu_distr = utils.math.randelement(mu_distr_list, 1); + f = [1:5] / 100 * fs; + A = sigma_distr + sigma_distr*rand(1,1); + phi = 0 + 2*pi*rand(1,1); + + % White noise + type = 'Normal'; + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_const = ao(mu_distr); + % Sinusoidal signal + a_wave = ao(plist('waveform', 'sine-wave', ... + 'fs', fs, 'nsecs', nsecs, 'f', f, 'A', A, 'phi', phi)); + a_1 = a_n + a_wave; + % Linear combination (totally correlated time series) + a_2 = a_1 + a_const; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the complex coherence of the time-series data + win_list = specwin.getTypes; + win_type = utils.math.randelement(win_list(~strcmpi(win_list, 'levelledhanning')), 1); + win_type = win_type{1}; + if strcmp(win_type, 'Kaiser') + win = specwin(win_type, 1, find(ao.getInfo('psd').plists, 'psll')); + else + win = specwin(win_type, 1); + end + olap = win.rov; + detrend = 0; + scale_type = 'C'; + n_pts = nsecs*fs/10; + + C = cohere(a_1, a_2, ... + plist('Win', win.type, 'olap', olap, 'Nfft', n_pts, 'order', detrend, 'type', scale_type)); + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the complex coherence equals 1 + + % + + % + atest = true; + TOL = 1e-12; + + if stest + if any(abs((C.y - 1)) > TOL) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_14 + + %% UTP_15 + + % + % + % Tests symmetry properties of complex-coherence: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) magnitude-squared coherence of the combination of white noise series + % 4) compare C(x,y) with 1 + % + + % + function result = utp_15 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) magnitude-squared coherence of the combination of noise + % + % + + % + try + + % Array of parameters to pick from + fs_list = [0.1;1;10]; + nsecs_list = [100:100:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + mu_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + mu_distr = utils.math.randelement(mu_distr_list, 1); + f = [1:5] / 100 * fs; + A = sigma_distr + sigma_distr*rand(1,1); + phi = 0 + 2*pi*rand(1,1); + + % White noise + type = 'Normal'; + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_const = ao(mu_distr); + % Sinusoidal signal + a_wave = ao(plist('waveform', 'sine-wave', ... + 'fs', fs, 'nsecs', nsecs, 'f', f, 'A', A, 'phi', phi)); + a_1 = a_n + a_wave; + % Linear combination (totally correlated time series) + a_2 = a_1 + a_const; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the complex coherence of the time-series data + win_list = specwin.getTypes; + win_type = utils.math.randelement(win_list(~strcmpi(win_list, 'levelledhanning')), 1); + win_type = win_type{1}; + if strcmp(win_type, 'Kaiser') + win = specwin(win_type, 1, find(ao.getInfo('psd').plists, 'psll')); + else + win = specwin(win_type, 1); + end + olap = win.rov; + detrend = 0; + scale_type = 'MS'; + n_pts = nsecs*fs/10; + + C = cohere(a_1, a_2, ... + plist('Win', win.type, 'olap', olap, 'Nfft', n_pts, 'order', detrend, 'type', scale_type)); + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the magnitude-squared coherence equals 1 + + % + + % + atest = true; + + if stest + if ~eq(C.y, ones(size(C.y))) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_15 + + %% UTP_16 + + % + % + % Tests symmetry properties of complex-coherence: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) magnitude-squared coherence M of the combination of white noise series + % 4) complex coherence C of the combination of white noise series + % 5) compare abs(C)^2 with M + % + + % + function result = utp_16 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) magnitude-squared coherence of the combination of noise + % 6) complex coherence of the combination of noise + % + % + + % + try + + % Array of parameters to pick from + fs_list = [0.1;1;10]; + nsecs_list = [100:100:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + mu_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + mu_distr = utils.math.randelement(mu_distr_list, 1); + f = [1:5] / 100 * fs; + A = sigma_distr + sigma_distr*rand(1,1); + phi = 0 + 2*pi*rand(1,1); + + % White noise + type = 'Normal'; + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_const = ao(mu_distr); + % Sinusoidal signal + a_wave = ao(plist('waveform', 'sine-wave', ... + 'fs', fs, 'nsecs', nsecs, 'f', f, 'A', A, 'phi', phi)); + a_1 = a_n + a_wave; + % Linear combination (totally correlated time series) + a_2 = a_1 + a_const; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the complex coherence of the time-series data + win_list = specwin.getTypes; + win_type = utils.math.randelement(win_list(~strcmpi(win_list, 'levelledhanning')), 1); + win_type = win_type{1}; + if strcmp(win_type, 'Kaiser') + win = specwin(win_type, 1, find(ao.getInfo('psd').plists, 'psll')); + else + win = specwin(win_type, 1); + end + olap = win.rov; + detrend = 0; + n_pts = nsecs*fs/10; + + M = cohere(a_1, a_2, ... + plist('Win', win.type, 'olap', olap, 'Nfft', n_pts, 'order', detrend, 'type', 'MS')); + C = cohere(a_1, a_2, ... + plist('Win', win.type, 'olap', olap, 'Nfft', n_pts, 'order', detrend, 'type', 'C')); + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the magnitude-squared coherence equals the square + % modulus of the complex coherence + + % + + % + atest = true; + TOL = 1e-15; + + if stest + if any(abs(M.y - abs(C.y).^2) > TOL) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_16 + + %% UTP_17 + + % + % + % Tests handling of units: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) complex coherence of the white noise series + % 4) compares the units of the input and output + % + + % + function result = utp_17 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) complex cohere of the white noise + % + % + + % + try + + % Build time-series test data + fs = 1; + nsecs = 86400; + sigma_distr_1 = 4.69e-12; + mu_distr_1 = -5.11e-14; + sigma_distr_2 = 6.04e-9; + mu_distr_2 = 1.5e-10; + + % White noise + type = 'Normal'; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_1)); + a_const = ao(mu_distr_1); + a_1 = a_n + a_const; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_2)); + a_const = ao(mu_distr_2); + a_2 = a_n + a_const; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the coherence of the time-series data + win = specwin('BH92'); + olap = win.rov; + detrend = 0; + scale_type = 'C'; + n_pts = nsecs*fs/10; + + C = cohere(a_1, a_2, ... + plist('Win', win.type, 'olap', olap, 'Nfft', n_pts, 'order', detrend, 'type', scale_type)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (complex coherence yunits) equals [1] + % 2) Check that (complex coherence xunits) equals [Hz] + + % + + % + atest = true; + + if stest + if ~eq(C.yunits, unit('')) || ~eq(C.xunits, unit('Hz')) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_17 + + %% UTP_18 + + % + % + % Tests handling of units: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) magnitude-squared coherence of the white noise series + % 4) compares the units of the input and output + % + + % + function result = utp_18 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) magnitude-squared cohere of the white noise + % + % + + % + try + + % Build time-series test data + fs = 1; + nsecs = 86400; + sigma_distr_1 = 4.69e-12; + mu_distr_1 = -5.11e-14; + sigma_distr_2 = 6.04e-9; + mu_distr_2 = 1.5e-10; + + % White noise + type = 'Normal'; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_1)); + a_const = ao(mu_distr_1); + a_1 = a_n + a_const; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_2)); + a_const = ao(mu_distr_2); + a_2 = a_n + a_const; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the coherence of the time-series data + win = specwin('BH92'); + olap = win.rov; + detrend = 0; + scale_type = 'MS'; + n_pts = nsecs*fs/10; + + C = cohere(a_1, a_2, ... + plist('Win', win.type, 'olap', olap, 'Nfft', n_pts, 'order', detrend,'type', scale_type)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (magnitude-squared coherence yunits) equals [1] + % 2) Check that (magnitude-squared coherence xunits) equals [Hz] + + % + + % + atest = true; + + if stest + if ~eq(C.yunits, unit('')) || ~eq(C.xunits, unit('Hz')) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_18 + + %% UTP_19 + + % + % + % Tests that differently sized data sets are treated properly + % + % + function result = utp_19 + + % + % + % Test that applying cohere works on two AOs. + % + % + + try + % + % Construct two test AOs + nsecs = [10000:1:20000]; + fs = 1; + pl = plist('fs', fs, 'tsfcn', 'randn(size(t))'); + a1 = ao(pl.pset('nsecs', utils.math.randelement(nsecs, 1))); + a2 = ao(pl.pset('nsecs', utils.math.randelement(nsecs, 1))); + len_1 = a1.len; + len_2 = a2.len; + % Filter one time-series + f2 = miir(plist('type', 'bandpass', 'fs', fs, 'order', 3, 'fc', [.050 .25])); + a1f = filter(a1, plist('filter', f2)); + % Compute cohere + Nfft = -1; + win = 'Hanning'; + pl = plist('Nfft', Nfft, 'Win', win, 'order', -1); + out = cohere(a2,a1f,pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that cohere used the length of the shortest ao. + % + % + + atest = true; + if stest + % + % Compare the nfft with the length of the input data + + if out.x(2) ~= 1/min(len_1,len_2) + atest = false; + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_19 + + %% UTP_20 + + % + % + % Tests that applying a single window the coherence is 1 + % + % + function result = utp_20 + + % + % + % Test that applying cohere works on two AOs. + % + % + + try + % + % Construct two test AOs + nsecs = [10000:100:20000]; + fs = 1; + pl = plist('fs', fs, 'tsfcn', 'randn(size(t))'); + a1 = ao(pl.pset('nsecs', utils.math.randelement(nsecs, 1))); + a2 = ao(pl.pset('nsecs', utils.math.randelement(nsecs, 1))); + % Filter one time-series + f2 = miir(plist('type', 'bandpass', 'fs', fs, 'order', 3, 'fc', [.050 .25])); + a1f = filter(a1, plist('filter', f2)); + % Compute cohere + Nfft = -1; + win = 'Hanning'; + pl = plist('Nfft', Nfft, 'Win', win, 'order', -1); + out_c = cohere(a2, a1f, pl.pset('type', 'C')); + out_ms = cohere(a2, a1f, pl.pset('type', 'MS')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the calculated cohere is 1 + % + % + + atest = true; + TOL = 1e-12; + if stest + % + % Compare the calculated cohere with 1 + + if any(abs(abs(out_c.y) - 1) > TOL) + atest = false; + end + if any(abs(abs(out_ms.y) - 1) > TOL) + atest = false; + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_20 + + %% UTP_21 + + % + % + % Tests the possibility to set the number of averages rather than setting the Nfft: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) cohere of the noise, without detrending, random window, set number of + % averages + % 3) check the effective number of averages + % + + % + function result = utp_21 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) cohere of the noise, without detrending, random window, set number of + % averages + % + % + + % + try + % Array of parameters to pick from + fs_list = [0.1;1;2;5;10]; + nsecs_list = [2000:1000:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + trend_0_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + trend_0 = utils.math.randelement(trend_0_list, 1); + + % White noise + type = 'Normal'; + a_n1 = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_n2 = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + + % Constant signal + a_c = ao(trend_0); + + % Total signals + a1 = a_n1 + a_c; + a2 = a_n2 + a_c; + + % Evaluate the complex coherence of the white noise time-series data + win_list = specwin.getTypes; + win_type = utils.math.randelement(win_list(~strcmpi(win_list, 'levelledhanning')), 1); + win_type = win_type{1}; + switch win_type + case 'Kaiser' + win = specwin(win_type, 1, find(ao.getInfo('psd').plists, 'psll')); + otherwise + win = specwin(win_type, 1); + end + + olap = win.rov; + detrend = 0; + n_pts = -1; + scale_type = 'C'; + navs = utils.math.randelement([1:100],1); + + % Evaluates the coherence asking for the number of averages + C = cohere(a1, a2, plist('Win', win.type, 'olap', olap, ... + 'Nfft', n_pts, 'order', detrend, 'type', scale_type, 'navs', navs)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated navs are identical to those requested + % + % + + % + atest = true; + + if stest + % Compare the navs written in the output object with the requested one + if ne(navs, C.data.navs) + if ne(find(C.hist.plistUsed, 'navs'), C.data.navs) + atest = false; + end + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_21 + + %% UTP_22 + + % + % + % Tests the possibility to set the number of averages rather than setting the Nfft: + % 1) white noise produced from uniform pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) cohere of the noise, without detrending, random window, random navs + % 3) get the number of averages + % 4) get the nfft used + % 5) run cohere again, with the nfft used + % 6) compare the calculated objects + % + + % + function result = utp_22 + + % + % + % 1) white noise produced from uniform pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) cohere of the noise, without detrending, random window, random navs + % 3) get the number of averages + % 4) get the nfft used + % 5) run cohere again, with the nfft used + % + % + + % + try + % Array of parameters to pick from + fs_list = [0.1;1;2;5;10]; + nsecs_list = [20 100 1000:1000:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + trend_0_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + trend_0 = utils.math.randelement(trend_0_list, 1); + + % White noise + type = 'Uniform'; + a_n1 = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_n2 = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + + % Constant signal + a_c = ao(trend_0); + + % Total signals + a1 = a_n1 + a_c; + a2 = a_n2 + a_c; + + % Evaluate the complex coherence of the white noise time-series data + win_list = specwin.getTypes; + win_type = utils.math.randelement(win_list(~strcmpi(win_list, 'levelledhanning')), 1); + win_type = win_type{1}; + switch win_type + case 'Kaiser' + win = specwin(win_type, 1, find(ao.getInfo('psd').plists, 'psll')); + otherwise + win = specwin(win_type, 1); + end + + olap = win.rov; + detrend = 0; + scale_type = 'MS'; + navs = fix(utils.math.randelement(logspace(0,log10(max(0,a1.len/10)),50),1)); + + % Calculates the coherence asking for the number of averages + C1 = cohere(a1, a2, plist('Win', win.type, 'olap', olap, ... + 'Nfft', -1, 'order', detrend, 'type', scale_type, ... + 'navs', navs)); + + % Calculates the coherence asking for the number of points just evaluated + C2 = cohere(a1, a2, plist('Win', win.type, 'olap', olap, ... + 'Nfft', find(C1.hist.plistUsed, 'Nfft'), 'order', detrend, 'type', scale_type)); + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated objects C1 and C2 are identical + % + % + + % + atest = true; + + if stest + % Compare the output objects + if ne(C1,C2,ple3) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_22 + + %% UTP_23 + + % + % + % Tests the possibility to set the number of averages rather than setting the Nfft: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) cohere of the noise, without detrending, random window, random navs + % 3) get the number of averages + % 4) get the nfft used + % 5) run cohere again, with the nfft used + % 6) compare navs, nfft, coheres + % + + % + function result = utp_23 + + % + % + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) cohere of the noise, without detrending, random window, random navs + % 3) get the number of averages + % 4) get the nfft used + % 5) run cohere again, with the nfft used + % 6) run cohere again, with conflicting parameters, and verify it uses + % nfft rather than navs + % + % + + % + try + % Array of parameters to pick from + fs_list = [0.1;1;2;5;10]; + nsecs_list = [1000:1000:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + trend_0_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + trend_0 = utils.math.randelement(trend_0_list, 1); + + % White noise + type = 'Normal'; + a_n1 = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_n2 = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + + % Constant signal + a_c = ao(trend_0); + + % Total signals + a1 = a_n1 + a_c; + a2 = a_n2 + a_c; + + % Evaluate the complex coherence of the white noise time-series data + win_list = specwin.getTypes; + win_type = utils.math.randelement(win_list(~strcmpi(win_list, 'levelledhanning')), 1); + win_type = win_type{1}; + switch win_type + case 'Kaiser' + win = specwin(win_type, 1, find(ao.getInfo('psd').plists, 'psll')); + otherwise + win = specwin(win_type, 1); + end + + olap = win.rov; + detrend = 0; + scale_type = 'C'; + navs = fix(utils.math.randelement(logspace(0,log10(max(a1.len/10,0)),50),1)); + + % Calculates the coherence asking for the number of averages + C1 = cohere(a1, a2, plist('Win', win.type, 'olap', olap, ... + 'Nfft', -1, 'order', detrend, 'type', scale_type, ... + 'navs', navs)); + + npts_2 = find(C1.hist.plistUsed, 'Nfft'); + % Calculates the coherence asking for the number of points + C2 = cohere(a1, a2, plist('Win', win.type, 'olap', olap, ... + 'Nfft', npts_2, 'order', detrend, 'type', scale_type)); + + npts_3 = fix(npts_2/2); + % Calculates the coherence asking for the number of points AND the window length + C3 = cohere(a1, a2, plist('Win', win.type, 'olap', olap, ... + 'Nfft', npts_3, ... + 'order', detrend, 'type', scale_type, ... + 'navs', navs)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated objects C1 and C2 are identical + % 2) Check that C3 used different values + % + % + + % + atest = true; + + if stest + % Compare the navs written in the output object with the requested one + if ne(C1,C2,ple3) || ... + ne(find(C3.hist.plistUsed, 'Nfft'), npts_3) || eq(C3.data.navs, navs) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_23 + + %% UTP_24 + + % + % + % Tests that the cohere method agrees with MATLAB's mscohere when + % configured to use the same parameters. + % + % + function result = utp_24 + + % + % + % Test that the applying cohere works on two AOs. + % + % + + try + % + % Construct two test AOs + nsecs = 10; + fs = 1000; + pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'randn(size(t))'); + a1 = ao(pl); a2 = ao(pl); + % Filter one time-series + f2 = miir(plist('type', 'bandpass', 'fs', fs, 'order', 3, 'fc', [50 250])); + a1f = filter(a1, plist('filter', f2)); + % make some cross-power + a4 = a1f+a2; a4.setName; + % Create the transpose of a4 to check the output data shape + a4 = a4.'; + % Compute coherence + Nfft = 2*fs; + % Use different windows size as Nfft + win = specwin('Hanning', 1000); + pl = plist('Nfft', Nfft, 'Win', win.type, 'order', 0, 'type', 'MS'); + out = cohere(a4,a1,pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that output agrees with the output of MATLAB's mscohere. + % 2) Check that the shape of the output data is equal to the input data + % + % + + atest = true; + if stest + % + TOL = 1e-12; + + % Redesign the window + win = specwin('Hanning', Nfft); + % Compute coherence using MATLAB's cohere + [cxy, f] = mscohere(a4.y, a1.y, win.win, Nfft/2, Nfft, a1.fs); + if any(abs(cxy(4:end)-out.y(4:end))>TOL), atest = false; end + if ne(f, out.x), atest = false; end + if ne(out, out, ple2), atest = false; end + % Check the data shape + if size(a4.y,1) == 1 + if size(out.y,1) ~= 1, atest = false; end + else + if size(out.y,2) ~= 1, atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_24 + + %% UTP_25 + + % + % + % Tests handling of units: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) complex coherence of the white noise series + % 4) compares the units of the input and output + % + + % + function result = utp_25 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) complex cohere of the white noise + % + % + + % + try + + % Build time-series test data + fs = 1; + nsecs = 86400; + sigma_distr_1 = 4.69e-12; + mu_distr_1 = -5.11e-14; + sigma_distr_2 = 6.04e-9; + mu_distr_2 = 1.5e-10; + + % White noise + type = 'Normal'; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_1)); + a_const = ao(mu_distr_1); + a_1 = a_n + a_const; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_2)); + a_const = ao(mu_distr_2); + a_2 = a_n + a_const; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the coherence of the time-series data + win = 'Kaiser'; + psll = utils.math.randelement([10:10:200], 1); + detrend = 0; + scale_type = 'C'; + n_pts = nsecs*fs/10; + + C = cohere(a_1, a_2, ... + plist('Win', win, 'psll', psll, 'Nfft', n_pts, 'order', detrend, 'type', scale_type)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (complex coherence yunits) equals [1] + % 2) Check that (complex coherence xunits) equals [Hz] + + % + + % + atest = true; + + if stest + if ~eq(C.yunits, unit('')) || ~eq(C.xunits, unit('Hz')) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_25 + + %% UTP_26 + + % + % + % Tests handling of units: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) complex coherence of the white noise series + % 4) compares the units of the input and output + % + + % + function result = utp_26 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) complex cohere of the white noise + % + % + + % + try + + % Build time-series test data + fs = 1; + nsecs = 86400; + sigma_distr_1 = 4.69e-12; + mu_distr_1 = -5.11e-14; + sigma_distr_2 = 6.04e-9; + mu_distr_2 = 1.5e-10; + + % White noise + type = 'Normal'; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_1)); + a_const = ao(mu_distr_1); + a_1 = a_n + a_const; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_2)); + a_const = ao(mu_distr_2); + a_2 = a_n + a_const; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the coherence of the time-series data + win = 'Kaiser'; + psll = utils.math.randelement([10:10:200], 1); + detrend = 0; + scale_type = 'C'; + n_pts = nsecs*fs/10; + + C = cohere(a_1, a_2, ... + plist('Win', win, 'psll', psll, 'Nfft', n_pts, 'order', detrend, 'type', scale_type)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (complex coherence yunits) equals [1] + % 2) Check that (complex coherence xunits) equals [Hz] + + % + + % + atest = true; + + if stest + if ~eq(C.yunits, unit('')) || ~eq(C.xunits, unit('Hz')) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_26 + + %% UTP_30 + + % + % + % Tests handling of special cases: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) the same noise series + % 3) cohere of the white noise series + % 4) compares the output to unity + % + + % + function result = utp_30 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % the same data as 1) and 2) + % 4) cohere of the series + % + % + + % + try + + % Build time-series test data + fs = 1; + nsecs = 86400; + sigma_distr_1 = 4.69e-12; + mu_distr_1 = -5.11e-14; + + % White noise + type = 'Normal'; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_1)); + a_const = ao(mu_distr_1); + a_1 = a_n + a_const; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Build the second object as a copy of the first + a_2 = a_1; + + % Evaluate the cohere of the time-series data + win = specwin('BH92'); + olap = win.rov; + detrend = 0; + n_pts = nsecs*fs/10; + scale_type = 'C'; + + C = cohere(a_1, a_2, ... + plist('Win', win, 'Nfft', n_pts, 'order', detrend, 'type', scale_type, 'olap', olap)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated cohere equals 1 + + % + + % + atest = true; + + if stest + if sum(ne(C.y, 1)) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_30 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_complex.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_complex.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,383 @@ +% UTP_AO_COMPLEX a set of UTPs for the ao/complex method +% +% M Hewitson 07-08-08 +% +% $Id: utp_ao_complex.m,v 1.9 2011/04/17 15:46:21 ingo Exp $ +% + +% +% +% The complex method of the ao class takes two input AOs and produces a +% single AO containing complex data made from the two input y vectors. +% +% + +function results = utp_ao_complex(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'complex'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Set the same y-units for the test AOs + at1.setYunits('mm'); + at2.setYunits('mm'); + at3.setYunits('mm'); + at4.setYunits('mm'); + at5.setYunits('mm'); + at6.setYunits('mm'); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % List input + + results = [results utp_05]; % Test the modify call works + + results = [results utp_06(mthd, [at1 at1], [], ple2)]; % Test history is working + + results = [results utp_07]; % Test input data shape == output data shape + + results = [results utp_11(mthd, [at1 at1], ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the complex method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the complex method works for a vector of AOs as input. + % + % + + try + % + % We need two inputs of the same length + out = complex([at5 at6]); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is 1. + % 2) Check that the output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Check the output contains complex data made from at1 + if ~isequal(complex(at5.data.getY,at6.data.getY), out.data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the complex method works with a list of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the complex method works for a list of AOs as input. + % + % + + try + % + out = complex(at5, at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is 1. + % 2) Check that the output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Check the output contains complex data made from at1 + if ~isequal(complex(at5.data.getY,at6.data.getY), out.data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the complex method properly applies history. + % + % + function result = utp_04 + + % + % + % Test that the result of applying the complex method can be processed back + % to an m-file. + % + % + + try + % + out = complex(at5, at6); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'complex'. + % 2) Check that the rebuilt object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'complex'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the complex method can not modify the input AO. + % + % + function result = utp_05 + + % + % + % Test that the complex method can not modify the input AO. + % The method must throw an error for the modifier call. + % + % + + try + % + % copy at1 to work with + a5 = ao(at5); + a6 = ao(at6); + % modify ain + aout = a5.complex(a6); + a5.complex(a6); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_07 + + % + % + % Control the method with a plist. + % + % + function result = utp_07 + + % + % + % Test that the complex method keeps the data shape of the first input object. + % the input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = complex(at5, at6); + out2 = complex(at6, at5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.x) ~= size(at5.data.x), atest = false; end + if size(out1.data.y) ~= size(at5.data.y), atest = false; end + if size(out2.data.x) ~= size(at6.data.x), atest = false; end + if size(out2.data.y) ~= size(at6.data.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_compute.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_compute.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,376 @@ +% UTP_AO_COMPUTE a set of UTPs for the ao/compute method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_compute.m,v 1.7 2010/06/07 16:43:06 ingo Exp $ +% + +% +% +% The compute method of the ao class applies the user-specified +% calculations to the input AOs. +% +% + +function results = utp_ao_compute(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'compute'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if ~io(3).plists.isparam('operations'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('operations'), 'a'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('operations'), {'a'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the complex method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the complex method works for a vector of AOs as input. + % + % + + try + % + out = compute([at1 at1], 'a(1)./a(2)'); + stest = true; + % + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is 1. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Check each output against the expected operations + if ne(out, at1./at1, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the compute method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the compute method works for a matrix of AOs as input. + % + % + + try + % + a = [at1 at1 at5; at1 at6 at4]; + out = compute(a, {'1.23 + a(1,3)./a(2,2)', 'log10(a(2,1))'}); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is 2. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 2, atest = false; end + % Check each output against the expected operations + if ne(out(1), 1.23 + a(1,3)./a(2,2), ple1), atest = false; end + if ne(out(2), log10(a(2,1)), ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the compute method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the compute method works for a list of AOs as input. + % + % + + try + % + out = compute(at1, at1, plist('Operations', {'a(1)./a(2)', 'a(1)-a(2)'})); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is 2. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 2, atest = false; end + % Check each output against the expected operations + if ne(out(1), at1./at1, ple1), atest = false; end + if ne(out(2), at1-at1, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the compute method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the compute method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = compute(at1,[at3 at1],at2,[at1 at2; at1 at3], plist('Operations', {'a(1)./a(3)', 'a(5)-a(6)'})); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is 2. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 2, atest = false; end + % Check each output against the expected operations + if ne(out(1), at1./at1, ple1), atest = false; end + if ne(out(2), at1-at1, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the compute method applies no history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the compute method can be processed back + % to an m-file. + % + % + + try + % + out = compute(at1, [at2 at1], plist('Operations', 'a(1)./a(3)')); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' is not + % 'compute'. + % 2) Check that the rebuilt object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if strcmp(out.hist.methodInfo.mname, 'compute'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_confint.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_confint.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,333 @@ +% UTP_AO_CONFINT a set of UTPs for the ao/confint method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_confint.m,v 1.2 2011/05/22 21:35:42 mauro Exp $ +% + +% +% +% The confint method of the ao class computes the confidence intervals for spectral estimate. +% +% + +function results = utp_ao_confint(varargin) + + % Check the inputs + if nargin == 0 + + addpath(fullfile(fileparts(which(mfilename)), 'reference_files')) + + % Some keywords + class = 'ao'; + mthd = 'confint'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % reference psd for rebuild + rsp = psd(at5); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % reference confs + rconf = [5.7 16.0]; + + % reference ao for dof test + plrefdata = plist('fs', 1, 'nsecs', 1024, ... + 'tsfcn', 'randn(size(t))'); + refdata = ao(plrefdata); + + + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test against reference data + results = [results utp_08]; % Test the data shape + + + 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 + + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + % + try + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + % + atest = true; + if stest + % check we have minfo objects + if isa(io, 'minfo') + + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% Default PList + if io(3).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(3).plists.isparam('method'), atest = false; end + if ~io(3).plists.isparam('DataLength'), atest = false; end + if ~io(3).plists.isparam('Conf'), atest = false; end + if ~io(3).plists.isparam('dof'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('method'), 'psd'), atest = false; end + if ~isequal(io(3).plists.find('DataLength'), paramValue.EMPTY_DOUBLE), atest = false; end + if ~isequal(io(3).plists.find('Conf'), 95), atest = false; end + if ~isequal(io(3).plists.find('dof'), paramValue.EMPTY_DOUBLE), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('method'), {'psd','lpsd','mscohere','mslcohere'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('DataLength'), {paramValue.EMPTY_DOUBLE}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('Conf'), {95}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('dof'), {paramValue.EMPTY_DOUBLE}), atest = false; end + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_06 + + % + % + % Tests that the confint method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the confint method can be processed back + % to an m-file. + % + % + + % + try + out = confint(rsp); + mout = rebuild(out); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'confint'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + % + atest = true; + if stest + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'confint'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the confint method provides correct values for spectra + % confidence intervals. + % Reference on D B Percival and A T Walden, Spectral Analysis for + % Physical Applications, pg. 299 + % + % + function result = utp_07 + + % + % + % Test that the applying psd works on a single AO. + % + % + + % + try + + plsp = plist('win','BH92','order',1,'navs',1); + axx = psd(refdata,plsp); + plconf = plist('method','psd',... + 'DataLength',numel(refdata.y),... + 'Conf',95); + cf = confint(axx,plconf); + + llcf = 10*log10(cf.objs{1}.y); + laxx = 10*log10(axx.y); + lucf = 10*log10(cf.objs{2}.y); + + dcf = [(laxx-llcf) (lucf-laxx)]; + + + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that output agrees with the reference values. + % + % + + % + atest = true; + TOL = 0.01; + + if stest + for jj=1:size(dcf,1) + if any((abs(dcf(jj,:) - rconf) ./ rconf) >= TOL) + atest = false; + end + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the confint method keeps the data shape of the input object. + % + % + function result = utp_08 + + % + % + % Test that the confint method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + aa1 = at5.psd; + aa2 = at6.psd; + out1obj = confint(aa1); + out1_1 = out1obj.getObjectAtIndex(1); + out1_2 = out1obj.getObjectAtIndex(2); + out1_3 = out1obj.getObjectAtIndex(3); + out2obj = confint(aa2); + out2_1 = out2obj.getObjectAtIndex(1); + out2_2 = out2obj.getObjectAtIndex(2); + out2_3 = out2obj.getObjectAtIndex(3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1_1.data.y,1) == 1, atest = false; end + if size(out1_2.data.y,1) == 1, atest = false; end + if size(out1_3.data.y,1) == 1, atest = false; end + if size(out2_1.data.y,2) == 2, atest = false; end + if size(out2_2.data.y,2) == 2, atest = false; end + if size(out2_3.data.y,2) == 2, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + + + + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_conj.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_conj.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,129 @@ +% UTP_AO_CONJ a set of UTPs for the ao/conj method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_conj.m,v 1.12 2011/04/17 09:50:21 hewitson Exp $ +% + +% +% +% The conj method of the ao class computes the complex conjugate value of the y +% and/or x data. +% +% + +function results = utp_ao_conj(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'conj'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple2)]; % Test the modify call works + results = [results utp_08(mthd, at1, ple2)]; % Test with additional plist with the key 'axis' + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at1, at2, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + results = [results utp_12(mthd, at1, ple1)]; % Test errors are cleared + + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(conj(in.data.getY), out.data.getY) + atest = false; + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_conv.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_conv.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,439 @@ +% UTP_AO_CONV a set of UTPs for the ao/conv method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_conv.m,v 1.5 2009/09/20 16:51:33 hewitson Exp $ +% + +% +% +% The conv method of the ao class computes the convolution of the y-data. +% +% + +function results = utp_ao_conv(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'conv'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + atmat = [at1,at2,at3;at1,at2,at3]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + + results = [results utp_11(mthd, [at1 at1], ple1)]; % Test plotinfo doesn't disappear + + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the conv method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the conv method works for a vector of AOs as input. + % + % + + try + % + out = conv(atvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one Ao with cdata. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + if ~isa(out.data, 'cdata'), atest = false; end + % Check each output against the convolution of all y-data + res = atvec(1).y; + for kk=2:numel(atvec) + res = conv(res, atvec(kk).y); + end + if ~isequal(out.y, res), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the conv method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the conv method works for a matrix of AOs as input. + % + % + + try + % + out = conv(atmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one Ao with cdata. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + if ~isa(out.data, 'cdata'), atest = false; end + % Check each output against the convolution of all y-data + res = atmat(1).y; + for kk=2:numel(atmat) + res = conv(res, atmat(kk).y); + end + if ~isequal(out.y, res), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the conv method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the conv method works for a list of AOs as input. + % + % + + try + % + out = conv(at1,at2,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one Ao with cdata. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1,at2,at3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + if ~isa(out.data, 'cdata'), atest = false; end + % Check each output against the convolution of all y-data + res = aoin(1).y; + for kk=2:numel(aoin) + res = conv(res, aoin(kk).y); + end + if ~isequal(out.y, res), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the conv method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the conv method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = conv(at1,atvec,at2,atmat,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one Ao with cdata. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1,reshape(atvec,1,[]),at2,reshape(atmat,1,[]),at3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + if ~isa(out.data, 'cdata'), atest = false; end + % Check each output against the convolution of all y-data + res = aoin(1).y; + for kk=2:numel(aoin) + res = conv(res, aoin(kk).y); + end + if ~isequal(out.y, res), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the conv method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the conv method can be processed back. + % + % + + try + % + out = conv(at1, at2); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'conv'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'conv'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % The conv method can not modify the input AO. + % + % + function result = utp_07 + + % + % + % The conv method throws an error if it is uesed as a modifier. + % + % + + try + % + % copy at1 to work with + amodi = ao(at1); + aeq = ao(at1); + out = aeq.conv(at2); + amodi.conv(at2); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_convert.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_convert.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,845 @@ +% UTP_AO_CONVERT a set of UTPs for the ao/convert method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_convert.m,v 1.10 2011/08/22 04:52:37 hewitson Exp $ +% + +% +% +% The convert method of the ao class perform various conversions on the AO. +% +% + +function results = utp_ao_convert(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'convert'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + plts = plist('tsfcn', 'randn(size(t))', 'nsecs', 10, 'fs', 1.12); + plfs = plist('f', '1:30', 'fsfcn', 'randn(size(f))'); + plxy = plist('x', '1:30', 'xyfcn', 'randn(size(x))'); + at1 = ao(plts); + at2 = ao(plfs); + at3 = ao(plxy); + at4 = ao([1 -3+5i +5 3-1i .5 -7]); + atvec = [at1, at2, at3, at4]; + atmat = [at1, at2, at3; at4, at3, at2]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with additional plist with the key 'axis' + results = [results utp_09]; % Test input data shape == output data shape + results = [results utp_10]; % Test output of the data + + results = [results utp_11(mthd, [at1 at1], ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if ~io(3).plists.isparam('action'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('action')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('action'), {'', 's to Hz', 'Hz to s', 'to cdata', 'to tsdata', 'to fsdata', 'to xydata'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the convert method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the convert method works for a vector of AOs as input. + % + % + + try + % + aa = atvec.setYunits('Hz^2 Hz^-1/2 mm mHz'); + out1 = convert(aa, 'Hz to s'); + aa = atvec.setYunits('kV s^2 mm s^-1/2 ms'); + out2 = convert(aa, 's to Hz'); + out3 = convert(atvec, 'to cdata'); + out4 = convert(atvec, 'to tsdata'); + out5 = convert(atvec, 'to fsdata'); + out6 = convert(atvec, 'to xydata'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-15; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(atvec)), atest = false; end + if ~isequal(size(out2), size(atvec)), atest = false; end + if ~isequal(size(out3), size(atvec)), atest = false; end + if ~isequal(size(out4), size(atvec)), atest = false; end + if ~isequal(size(out5), size(atvec)), atest = false; end + if ~isequal(size(out6), size(atvec)), atest = false; end + % Check that 'out1' have the correct y units. + u_ref = unit('s^-2 s^1/2 mm ks^-1'); + for kk=1:numel(out1) + if ~eq(out1(kk).yunits, u_ref), atest = false; end + end + % Check that 'out2' have the correct y units. + u_ref = unit('kV Hz^-2 mm Hz^1/2 kHz^-1'); + for kk=1:numel(out2) + if ~eq(out2(kk).yunits, u_ref), atest = false; end + end + % Check that 'out3' have the correct data (cdata) + for kk=1:numel(out3) + if ~isa(out3(kk).data, 'cdata'), atest = false; end + if ~isequal(out3(kk).y, atvec(kk).y), atest = false; end + end + % Check that 'out4' have the correct data (tsdata) + for kk=1:numel(out4) + if ~isa(out4(kk).data, 'tsdata'), atest = false; end + if ~isa(atvec(kk).data, 'cdata') + if ~all(abs(out4(kk).x-atvec(kk).x) < TOL), atest = false; end + end + if ~isequal(out4(kk).y, atvec(kk).y), atest = false; end + end + % Check that 'out5' have the correct data (fsdata) + for kk=1:numel(out5) + if ~isa(out5(kk).data, 'fsdata'), atest = false; end + if ~isa(atvec(kk).data, 'cdata') + if ~isequal(out5(kk).x , atvec(kk).x), atest = false; end + end + if ~isequal(out5(kk).y, atvec(kk).y), atest = false; end + end + % Check that 'out6' have the correct data (xydata) + for kk=1:numel(out6) + if ~isa(out6(kk).data, 'xydata'), atest = false; end + if ~isa(atvec(kk).data, 'cdata') + if ~isequal(out6(kk).x , atvec(kk).x), atest = false; end + end + if ~isequal(out6(kk).y, atvec(kk).y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the convert method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the convert method works for a matrix of AOs as input. + % + % + + try + % + aa = atmat.setYunits('Hz^2 Hz^-1/2 mm mHz'); + out1 = convert(aa, 'Hz to s'); + aa = atmat.setYunits('kV s^2 mm s^-1/2 ms'); + out2 = convert(aa, 's to Hz'); + out3 = convert(atmat, 'to cdata'); + out4 = convert(atmat, 'to tsdata'); + out5 = convert(atmat, 'to fsdata'); + out6 = convert(atmat, 'to xydata'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-15; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(atmat)), atest = false; end + if ~isequal(size(out2), size(atmat)), atest = false; end + if ~isequal(size(out3), size(atmat)), atest = false; end + if ~isequal(size(out4), size(atmat)), atest = false; end + if ~isequal(size(out5), size(atmat)), atest = false; end + if ~isequal(size(out6), size(atmat)), atest = false; end + % Check that 'out1' have the correct y units. + u_ref = unit('s^-2 s^1/2 mm ks^-1'); + for kk=1:numel(out1) + if ~eq(out1(kk).yunits, u_ref), atest = false; end + end + % Check that 'out2' have the correct y units. + u_ref = unit('kV Hz^-2 mm Hz^1/2 kHz^-1'); + for kk=1:numel(out2) + if ~eq(out2(kk).yunits, u_ref), atest = false; end + end + % Check that 'out3' have the correct data (cdata) + for kk=1:numel(out3) + if ~isa(out3(kk).data, 'cdata'), atest = flase; end + if ~isequal(out3(kk).y, atmat(kk).y), atest = false; end + end + % Check that 'out4' have the correct data (tsdata) + for kk=1:numel(out4) + if ~isa(out4(kk).data, 'tsdata'), atest = flase; end + if ~isa(atmat(kk).data, 'cdata') + if ~all(abs(out4(kk).x - atmat(kk).x) < TOL), atest = false; end + end + if ~isequal(out4(kk).y, atmat(kk).y), atest = false; end + end + % Check that 'out5' have the correct data (fsdata) + for kk=1:numel(out5) + if ~isa(out5(kk).data, 'fsdata'), atest = flase; end + if ~isa(atmat(kk).data, 'cdata') + if ~isequal(out5(kk).x , atmat(kk).x), atest = false; end + end + if ~isequal(out5(kk).y, atmat(kk).y), atest = false; end + end + % Check that 'out6' have the correct data (xydata) + for kk=1:numel(out6) + if ~isa(out6(kk).data, 'xydata'), atest = flase; end + if ~isa(atmat(kk).data, 'cdata') + if ~isequal(out6(kk).x , atmat(kk).x), atest = false; end + end + if ~isequal(out6(kk).y, atmat(kk).y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the convert method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Tests that the convert method works with a list of AOs as input. + % + % + + try + % + a1 = at1.setYunits('Hz^2 Hz^-1/2 mm mHz'); + a2 = at2.setYunits('Hz^2 Hz^-1/2 mm mHz'); + a3 = at3.setYunits('Hz^2 Hz^-1/2 mm mHz'); + out1 = convert(a1, a2, a3, 'Hz to s'); + a1 = at1.setYunits('kV s^2 mm s^-1/2 ms'); + a2 = at2.setYunits('kV s^2 mm s^-1/2 ms'); + a3 = at3.setYunits('kV s^2 mm s^-1/2 ms'); + out2 = convert(a1, a2, a3, 's to Hz'); + out3 = convert(at1, at2, at3, 'to cdata'); + out4 = convert(at1, at2, at3, 'to tsdata'); + out5 = convert(at1, at2, at3, 'to fsdata'); + out6 = convert(at1, at2, at3, 'to xydata'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, at2, at3]; + TOL = 1e-15; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(aoin)), atest = false; end + if ~isequal(size(out2), size(aoin)), atest = false; end + if ~isequal(size(out3), size(aoin)), atest = false; end + if ~isequal(size(out4), size(aoin)), atest = false; end + if ~isequal(size(out5), size(aoin)), atest = false; end + if ~isequal(size(out6), size(aoin)), atest = false; end + % Check that 'out1' have the correct y units. + u_ref = unit('s^-2 s^1/2 mm ks^-1'); + for kk=1:numel(out1) + if ~eq(out1(kk).yunits, u_ref), atest = false; end + end + % Check that 'out2' have the correct y units. + u_ref = unit('kV Hz^-2 mm Hz^1/2 kHz^-1'); + for kk=1:numel(out2) + if ~eq(out2(kk).yunits, u_ref), atest = false; end + end + % Check that 'out3' have the correct data (cdata) + for kk=1:numel(out3) + if ~isa(out3(kk).data, 'cdata'), atest = flase; end + if ~isequal(out3(kk).y, aoin(kk).y), atest = false; end + end + % Check that 'out4' have the correct data (tsdata) + for kk=1:numel(out4) + if ~isa(out4(kk).data, 'tsdata'), atest = flase; end + if ~isa(aoin(kk).data, 'cdata') + if ~all(abs(out4(kk).x - aoin(kk).x) < TOL), atest = false; end + end + if ~isequal(out4(kk).y, aoin(kk).y), atest = false; end + end + % Check that 'out5' have the correct data (fsdata) + for kk=1:numel(out5) + if ~isa(out5(kk).data, 'fsdata'), atest = flase; end + if ~isa(aoin(kk).data, 'cdata') + if ~isequal(out5(kk).x , aoin(kk).x), atest = false; end + end + if ~isequal(out5(kk).y, aoin(kk).y), atest = false; end + end + % Check that 'out6' have the correct data (xydata) + for kk=1:numel(out6) + if ~isa(out6(kk).data, 'xydata'), atest = flase; end + if ~isa(aoin(kk).data, 'cdata') + if ~isequal(out6(kk).x , aoin(kk).x), atest = false; end + end + if ~isequal(out6(kk).y, aoin(kk).y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the convert method works with a mix of different shaped AOs + % as input. + % + % + function result = utp_05 + + % + % + % Tests that the convert method works with a mix of different shaped AOs as + % input. + % + % + + try + % + a1 = at1.setYunits('Hz^2 Hz^-1/2 mm mHz'); + a2 = at2.setYunits('Hz^2 Hz^-1/2 mm mHz'); + a3 = at3.setYunits('Hz^2 Hz^-1/2 mm mHz'); + aa = atmat.setYunits('Hz^2 Hz^-1/2 mm mHz'); + out1 = convert(a1, a2, aa, a3, 'Hz to s'); + a1 = at1.setYunits('kV s^2 mm s^-1/2 ms'); + a2 = at2.setYunits('kV s^2 mm s^-1/2 ms'); + a3 = at3.setYunits('kV s^2 mm s^-1/2 ms'); + aa = atmat.setYunits('kV s^2 mm s^-1/2 ms'); + out2 = convert(a1, a2, aa, a3, 's to Hz'); + out3 = convert(at1, at2, atmat, at3, 'to cdata'); + out4 = convert(at1, at2, atmat, at3, 'to tsdata'); + out5 = convert(at1, at2, atmat, at3, 'to fsdata'); + out6 = convert(at1, at2, atmat, at3, 'to xydata'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, at2, reshape(atmat, 1, []), at3]; + TOL = 1e-15; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(aoin)), atest = false; end + if ~isequal(size(out2), size(aoin)), atest = false; end + if ~isequal(size(out3), size(aoin)), atest = false; end + if ~isequal(size(out4), size(aoin)), atest = false; end + if ~isequal(size(out5), size(aoin)), atest = false; end + if ~isequal(size(out6), size(aoin)), atest = false; end + % Check that 'out1' have the correct y units. + u_ref = unit('s^-2 s^1/2 mm ks^-1'); + for kk=1:numel(out1) + if ~eq(out1(kk).yunits, u_ref), atest = false; end + end + % Check that 'out2' have the correct y units. + u_ref = unit('kV Hz^-2 mm Hz^1/2 kHz^-1'); + for kk=1:numel(out2) + if ~eq(out2(kk).yunits, u_ref), atest = false; end + end + % Check that 'out3' have the correct data (cdata) + for kk=1:numel(out3) + if ~isa(out3(kk).data, 'cdata'), atest = flase; end + if ~isequal(out3(kk).y, aoin(kk).y), atest = false; end + end + % Check that 'out4' have the correct data (tsdata) + for kk=1:numel(out4) + if ~isa(out4(kk).data, 'tsdata'), atest = flase; end + if ~isa(aoin(kk).data, 'cdata') + if ~all(abs(out4(kk).x - aoin(kk).x) < TOL), atest = false; end + end + if ~isequal(out4(kk).y, aoin(kk).y), atest = false; end + end + % Check that 'out5' have the correct data (fsdata) + for kk=1:numel(out5) + if ~isa(out5(kk).data, 'fsdata'), atest = flase; end + if ~isa(aoin(kk).data, 'cdata') + if ~isequal(out5(kk).x , aoin(kk).x), atest = false; end + end + if ~isequal(out5(kk).y, aoin(kk).y), atest = false; end + end + % Check that 'out6' have the correct data (xydata) + for kk=1:numel(out6) + if ~isa(out6(kk).data, 'xydata'), atest = flase; end + if ~isa(aoin(kk).data, 'cdata') + if ~isequal(out6(kk).x , aoin(kk).x), atest = false; end + end + if ~isequal(out6(kk).y, aoin(kk).y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the convert method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the convert method can be processed back. + % + % + + try + % + out = convert(at1, 'to fsdata'); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'convert'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'convert'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the convert method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the convert method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at1 to work with + amodi = ao(at1); + aeq = ao(at1); + out = aeq.convert('to xydata'); + amodi.convert('to xydata'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'out' and 'aeq' are now different. + % 2) Check that 'aeq' is not changed + % 3) Check that the modified input is the convert value of the copy + % 4) Check that out and amodi are the same + % + % + + atest = true; + if stest + % + % Check that 'out' and 'aeq' are now different. + if eq(out, aeq, ple2), atest = false; end + % Check that 'aeq' is not changed + if ~eq(aeq, ao(at1), ple1), atest = false; end + % Check that the modified input is the converted object of the copy + if ~isa(amodi.data, 'xydata'), atest = false; end + % Check that out and amodi are the same + if ~eq(out, amodi, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the convert method can modify the input object depending + % to the plist. + % + % + + try + % + pl1 = plist('action', 'Hz to s'); + pl2 = plist('action', 's to Hz'); + pl3 = plist('action', 'to tsdata'); + pl4 = plist('action', 'to fsdata'); + pl5 = plist('action', 'to cdata'); + pl6 = plist('action', 'to xydata'); + aa = ao(at1); + aa.setYunits('Hz'); + out1 = convert(aa, pl1); + aa = ao(at1); + aa.setYunits('s'); + out2 = convert(aa, pl2); + out3 = convert(at1, pl3); + out4 = convert(at1, pl4); + out5 = convert(at1, pl5); + out6 = convert(at1, pl6); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + mout5 = rebuild(out5); + mout6 = rebuild(out6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the convert method aplpiesthe different actions + % 4) Check that the rebuilt objects are the same as 'out[1..6]'. + % + % + + atest = true; + if stest + % + % Check each output + if ~eq(out1.yunits, unit('s^-1')), atest = false; end + if ~eq(out2.yunits, unit('Hz^-1')), atest = false; end + if ~isa(out3.data, 'tsdata'), atest = false; end + if ~isequal(out3.y, at1.y), atest = false; end + if ~isa(out4.data, 'fsdata'), atest = false; end + if ~isequal(out4.y, at1.y), atest = false; end + if ~isa(out5.data, 'cdata'), atest = false; end + if ~isequal(out5.y, at1.y), atest = false; end + if ~isa(out6.data, 'xydata'), atest = false; end + if ~isequal(out6.y, at1.y), atest = false; end + % Run 'test[1..3].m' and check the result + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + if ~eq(mout4, out4, ple2), atest = false; end + if ~eq(mout5, out5, ple2), atest = false; end + if ~eq(mout6, out6, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test the shape of the output. + % + % + function result = utp_09 + + % + % + % Test that the convert method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + aocol = ao(at1); + aorow = at1.'; + out1 = convert(aocol, 'to fsdata'); + out2 = convert(aorow, 'to fsdata'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,2) ~= 1, atest = false; end + if size(out2.data.y,1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the convert method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_10 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = convert(at1, at2, 'to cdata'); + o3 = convert(at1, at2, 'to cdata'); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_copy.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_copy.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,51 @@ +% UTP_AO_COPY a set of UTPs for the ao/copy method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_copy.m,v 1.3 2009/08/08 12:21:40 hewitson Exp $ +% + +% +% +% The copy method of the ao class copies the input object depending of the +% second input. +% +% + +function results = utp_ao_copy(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'copy'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_69(class, 1, 1, ple2)]; + results = [results utp_69(class, 1, 3, ple2)]; + results = [results utp_69(class, 2, 3, ple2)]; + + 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 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_cos.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_cos.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,127 @@ +% UTP_AO_COS a set of UTPs for the ao/cos method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_cos.m,v 1.13 2011/04/17 09:50:21 hewitson Exp $ +% + +% +% +% The cos method of the ao class computes the cosine of the y +% and/or x data. +% +% + +function results = utp_ao_cos(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'cos'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple2)]; % Test the modify call works + results = [results utp_08(mthd, at1, ple2)]; % Test with additional plist with the key 'axis' + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at1, at2, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(cos(in.data.getY), out.data.getY) + atest = false; + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_cov.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_cov.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,460 @@ +% UTP_AO_COV a set of UTPs for the ao/cov method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_cov.m,v 1.4 2009/08/07 10:05:39 hewitson Exp $ +% + +% +% +% The cov method of the ao class computes estimate covariance of data +% streams. +% +% + +function results = utp_ao_cov(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'cov'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + plts = plist('fs', '1', 'nsecs', 30, 'tsfcn', 'randn(size(t))'); + plfs = plist('f', '1:30', 'fsfcn', 'randn(size(f))'); + plxy = plist('x', '1:30', 'xyfcn', 'randn(size(x))'); + at1 = ao(plts); + at1.setYunits('Hz^2'); + at2 = ao(plfs); + at2.setYunits('Hz^-1'); + at3 = ao(plxy); + at3.setYunits('km'); + atvec = [at1, at2, at3]; + atmat = [at1, at2, at3; at3, at2, at1]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + + results = [results utp_11(mthd, [at1 at1], ple1)]; % Test plotinfo doesn't disappear + + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the cov method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the cov method works for a vector of AOs as input. + % + % + + try + % + out = cov(atvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one Ao with cdata. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + if ~isa(out.data, 'cdata'), atest = false; end + % Check output data / units + res = []; + u = unit(); + for kk=1:numel(atvec) + res = [res atvec(kk).y]; + u = u * atvec(kk).yunits; + end + if ~eq(u, out.yunits), atest = false; end + if ~isequal(cov(res), out.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the cov method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the cov method works for a matrix of AOs as input. + % + % + + try + % + out = cov(atmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one Ao with cdata. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + if ~isa(out.data, 'cdata'), atest = false; end + % Check output data / units + res = []; + u = unit(); + for kk=1:numel(atmat) + res = [res atmat(kk).y]; + u = u * atmat(kk).yunits; + end + if ~eq(u, out.yunits), atest = false; end + if ~isequal(cov(res), out.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the cov method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Tests that the cov method works with a list of AOs as input. + % + % + + try + % + out = cov(at1, at2, at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one Ao with cdata. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, at2, at3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + if ~isa(out.data, 'cdata'), atest = false; end + % Check output data / units + res = []; + u = unit(); + for kk=1:numel(aoin) + res = [res aoin(kk).y]; + u = u * aoin(kk).yunits; + end + if ~eq(u, out.yunits), atest = false; end + if ~isequal(cov(res), out.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the cov method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Tests that the cov method works with a mix of different shaped AOs as + % input. + % + % + + try + % + out = cov(at1, atmat, at2, atvec, at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one Ao with cdata. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, reshape(atmat, 1, []), at2, reshape(atvec, 1, []), at3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + if ~isa(out.data, 'cdata'), atest = false; end + % Check output data / units + res = []; + u = unit(); + for kk=1:numel(aoin) + res = [res aoin(kk).y]; + u = u * aoin(kk).yunits; + end + if ~eq(u, out.yunits), atest = false; end + if ~isequal(cov(res), out.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the cov method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the cov method can be processed back. + % + % + + try + % + out = cov(at1, at2, at3); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'cov'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'cov'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % The cov method can not modify the input AO. + % + % + function result = utp_07 + + % + % + % The cov method can not modify the input AO. + % + % + + try + % + % copy at1 to work with + amodi = ao(at1); + aeq = ao(at1); + out = aeq.cov(); + amodi.abs(); + stest = false; + % + catch err + stest = true; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_cpsd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_cpsd.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,1291 @@ +% UTP_AO_CPSD a set of UTPs for the ao/cpsd method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_cpsd.m,v 1.43 2011/07/22 11:51:46 mauro Exp $ +% + +% +% +% The cpsd method of the ao class computes the cross-spectral density between two +% time-series AOs. +% +% + +function results = utp_ao_cpsd(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'cpsd'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Get default window from the preferences + prefs = getappdata(0, 'LTPDApreferences'); + defaultWinType = char(prefs.getMiscPrefs.getDefaultWindow); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input (only with two objects) + results = [results utp_03]; % Matrix input (not possible) + results = [results utp_04]; % List input (only with two objects) + results = [results utp_05]; % Test with mixed input (not possible) + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test against MATLAB's cpsd() + + results = [results utp_11(mthd, [at1 at1], ple1)]; % Test plotinfo doesn't disappear + + results = [results utp_17]; % Test units handling: CPSD + results = [results utp_18]; % Comparison with PSD + results = [results utp_24]; % Test data lengths + results = [results utp_25]; % Test Kaiser win and olap: CPSD + results = [results utp_51]; % Test number of averages: requested/obtained + results = [results utp_52]; % Test number of averages: correct number + results = [results utp_53]; % Test number of averages: syntax + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 8, atest = false; end + % Check key + if ~io(3).plists.isparam('nfft'), atest = false; end + if ~io(3).plists.isparam('win'), atest = false; end + if ~io(3).plists.isparam('olap'), atest = false; end + if ~io(3).plists.isparam('order'), atest = false; end + if ~io(3).plists.isparam('navs'), atest = false; end + if ~io(3).plists.isparam('times'), atest = false; end + if ~io(3).plists.isparam('split'), atest = false; end + if ~io(3).plists.isparam('psll'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('nfft'), -1), atest = false; end + if ~strcmpi(io(3).plists.find('win'), defaultWinType), atest = false; end + if ~isequal(io(3).plists.find('olap'), -1), atest = false; end + if ~isequal(io(3).plists.find('order'), 0), atest = false; end + if ~isequal(io(3).plists.find('navs'), -1), atest = false; end + if ~isEmptyDouble(io(3).plists.find('times')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('split')), atest = false; end + if ~isequal(io(3).plists.find('psll'), 200), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('nfft'), {-1}), atest = false; disp('1'); end + if ~isequal(io(3).plists.getOptionsForParam('win'), specwin.getTypes), atest = false;disp('2'); end + if ~isequal(io(3).plists.getOptionsForParam('olap'), {-1}), atest = false; disp('3');end + if ~isequal(io(3).plists.getOptionsForParam('order'), {-1 0 1 2 3 4 5 6 7 8 9}), atest = false;disp('4'); end + if ~isequal(io(3).plists.getOptionsForParam('navs'), {-1}), atest = false;disp('5'); end + if ~isequal(io(3).plists.getOptionsForParam('times'), {[]}), atest = false;disp('6'); end + if ~isequal(io(3).plists.getOptionsForParam('split'), {[]}), atest = false;disp('6'); end + if ~isequal(io(3).plists.getOptionsForParam('psll'), {200}), atest = false;disp('7'); end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the cpsd method works with a vector of AOs as input. (only + % with two objects in the vector) + % + % + function result = utp_02 + + % + % + % Test that the cpsd method works for a vector of AOs as input. + % + % + + try + % + avec = [at1 at5]; + out = cpsd(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is equal to 1 + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the cpsd method doesn't work with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the cpsd method doesn't work for a matrix of AOs as input. + % + % + + try + % + amat = [at1 at5 at6; at5 at6 at1]; + out = cpsd(amat); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the cpsd method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the cpsd method works for a list of AOs as input. + % + % + + try + % + out = cpsd(at1,at5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is equal to 1 + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the cpsd method doesn't work with a mix of different shaped + % AOs as input. + % + % + function result = utp_05 + + % + % + % Test that the cpsd method doesn't work with an input of matrices and + % vectors and single AOs. + % + % + + try + % + out = cpsd([at5 at6],[at5 at1; at6 at1],at6); + stest = false; + % + catch err + stest = true; + end + + % + % + % 1) Nothing to check + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the cpsd method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the cpsd method can be processed back + % to an m-file. + % + % + + try + % + out = cpsd(at5,at6); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'cpsd'. + % 2) Check that the re-built object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'cpsd'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the cpsd method can not modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the cpsd method can not modify the input AO. + % The method must throw an error for the modifier call. + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + ain.cpsd(at5); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the cpsd method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = cpsd(at5, at6); + out2 = cpsd(at6, at5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y, 2) ~= 1, atest = false; end + if size(out2.data.y, 1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the cpsd method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % This test is not longer necessary because the cpsd method pass back + % always only one object. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Tests that the cpsd method agrees with MATLAB's cpsd when + % configured to use the same parameters. + % + % + function result = utp_10 + + % + % + % Test that applying cpsd works on two AOs. + % + % + + try + % + % Construct two test AOs + nsecs = 10; + fs = 1000; + pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'randn(size(t))'); + a1 = ao(pl); a2 = ao(pl); + % Filter one time-series + f2 = miir(plist('type', 'bandpass', 'fs', fs, 'order', 3, 'fc', [50 250])); + a1f = filter(a1, plist('filter', f2)); + % make some cross-power + a4 = a1f+a2; a4.setName; + % Compute cpsd + Nfft = 2*fs; + win = specwin('Hanning', Nfft); + pl = plist('Nfft', Nfft, 'Win', win.type, 'order', -1); + out = cpsd(a4,a1,pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that output agrees with the output of MATLAB's cpsd. + % + % + + atest = true; + if stest + % + % Compute cpsd using MATLAB's cpsd + [cxy, f] = cpsd(a4.data.y, a1.data.y, win.win, Nfft/2, Nfft, a1.data.fs); + if ~utils.math.isequal(cxy(:), out.data.y(:)) || ~utils.math.isequal(f, out.data.getX), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + + %% UTP_17 + + % + % + % Tests handling of units: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) CPSD of the white noise series + % 4) compares the units of the input and output + % + + % + function result = utp_17 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) CPSD of the white noise + % + % + + % + try + + noise_type = 'Normal'; + win_type = 'BH92'; + + [a_1, a_2, spec, spec1] = prepare_analyze_noise(win_type, noise_type, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (calculated CPSD yunits) equals + % input_1 units*input_2 units/Hz + % + % + + % + atest = true; + u = simplifyYunits(a_1.* a_2, plist('prefixes', false, 'exceptions', 'Hz')); + if stest + if ne(spec.Cxy.yunits, u.yunits * unit('Hz^-1')) || ne(spec.Cxy.xunits, unit('Hz')) + atest = false; + end + if ne(spec.Cyx.yunits, u.yunits * unit('Hz^-1')) || ne(spec.Cyx.xunits, unit('Hz')) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_17 + + %% UTP_18 + + % + % + % Tests handling of units: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) CPSD of the white noise series + % + % Comparison with PSD: + % 4) compares the off-diagonal terms to check they are complex-conjugated + % 5) compares the diagonal terms with PSD of the individual noise + % + + % + function result = utp_18 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) CPSD of the white noise + % 6) PSD of the white noise + % + % + + % + try + + noise_type = 'Uniform'; + win_type = 'BH92'; + + [a_1, a_2, spec, spec2] = prepare_analyze_noise(win_type, noise_type, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that CPSD(x,y) equals conj(CPSD(y,x)) + % 2) Check that CPSD(x,x) equals PSD(x) + % 3) Check that CPSD(y,y) equals PSD(y) + % + % + + % + atest = true; + + if stest + if ne(spec.Cxy.y, conj(spec.Cyx.y)), atest = false; end + if ne(spec.Cxy.x, spec.Cyx.x), atest = false; end + if ne(spec.Cxx.data, spec.S_1.data), atest = false; end + if ne(spec.Cyy.data, spec.S_2.data), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_18 + + + %% UTP_24 + + % + % + % Tests that differently sized data sets are treated properly + % + % + function result = utp_24 + + % + % + % Test that applying cpsd works on two AOs. + % + % + + try + % + % Construct two test AOs + nsecs = [10000:1:20000]; + fs = 1; + pl = plist('fs', fs, 'tsfcn', 'randn(size(t))'); + a1 = ao(pl.pset('nsecs', utils.math.randelement(nsecs, 1))); + a2 = ao(pl.pset('nsecs', utils.math.randelement(nsecs, 1))); + len_1 = a1.len; + len_2 = a2.len; + % Filter one time-series + f2 = miir(plist('type', 'bandpass', 'fs', fs, 'order', 3, 'fc', [.050 .25])); + a1f = filter(a1, plist('filter', f2)); + % Compute cpsd + Nfft = -1; + win = 'Hanning'; + pl = plist('Nfft', Nfft, 'Win', win, 'order', -1); + out = cpsd(a2,a1f,pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that cpsd used the length of the shortest ao. + % + % + + atest = true; + if stest + % + % Compare the nfft with the length of the input data + + if out.x(2) ~= 1/min(len_1,len_2) + atest = false; + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_24 + + %% UTP_25 + + % + % + % Tests handling of units: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) CPSD of the white noise series + % 4) compares the units of the input and output + % + + % + function result = utp_25 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) CPSD of the white noise + % + % + + % + try + + % Build time-series test data + fs = 1; + nsecs = 86400; + sigma_distr_1 = 4.69e-12; + mu_distr_1 = -5.11e-14; + sigma_distr_2 = 6.04e-9; + mu_distr_2 = 1.5e-10; + + % White noise + type = 'Normal'; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_1)); + a_const = ao(mu_distr_1); + a_1 = a_n + a_const; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_2)); + a_const = ao(mu_distr_2); + a_2 = a_n + a_const; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the cpsd of the time-series data, using Kaiser window + % Psll and olap are not set + win = ('Kaiser'); + detrend = 0; + n_pts = nsecs*fs/10; + + C = cpsd(a_1, a_2, plist('Win', win, 'Nfft', n_pts, 'order', detrend)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (calculated CPSD yunits) equals + %input_1 units*input_2 units/Hz + + % + + % + atest = true; + u = simplifyYunits(a_1.* a_2, plist('prefixes', false, 'exceptions', 'Hz')); + if stest + if ne(C.yunits, u.yunits * unit('Hz^-1')) || ne(C.xunits, unit('Hz')) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_25 + + %% UTP_51 + + % + % + % Tests the possibility to set the number of averages rather than setting the Nfft: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) cpsd of the noise, without detrending, random window, set number of + % averages + % 3) check the effective number of averages + % + + % + function result = utp_51 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) cpsd of the noise, without detrending, random window, set number of + % averages + % + % + + % + try + + noise_type = 'Normal'; + + % Evaluate the cpsd of the white noise time-series data + [a_1, a_2, C1, C2, navs] = prepare_analyze_noise_navs(noise_type, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated navs are identical to those requested + % + % + + % + atest = true; + + if stest + if ne(navs, C1.data.navs) + if ne(find(C1.hist.plistUsed, 'navs'), C1.data.navs) + atest = false; + end + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_51 + + %% UTP_52 + + % + % + % Tests the possibility to set the number of averages rather than setting the Nfft: + % 1) white noise produced from uniform pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) cpsd of the noise, without detrending, random window, random navs + % 3) get the number of averages + % 4) get the nfft used + % 5) run cpsd again, with the nfft used + % 6) compare the calculated objects + % + + % + function result = utp_52 + + % + % + % 1) white noise produced from uniform pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) cpsd of the noise, without detrending, random window, random navs + % 3) get the number of averages + % 4) get the nfft used + % 5) run cpsd again, with the nfft used + % + % + + % + try + + noise_type = 'Uniform'; + + % Evaluate the cpsd of the white noise time-series data + [a_1, a_2, C1, C2, navs] = prepare_analyze_noise_navs(noise_type, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated objects C1 and C2 are identical + % + % + + % + atest = true; + + if stest + % Compare the output objects + if ne(C1, C2, ple3) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_52 + + %% UTP_53 + + % + % + % Tests the possibility to set the number of averages rather than setting the Nfft: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) cpsd of the noise, without detrending, random window, random navs + % 3) get the number of averages + % 4) get the nfft used + % 5) run cpsd again, with the nfft used + % 6) compare navs, nfft, psds + % + + % + function result = utp_53 + + % + % + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) cpsd of the noise, without detrending, random window, random navs + % 3) get the number of averages + % 4) get the nfft used + % 5) run cpsd again, with the nfft used + % 6) run cpsd again, with conflicting parameters, and verify it uses + % nfft rather than navs + % + % + + % + try + + noise_type = 'Uniform'; + + % Evaluate the cpsd of the white noise time-series data + [a_1, a_2, C1, C2, navs] = prepare_analyze_noise_navs(noise_type, plist); + + npts_3 = fix(find(C1.hist.plistUsed, 'Nfft')/2); + + % Calculates the cpsd asking for the number of points AND the window length + pl_spec = C1.hist.plistUsed; + pl_spec.pset('Nfft', npts_3, 'navs', navs); + C3 = cpsd(a_1, a_2, pl_spec); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated objects C1 and C2 are identical + % 2) Check that C3 used different values + % + % + + % + atest = true; + + if stest + % Compare the navs written in the output object with the requested one + if ne(C1,C2,ple3) || ... + ne(find(C3.hist.plistUsed, 'Nfft'), npts_3) || eq(C3.data.navs, navs) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_53 + + %% Helper function for window call construction + + function [a_1, a_2, spec1, spec2] = prepare_analyze_noise(win_type, noise_type, pli) + % Array of parameters to pick from + fs_list = [0.1;1;2;5;10]; + nsecs_list = [20 100 1000:1000:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + trend_0_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr_1 = utils.math.randelement(sigma_distr_list, 1); + sigma_distr_2 = utils.math.randelement(sigma_distr_list, 1); + trend_0_1 = utils.math.randelement(trend_0_list, 1); + trend_0_2 = utils.math.randelement(trend_0_list, 1); + + % Pick units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + + % White noise + a_n = ao(plist('waveform', 'noise', ... + 'type', noise_type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_1)); + + % Constant signal + a_c = ao(trend_0_1); + + % Total signal + a_1 = a_n + a_c; + + % White noise + a_n = ao(plist('waveform', 'noise', ... + 'type', noise_type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_2)); + % Constant signal + a_c = ao(trend_0_2); + + % Total signal + a_2 = a_n + a_c; + + % Set units + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the cpsd of the white noise time-series data + olap = 0; + detrend_order = 0; + + switch lower(win_type) + case 'kaiser' + psll = find(pli, 'psll'); + if isempty(psll) + psll = find(ao.getInfo('psd').plists, 'psll'); + end + pl_spec = plist('Win', win_type, 'psll', psll, 'olap', olap, 'order', detrend_order); + + case 'levelledhanning' + levelCoef = find(pli, 'levelCoef'); + if isempty(levelCoef) + levelCoef = 1; + end + pl_spec = plist('Win', win_type, 'levelCoef', levelCoef, 'olap', olap, 'order', detrend_order); + + otherwise + pl_spec = plist('Win', win_type, 'olap', olap, 'order', detrend_order); + + end + + if find(pli, 'win_obj') + % Calls the cpsd applying the detrend and window internally + % (passig window object) + spec2.pl = pl_spec; + spec2.Cxy = cpsd(a_1, a_2, spec2.pl); + spec2.Cyx = cpsd(a_2, a_1, spec2.pl); + spec2.Cxx = cpsd(a_1, a_1, spec2.pl); + spec2.Cyy = cpsd(a_2, a_2, spec2.pl); + spec2.S_1 = simplifyYunits(psd(a_1, spec2.pl), ... + plist('prefixes', false, 'exceptions','Hz')); + spec2.S_2 = simplifyYunits(psd(a_2, spec2.pl), ... + plist('prefixes', false, 'exceptions','Hz')); + else + spec2 = struct; + end + % Calls the cpsd applying the detrend and window internally + % (passig window name) + spec1.pl = pl_spec.pset('Win', win_type); + spec1.Cxy = cpsd(a_1, a_2, spec1.pl); + spec1.Cyx = cpsd(a_2, a_1, spec1.pl); + spec1.Cxx = cpsd(a_1, a_1, spec1.pl); + spec1.Cyy = cpsd(a_2, a_2, spec1.pl); + spec1.S_1 = simplifyYunits(psd(a_1, spec1.pl), ... + plist('prefixes', false, 'exceptions','Hz')); + spec1.S_2 = simplifyYunits(psd(a_2, spec1.pl), ... + plist('prefixes', false, 'exceptions','Hz')); + + end + + %% Helper function for window call construction, navs option + + function [a_1, a_2, C1, C2, navs] = prepare_analyze_noise_navs(noise_type, pli) + % Array of parameters to pick from + fs_list = [0.1;1;2;5;10]; + nsecs_list = [2000:1000:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + trend_0_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + trend_0 = utils.math.randelement(trend_0_list, 1); + + % Pick units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + + % White noise + a_n1 = ao(plist('waveform', 'noise', ... + 'type', noise_type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_n2 = ao(plist('waveform', 'noise', ... + 'type', noise_type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + + % Constant signal + a_c = ao(trend_0); + + % Total signals + a_1 = a_n1 + a_c; + a_2 = a_n2 + a_c; + + % Set units + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the cpsd of the white noise time-series data + olap = 0; + detrend_order = 0; + n_pts = -1; + + navs = fix(utils.math.randelement(logspace(0,log10(max(0,a_1.len/10)),50),1)); + + % Evaluate the cpsd of the white noise time-series data + % Window + win_list = specwin.getTypes; + win_type = utils.math.randelement(win_list(~strcmpi(win_list, 'levelledhanning')), 1); + win_type = win_type{1}; + + switch lower(win_type) + case 'kaiser' + psll = utils.math.randelement([0:10:200],1); + if psll == 0 + psll = find(ao.getInfo('psd').plists, 'psll'); + end + pl_spec = plist('Win', win_type, 'psll', psll, 'olap', olap, 'order', detrend_order); + otherwise + pl_spec = plist('Win', win_type, 'olap', olap, 'order', detrend_order); + end + + % Calls cpsd asking for the number of averages + pl_spec.pset('Nfft', n_pts, 'navs', navs); + C1 = cpsd(a_1, a_2, pl_spec); + + % Calls cpsd asking for the number of points just evaluated + pl_spec.pset('Nfft', find(C1.hist.plistUsed, 'Nfft')); + pl_spec.remove('navs'); + C2 = cpsd(a_1, a_2, pl_spec); + + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_created.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_created.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,477 @@ +% UTP_AO_CREATED a set of UTPs for the ao/created method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_created.m,v 1.3 2009/07/27 19:28:58 ingo Exp $ +% + +% +% +% The created method of the ao returns a time object of the last +% modification. For this uses the created method the 'proctime' property of +% the last history step and computs from this value a timeobject. +% +% + +function results = utp_ao_created(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'created'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AO objects + [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test empty object + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the created method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the created method works for a vector of AOs as input. + % + % + + try + % + out = created(atvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check the time-object + for kk=1:numel(out) + if out(kk).utc_epoch_milli ~= atvec(kk).hist.proctime, atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the created method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the created method works for a matrix of AOs as input. + % + % + + try + % + out = created(atmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check time-object + for kk=1:numel(out) + if out(kk).utc_epoch_milli ~= atmat(kk).hist.proctime, atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the created method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the created method works for a list of AOs as input. + % + % + + try + % + out = created(at1,at2,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if out(1).utc_epoch_milli ~= at1.hist.proctime, atest = false; end + if out(2).utc_epoch_milli ~= at2.hist.proctime, atest = false; end + if out(3).utc_epoch_milli ~= at3.hist.proctime, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the created method works with a mix of different shaped AOs + % as input. + % + % + function result = utp_05 + + % + % + % Test that the created method works with an input of matrices and + % vectors and single AOs. + % + % + + try + % + out = created(at1,atvec,at2,atmat,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + aoin = [at1,reshape(atvec,1,[]),at2,reshape(atmat,1,[]),at3]; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(atmat)+numel(atvec)), atest = false; end + for kk=1:numel(out) + if out(kk).utc_epoch_milli ~= aoin(kk).hist.proctime, atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the created method properly applies history + % + % + function result = utp_06 + + % + % + % This method doesn't change the input object, thus no history is added + % to the object. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the created method can be used with the modify command. + % + % + function result = utp_07 + + % + % + % Tests that the created method can be used with the modify command. + % + % + + try + % + out1 = at3.created; + out2 = atmat.created; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the single object + % 2) Check the matrix object + % + % + + atest = true; + if stest + % + % Check the single object + if out1.utc_epoch_milli ~= at3.hist.proctime, atest = false; end + % Check the matrix + for kk = 1:numel(out2) + if out2(kk).utc_epoch_milli ~= atmat(kk).hist.proctime, atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the created method retruns always a well defined time object + % even for an empty input object. + % + % + function result = utp_08 + + % + % + % Test that the created method with an empty AO + % + % + + try + % + a1 = ao(); + out = a1.created; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a time object with a ell defined time. + % + % + + atest = true; + if stest + % + if ~isa(out, 'time'), atest = false; end + if isnan(out.utc_epoch_milli), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_creator.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_creator.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,515 @@ +% UTP_AO_CREATED a set of UTPs for the ao/creator method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_creator.m,v 1.4 2009/07/28 13:17:23 ingo Exp $ +% + +% +% +% The creator method of the ao extract the creator(s)/modifier from +% the history. Depending to the input parameter returns this method all +% creator/modifier or only the last creator/modifier. +% +% + +function results = utp_ao_creator(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'creator'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with different creator/modifier + results = [results utp_09]; % Test negative case for the option 'all' + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('option'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('option')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('option'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the creator method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the creator method works for a vector of AOs as input. + % + % + + try + % + out = creator(atvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(atvec), atest = false; end + % Check the creator + curr_creator = provenance(); + for kk=1:numel(out) + if ~strcmp(out{kk}, curr_creator.creator), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the creator method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the creator method works for a matrix of AOs as input. + % + % + + try + % + out = creator(atmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(atmat), atest = false; end + % Check creator + curr_creator = provenance(); + for kk=1:numel(out) + if ~strcmp(out{kk}, curr_creator.creator), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the creator method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % The creator method doesn't work for a list of AOs as input. + % + % + + % + try + creator(at1,at2,at3); + stest = false; + catch + stest = true; + end + % + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the creator method works with a mix of different shaped + % AOs as input. + % + % + function result = utp_05 + + % + % + % The creator method doesn't work with different shaped input objects. + % + % + + % + try + creator(at1,atvec,at2,atmat,at3); + stest = false; + catch + stest = true; + end + % + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the creator method properly applies history + % + % + function result = utp_06 + + % + % + % This method doesn't change the input object, thus no history is added + % to the object. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the creator method can be used with the modify command. + % + % + function result = utp_07 + + % + % + % Tests that the creator method can be used with the modify command. + % + % + + try + % + out1 = at3.creator; + out2 = atmat.creator; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the single object + % 2) Check the matrix object + % + % + + atest = true; + if stest + % + curr_creator = provenance(); + % Check the single object + if ~strcmp(out1, curr_creator.creator), atest = false; end + % For a single object must be the the output a char string + if ~ischar(out1), atest = false; end + % Check the matrix + for kk = 1:numel(out2) + if ~strcmp(out2{kk}, curr_creator.creator), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the creator method retruns all creator(s)/modifier(s) which + % are in the history. + % + % + function result = utp_08 + + % + % + % Test that the creator method uses the option 'all' direct or in a + % plist. The test file must have the modifier 'first', 'second' and + % 'third' + % + % + + try + % + % Read object with different modifier + at = ao('test_ao_diff_creator.xml'); + out1 = at.creator; + out2 = at.creator('all'); + out3 = at.creator(plist('option', 'all')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that out1 contains only one creator + % 2) Check that out2 contain more creator/modifier + % + % + + atest = true; + if stest + % + if ~ischar(out1), atest = false; end + if ~strmatch('fist', out2), atest = false; end + if ~strmatch('second', out2), atest = false; end + if ~strmatch('third', out2), atest = false; end + if ~strmatch('fist', out3), atest = false; end + if ~strmatch('second', out3), atest = false; end + if ~strmatch('third', out3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Tests the negative case for the option 'all'. + % + % + function result = utp_09 + + % + % + % Test that the creator method throws an error if the option 'all' is + % used in connection with a matrix/vector of AOs. + % + % + + try + % + atmat.creator('all'); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_ctranspose.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_ctranspose.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,310 @@ +% UTP_AO_CTRANSPOSE a set of UTPs for the ao/ctranspose method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_ctranspose.m,v 1.12 2011/04/17 15:43:13 ingo Exp $ +% + +% +% +% The ctranspose method of the ao class computes the complex transpose value of the y +% and/or x data. +% +% + +function results = utp_ao_ctranspose(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'ctranspose'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06('transpose', at1, [], ple2)]; % Test history is working + + results = [results utp_07]; % Test the modify call works + results = [results utp_09]; % Test input data shape == output data shape + + results = [results utp_10(mthd, at1, at2, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + results = [results utp_12(mthd, at1, ple1)]; % Test errors are cleared + + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(ctranspose(in.data.y), out.data.y), atest = false; end + end + + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if ~io(3).plists.isparam('complex'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('complex'), false), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('complex'), {false, true}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_07 + + % + % + % Tests that the ctranspose method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the ctranspose method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = ain.ctranspose(); + ain.ctranspose(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is ctranspose(at1). + % + % + + atest = true; + if stest + % + % Check that ctranspose modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that ctranspose doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the ctranspose value of the copy + if ~isequal(ctranspose(at1.data.y), ain.data.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the ctranspose method can modify the single axis controlled by the + % plist and the resuld can be processed back to an m-file. + % + % + + try + % + plx = plist('axis', 'X'); + ply = plist('axis', 'Y'); + plxy = plist('axis', 'XY'); + out1 = ctranspose(at1, plx); + out2 = ctranspose(at1, ply); + out3 = ctranspose(at1, plxy); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the ctranspose method applies to both axes + % 2) Check that the ctranspose method applies to both axes + % 3) Check that the ctranspose method applies to both axes + % 4) Check that the rebuilt objects are the same as 'out[1..3]'. + % + % + + atest = true; + if stest + % + % Check each output against the complex transpose value of the input + if ~isequal(at1.data.y', out1.data.y), atest = false; end + if ~isequal(at1.data.y', out2.data.y), atest = false; end + if ~isequal(at1.data.y', out3.data.y), atest = false; end + % Check rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Control the method with a plist. + % + % + function result = utp_09 + + % + % + % Test that the abs method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = abs(at5); + out2 = abs(at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.x) ~= size(at5.data.x), atest = false; end + if size(out1.data.y) ~= size(at5.data.y), atest = false; end + if size(out2.data.x) ~= size(at6.data.x), atest = false; end + if size(out2.data.y) ~= size(at6.data.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_delay.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_delay.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,146 @@ +% UTP_AO_DELAY a set of UTPs for the ao/delay method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_delay.m,v 1.10 2009/09/20 16:51:33 hewitson Exp $ +% + +% +% +% The delay method of the ao class delays time-series AOs. +% +% + +function results = utp_ao_delay(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'delay'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + atvec = [at1 at5 at6]; + atmat = [at1 at5 at6; at5 at6 at1]; + pli = plist('N', 10, 'neval', true); + + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, pli, ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, pli, ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at5, at6, @algo_test_y, pli, ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, pli, ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, pli, ple2)]; % Test history is working + results = [results utp_07(mthd, at1, pli, ple2)]; % Test the modify call works + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at1, at5, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + results = [results utp_12(mthd, at1, ple1)]; % Test errors are cleared + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + N = pli.find('N'); + if ~isequal( [zeros(N,1); in.data.getY(1:end-N)], out.y ), atest = false; end + end + + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('n'), atest = false; end + if ~io(3).plists.isparam('method'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('n'), 0), atest = false; end + if ~isequal(io(3).plists.find('method'), 'zero'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('n'), {0}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('method'), {'zero'}), atest = false; end + % + end + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_demux.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_demux.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,287 @@ +% UTP_AO_DEMUX a set of UTPs for the ao/demux method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_demux.m,v 1.2 2009/07/20 16:50:08 ingo Exp $ +% + +% +% +% The demux method of the ao class splits the input vector of AOs into a +% number of output AOs. This is a very simple method thus most of standard +% test are not possible. +% +% + +function results = utp_ao_demux(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'demux'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Test with non complex data + results = [results utp_03]; % Negative test: Too few outputs + results = [results utp_04]; % Negative test: Too many 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the demux method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_02 + + % + % + % Tests that the demux method works with a mix of different shaped AOs + % as input. + % + % + + try + % + % Singme AO as input + o1 = demux(at1); + % Vector of AOs as input + [ov1,ov2,ov3] = demux(atvec); + % Matrix of AOs as input + [om1,om2,om3,om4,om5,om6] = demux(atmat); + % List of AOs as input + [ol1,ol2,ol3] = demux(at1, at2, at3); + % List mixed AOs as input + [os1,os2,os3,os4] = demux(at1, atvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output objects. + % + % + + atest = true; + if stest + % + % Check single object + if ~eq(o1, at1), atest = false; end + % Check vector object + if ~eq(ov1, atvec(1)), atest = false; end + if ~eq(ov2, atvec(2)), atest = false; end + if ~eq(ov3, atvec(3)), atest = false; end + % Check matrix object + if ~eq(om1, atmat(1)), atest = false; end + if ~eq(om2, atmat(2)), atest = false; end + if ~eq(om3, atmat(3)), atest = false; end + if ~eq(om4, atmat(4)), atest = false; end + if ~eq(om5, atmat(5)), atest = false; end + if ~eq(om6, atmat(6)), atest = false; end + % Check list object + if ~eq(ol1, at1), atest = false; end + if ~eq(ol2, at2), atest = false; end + if ~eq(ol3, at3), atest = false; end + % Check mixed object + if ~eq(os1, at1), atest = false; end + if ~eq(os2, atvec(1)), atest = false; end + if ~eq(os3, atvec(2)), atest = false; end + if ~eq(os4, atvec(3)), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Negative test. + % Check that the demux method throwns an error for too few output + % variables. + % + % + function result = utp_03 + + % + % + % Check that the demux method throwns an error for too few output + % variables. + % + % + + try + % + o1 = demux(atvec); + % + stest = false; + catch + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Negative test. + % Check that the demux method throwns an error for too many output + % variables. + % + % + function result = utp_04 + + % + % + % Check that the demux method throwns an error for too few output + % variables. + % + % + + try + % + [o1,o2,o3,o4,o5] = demux(atvec); + % + stest = false; + catch + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_det.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_det.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,615 @@ +% UTP_AO_DET a set of UTPs for the ao/det method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_det.m,v 1.12 2011/04/17 10:10:20 hewitson Exp $ +% + +% +% +% The det method of the ao class computes the determinant of the square matrix in y +% and/or x data. +% +% + +function results = utp_ao_det(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'det'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with additional plist with the key 'axis' + results = [results utp_09]; % Test input data shape == output data shape + results = [results utp_10]; % Test output of the data + results = [results utp_11(mthd, at4, ple1)]; % Test plotinfo doesn't disappear + results = [results utp_12(mthd, at4, ple1)]; % Test errors are cleared + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the det method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the det method works for a vector of AOs as input. + % + % + + try + % + atvec = [at4, at4, at4]; + out = det(atvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check each output against the determinant of the input + for kk=1:numel(out) + if ~isequal(det(atvec(kk).data.getY), out(kk).data.getY) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the det method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the det method works for a matrix of AOs as input. + % + % + + try + % + atmat = [at4 at4 at4; at4 at4 at4]; + out = det(atmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check each output against the determinant of the input + for kk=1:numel(out) + if ~isequal(det(atmat(kk).data.getY), out(kk).data.getY) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the det method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the det method works for a list of AOs as input. + % + % + + try + % + out = det(at4, at4, at4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the determinant of the input + if ~isequal(det(at4.data.getY), out(1).data.getY), atest = false; end + if ~isequal(det(at4.data.getY), out(2).data.getY), atest = false; end + if ~isequal(det(at4.data.getY), out(3).data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the det method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the det method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + atmat = [at4 at4; at4 at4]; + atvec = [at4 at4]; + out = det(at4,atvec,at4,atmat,at4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(atmat)+numel(atvec)), atest = false; end + % Check the first input + nout = 1; + if ~isequal(det(at4.data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + % Check the elements of the input vector + for jj=1:numel(atvec) + if ~isequal(det(atvec(jj).data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + end + % Check the 3rd input + if ~isequal(det(at4.data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + % Check the elements of the input matrix + for jj=1:numel(atmat) + if ~isequal(det(atmat(jj).data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + end + % Check the last input + if ~isequal(det(at4.data.getY), out(nout).data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the det method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the det method can be processed back + % to an m-file. + % + % + + try + % + out = det(at4); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'det'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'det'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the det method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the det method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at4 to work with + ain = ao(at4); + % modify ain + aout = ain.det(); + ain.det(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at4' and 'ain' are now different. + % 2) Check that 'ain' is det(at4). + % + % + + atest = true; + if stest + % + % Check that det modified the input by comparing to the copy + if eq(ao(at4), ain, ple1), atest = false; end + % Check that det doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the det value of the copy + if ~isequal(det(at4.data.getY), ain.data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the det method can modify the single axis controlled by the + % plist and the resuld can be processed back to an m-file. + % + % + + try + % + ply = plist('axis', 'Y'); + out = det(at4, ply); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the det method applies to the x-axis + % 2) Check that the det method applies to the y-axis + % 3) Check that the det method applies to both axes + % 4) Check that the re-built objects are the same object as 'out[1..3]'. + % + % + + atest = true; + if stest + % + % Check each output against the determinant of the input + if ~isequal(det(at4.data.getY), out.data.getY), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Control the method with a plist. + % + % + function result = utp_09 + + % + % + % Test that the det method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = det(at4); + out2 = det(at4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y) ~= size(det(at4.data.y)), atest = false; end + if size(out2.data.y) ~= size(det(at4.data.y)), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the det method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_10 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + at4_10 = at4+10; + [o1, o2] = det(at4, at4_10); + o3 = det(at4, at4_10); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_detrend.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_detrend.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,655 @@ +% UTP_AO_DETREND a set of UTPs for the ao/detrend method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_detrend.m,v 1.13 2010/09/20 21:14:06 mauro Exp $ +% + +% +% +% The detrend method of the ao class detrends time-series AOs. +% +% + +function results = utp_ao_detrend(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'detrend'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + atvec = [at1 at5 at6]; + atmat = [at1 at5 at6; at5 at6 at1]; + pli = plist('order', 10, 'neval', true); + + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, pli, ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, pli, ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at5, at6, @algo_test_y, pli, ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, pli, ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, pli, ple2)]; % Test history is working + results = [results utp_07(mthd, at1, pli, ple2)]; % Test the modify call works + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at1, at5, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + results = [results utp_12(mthd, at4, ple1)]; % Test errors are cleared + + 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 + + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + TOL = 1e-14; + N = pli.find('order'); + [y, a] = ltpda_polyreg(in.y, N); + if any(abs(y-out.y)>TOL) , atest = false; end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('order'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('order'), 1), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('order'), {-1 0 1 2 3 4 5 6 7 8 9}), atest = false; end + % Check key + if ~io(3).plists.isparam('M-FILE ONLY'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('M-FILE ONLY'), false), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('M-FILE ONLY'), {false true}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +% %% UTP_02 +% +% % +% % +% % Tests that the detrend method works with a vector of AOs as input. +% % +% % +% function result = utp_02 +% +% % +% % +% % Test that the detrend method works for a vector of AOs as input. +% % +% % +% +% try +% % +% N = 3; +% avec = [at1 at5 at6]; +% out = detrend(avec, plist('N', N)); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the number of elements in 'out' is the square of the +% % number in the input. +% % 2) Check that each output AO contains the correct data. +% % +% % +% +% atest = true; +% TOL = 1e-14; +% if stest +% % +% % Check we have the correct number of outputs +% if numel(out) ~= numel(avec), atest = false; end +% % Check the correctness of the algorithm +% for kk = 1:numel(avec) +% [y, a] = ltpda_polyreg(avec(kk).y, N); +% if any(abs(y-out(kk).y)>TOL) , atest = false; end +% end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_02 +% +% %% UTP_03 +% +% % +% % +% % Tests that the detrend method works with a matrix of AOs as input. +% % +% % +% function result = utp_03 +% +% % +% % +% % Test that the detrend method works for a matrix of AOs as input. +% % +% % +% +% try +% % +% N = 3; +% amat = [at1 at5 at6; at5 at6 at1]; +% out = detrend(amat, plist('N', N)); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the number of elements in 'out' is the square of the +% % number in the input. +% % 2) Check that each output AO contains the correct data. +% % +% % +% +% atest = true; +% TOL = 1e-14; +% if stest +% % +% % Check we have the correct number of outputs +% if numel(out) ~= numel(amat), atest = false; end +% % Check the correctness of the algorithm +% for kk = 1:numel(amat) +% [y, a] = ltpda_polyreg(amat(kk).y, N); +% if any(abs(y-out(kk).y)>TOL) , atest = false; end +% end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_03 +% +% %% UTP_04 +% +% % +% % +% % Tests that the detrend method works with a list of AOs as input. +% % +% % +% function result = utp_04 +% +% % +% % +% % Test that the detrend method works for a list of AOs as input. +% % +% % +% +% try +% % +% N = 3; +% out = detrend(at1,at5,at6, plist('N', N)); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the number of elements in 'out' is the square of the +% % number in the input. +% % 2) Check that each output AO contains the correct data. +% % +% % +% +% aoin = [at1, at5, at6]; +% atest = true; +% TOL = 1e-14; +% if stest +% % +% % Check we have the correct number of outputs +% if numel(out) ~= 3, atest = false; end +% % Check the correctness of the algorithm +% for kk = 1:numel(aoin) +% [y, a] = ltpda_polyreg(aoin(kk).y, N); +% if any(abs(y-out(kk).y)>TOL) , atest = false; end +% end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_04 +% +% %% UTP_05 +% +% % +% % +% % Tests that the detrend method works with a mix of different shaped AOs as +% % input. +% % +% % +% function result = utp_05 +% +% % +% % +% % Test that the detrend method works with an input of matrices and vectors +% % and single AOs. +% % +% % +% +% try +% % +% N = 3; +% out = detrend(at1,[at5 at6],at5,[at5 at1; at6 at1],at6, plist('N', N)); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the number of elements in 'out' is the same as in +% % input. +% % 2) Check that each output AO contains the correct data. +% % +% % +% +% aoin = [at1, reshape([at5 at6], 1, []), at5, reshape([at5 at1; at6 at1], 1, []), at6]; +% atest = true; +% TOL = 1e-14; +% if stest +% % +% % Check we have the correct number of outputs +% if numel(out) ~= 9, atest = false; end +% % Check the correctness of the algorithm +% for kk = 1:numel(aoin) +% [y, a] = ltpda_polyreg(aoin(kk).y, N); +% if any(abs(y-out(kk).y)>TOL) , atest = false; end +% end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_05 +% +% %% UTP_06 +% +% % +% % +% % Tests that the detrend method properly applies history. +% % +% % +% function result = utp_06 +% +% % +% % +% % Test that the result of applying the detrend method can be processed back +% % to an m-file. +% % +% % +% +% try +% % +% out = detrend(at5,plist('N', 3)); +% mout = rebuild(out); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the last entry in the history of 'out' corresponds to +% % 'detrend'. +% % 2) Check that the re-built object is the same object as 'out'. +% % +% % +% +% atest = true; +% if stest +% % +% % Check the last step in the history of 'out' +% if ~strcmp(out.hist.methodInfo.mname, 'detrend'), atest = false; end +% % Check the re-built object +% if ~eq(mout, out, ple2), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_06 +% +% %% UTP_07 +% +% % +% % +% % Tests that the detrend method can modify the input AO. +% % +% % +% function result = utp_07 +% +% % +% % +% % Test that the detrend method can modify the input AO by calling with no +% % output and that the method doesn't change the input of the function +% % notation (with a equal sign). +% % +% % +% +% try +% % +% % copy at1 to work with +% ain = ao(at1); +% % modify ain +% N = 10; +% pl = plist('N', N); +% aout = ain.detrend(pl); +% ain.detrend(pl); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that 'at1' and 'ain' are now different. +% % 2) Check that 'ain' is detrend(at1). +% % +% % +% +% atest = true; +% TOL = 1e-14; +% if stest +% % +% % Check that detrend modified the input by comparing to the copy +% if eq(ao(at1), ain, ple1), atest = false; end +% % Check that detrend doesn't modified the input for the function notation +% if ~eq(aout, ain, ple1), atest = false; end +% % Check that the modified input is the detrend value of the copy +% [y, a] = ltpda_polyreg(at1.y, N); +% if any(abs(y-ain.y)>TOL) , atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_07 +% +% %% UTP_08 +% +% % +% % +% % Control the method with a plist. +% % +% % +% function result = utp_08 +% +% % +% % +% % Test that the detrend method can use the MATLAB methods polyfit and polyval +% % to compute the trend. +% % +% % +% +% try +% % +% N = 3; +% pl = plist('N', N, 'M-FILE ONLY', 'YES'); +% out = detrend(at1, pl); +% mout = rebuild(out); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the detrend method uses the MATLAB methods +% % 2) Check that the re-built object is the same object as 'out'. +% % +% % +% +% atest = true; +% if stest +% % +% x = at1.y; +% order = N; +% t = [1:length(x)].'; +% % fit polynomial +% p = polyfit(t, x, order); +% % make polynomial series +% py = polyval(p, t); +% % detrend +% y = x - py; +% % Check each output against the trend of the input +% if ~isequal(y, out.y), atest = false; end +% % Check the re-built object +% if ~eq(mout, out, ple1), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_08 +% +% %% UTP_09 +% +% % +% % +% % Tests that the detrend method keeps the data shape of the input object. +% % +% % +% function result = utp_09 +% +% % +% % +% % Test that the detrend method keeps the data shape of the input object. The +% % input AO must be an AO with row data and an AO with column data. +% % +% % +% +% try +% % +% pl = plist('N', 3); +% out1 = detrend(at5, pl); +% out2 = detrend(at6, pl); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the shpe of the data doesn't change. +% % +% % +% +% atest = true; +% if stest +% % +% % Check the shape of the output data +% if size(out1.data.x) ~= size(at5.data.x), atest = false; end +% if size(out1.data.y) ~= size(at5.data.y), atest = false; end +% if size(out2.data.x) ~= size(at6.data.x), atest = false; end +% if size(out2.data.y) ~= size(at6.data.y), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_09 +% +% %% UTP_10 +% +% % +% % +% % Check that the detrend method pass back the output objects to a list of +% % output variables or to a single variable. +% % +% % +% function result = utp_10 +% +% % +% % +% % Call the method with a list of output variables and with a single output +% % variable. Additionaly check that the rebuild method works on the output. +% % +% % +% +% try +% % +% pl = plist('N', 3); +% [o1, o2] = detrend(at5, at6, pl); +% o3 = detrend(at5, at6, pl); +% mout1 = rebuild(o1); +% mout2 = rebuild(o2); +% mout3 = rebuild(o3); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the output contains the right number of objects +% % 2) Check that the 'rebuild' method produces the same object as 'out'. +% % +% % +% +% atest = true; +% if stest +% % +% % Check the number of outputs +% if numel(o1) ~=1, atest = false; end +% if numel(o2) ~=1, atest = false; end +% if numel(o3) ~=2, atest = false; end +% % Check the rebuilding of the object +% if ~eq(o1, mout1, ple2), atest = false; end +% if ~eq(o2, mout2, ple2), atest = false; end +% if ~eq(o3, mout3, ple2), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_dft.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_dft.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,153 @@ +% UTP_AO_DFT a set of UTPs for the ao/dft method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_dft.m,v 1.13 2009/09/20 16:51:33 hewitson Exp $ +% + +% +% +% The dft method of the ao class computes the discrete fourier transform of +% time-series AOs. +% +% + +function results = utp_ao_dft(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'dft'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + atvec = [at1 at5 at6]; + atmat = [at1 at5 at6; at5 at6 at1]; + pli = plist('f', 3, 'neval', true); + + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, pli, ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, pli, ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at5, at6, @algo_test_y, pli, ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, pli, ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, pli, ple2)]; % Test history is working + results = [results utp_07(mthd, at1, pli, ple2)]; % Test the modify call works + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at1, at5, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + results = [results utp_12(mthd, at1, ple1)]; % Test errors are cleared + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + % Compute DFT + f = pli.find('f'); + fs = in.data.fs; + N = length(in.y); + J = -2*pi*1i.*[0:N-1]/fs; + dfts = zeros(size(f)); + for ss = 1:length(f) + dfts(ss) = exp(f(ss)*J)*in.y; + end + if ~isequal(in.fs, out.fs), atest = false; end + if ~isequal(f, out.x), atest = false; end + if ~isequal(dfts, out.y), atest = false; end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('f'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('f'), -1), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('f'), {-1}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_diag.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_diag.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,670 @@ +% UTP_AO_DIAG a set of UTPs for the ao/diag method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_diag.m,v 1.12 2011/04/17 10:09:40 hewitson Exp $ +% + +% +% +% The diag method of the ao class computes the diagonals of a matrix in y +% and/or x data. +% +% + +function results = utp_ao_diag(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'diag'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with additional plist with the key 'axis' + results = [results utp_09]; % Test input data shape == output data shape + results = [results utp_10]; % Test output of the data + results = [results utp_11(mthd, at4, ple1)]; % Test plotinfo doesn't disappear + results = [results utp_12(mthd, at4, ple1)]; % Test errors are cleared + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = true; + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, '1D')), atest = false; end + if ~any(strcmpi(io(2).sets, '2D')), atest = false; end + if ~any(strcmpi(io(2).sets, '3D')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET '1D' + % Check key + if ~io(3).plists.isparam('axis'), atest = false; end + if ~io(3).plists.isparam('dim'), atest = false; end + if ~io(3).plists.isparam('option'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('axis'), 'y'), atest = false; end + if ~isEmptyDouble(io(3).plists.find('dim')), atest = false; end + if ~isequal(io(3).plists.find('option'), 0), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('axis'), {'y'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('dim'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('option'), {0}), atest = false; end + % SET '2D' + % Check key + if ~io(4).plists.isparam('axis'), atest = false; end + if ~io(4).plists.isparam('dim'), atest = false; end + if ~io(4).plists.isparam('option'), atest = false; end + % Check default value + if ~isequal(io(4).plists.find('axis'), 'y'), atest = false; end + if ~isEmptyDouble(io(4).plists.find('dim')), atest = false; end + if ~isequal(io(4).plists.find('option'), 0), atest = false; end + % Check options + if ~isequal(io(4).plists.getOptionsForParam('axis'), {'x', 'y', 'xy'}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('dim'), {[]}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('option'), {0}), atest = false; end + % SET '3D' + % Check key + if ~io(5).plists.isparam('axis'), atest = false; end + if ~io(5).plists.isparam('dim'), atest = false; end + if ~io(5).plists.isparam('option'), atest = false; end + % Check default value + if ~isequal(io(5).plists.find('axis'), 'z'), atest = false; end + if ~isEmptyDouble(io(5).plists.find('dim')), atest = false; end + if ~isequal(io(5).plists.find('option'), 0), atest = false; end + % Check options + if ~isequal(io(5).plists.getOptionsForParam('axis'), {'x', 'y', 'z', 'xyz'}), atest = false; end + if ~isequal(io(5).plists.getOptionsForParam('dim'), {[]}), atest = false; end + if ~isequal(io(5).plists.getOptionsForParam('option'), {0}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the diag method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the diag method works for a vector of AOs as input. + % + % + + try + % + atvec = [at4, at4, at4]; + out = diag(atvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check each output against the diagonals of the input + for kk=1:numel(out) + if ~isequal(diag(atvec(kk).data.getY), out(kk).data.getY) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the diag method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the diag method works for a matrix of AOs as input. + % + % + + try + % + atmat = [at4 at4 at4; at4 at4 at4]; + out = diag(atmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check each output against the diagonals of the input + for kk=1:numel(out) + if ~isequal(diag(atmat(kk).data.getY), out(kk).data.getY) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the diag method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the diag method works for a list of AOs as input. + % + % + + try + % + out = diag(at4, at4, at4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the diagonals of the input + if ~isequal(diag(at4.data.getY), out(1).data.getY), atest = false; end + if ~isequal(diag(at4.data.getY), out(2).data.getY), atest = false; end + if ~isequal(diag(at4.data.getY), out(3).data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the diag method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the diag method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + atmat = [at4 at4; at4 at4]; + atvec = [at4 at4]; + out = diag(at4,atvec,at4,atmat,at4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(atmat)+numel(atvec)), atest = false; end + % Check the first input + nout = 1; + if ~isequal(diag(at4.data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + % Check the elements of the input vector + for jj=1:numel(atvec) + if ~isequal(diag(atvec(jj).data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + end + % Check the 3rd input + if ~isequal(diag(at4.data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + % Check the elements of the input matrix + for jj=1:numel(atmat) + if ~isequal(diag(atmat(jj).data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + end + % Check the last input + if ~isequal(diag(at4.data.getY), out(nout).data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the diag method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the diag method can be processed back + % to an m-file. + % + % + + try + % + out = diag(at4); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'diag'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'diag'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the diag method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the diag method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at4 to work with + ain = ao(at4); + % modify ain + aout = ain.diag(); + ain.diag(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at4' and 'ain' are now different. + % 2) Check that 'ain' is diag(at4). + % + % + + atest = true; + if stest + % + % Check that diag modified the input by comparing to the copy + if eq(ao(at4), ain, ple1), atest = false; end + % Check that diag doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the diag value of the copy + if ~isequal(diag(at4.data.getY), ain.data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the diag method can modify the single axis controlled by the + % plist and the resuld can be processed back to an m-file. + % + % + + try + % + pl0 = plist('option', 0); + pl1 = plist('option', 1); + pl2 = plist('option', 2); + out1 = diag(at4, pl0); + out2 = diag(at4, pl1); + out3 = diag(at4, pl2); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the svd method applies with different options. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check each output against the diagonals of the input + if ~isequal(diag(at4.data.getY, 0), out1.data.getY), atest = false; end + if ~isequal(diag(at4.data.getY, 1), out2.data.getY), atest = false; end + if ~isequal(diag(at4.data.getY, 2), out3.data.getY), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Control the method with a plist. + % + % + function result = utp_09 + + % + % + % Test that the diag method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = diag(at4); + out2 = diag(at4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y) ~= size(diag(at4.data.y)), atest = false; end + if size(out2.data.y) ~= size(diag(at4.data.y)), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the diag method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_10 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + at4_10 = at4+10; + [o1, o2] = diag(at4, at4_10); + o3 = diag(at4, at4_10); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_diff.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_diff.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,362 @@ +% UTP_AO_DIFF a set of UTPs for the ao/diff method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_diff.m,v 1.14 2009/09/20 16:51:33 hewitson Exp $ +% + +% +% +% The diff method of the ao class computes the derivative of the input data +% using different methods. +% +% + +function results = utp_ao_diff(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'diff'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + atvec = [at1 at5 at6]; + atmat = [at1 at5 at6; at5 at6 at1]; + pli = plist('method', '3point', 'neval', true); + + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, pli, ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, pli, ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at5, at6, @algo_test_y, pli, ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, pli, ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, pli, ple2)]; % Test history is working + results = [results utp_07(mthd, at1, pli, ple2)]; % Test the modify call works + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at1, at5, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + results = [results utp_12(mthd, at1, ple1)]; % Test errors are cleared + + results = [results utp_13]; % Test with plist: method = 'ORDER2' + results = [results utp_14]; % Test with plist: method = 'ORDER2SMOOTH' + results = [results utp_15]; % Test with plist: method = '5POINT' + + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + % 3 point derivative + x = in.data.getX; + dx = diff(x); + y = in.data.getY; + z = zeros(size(y)); + z(2:end-1) = (y(3:end)-y(1:end-2)) ./ (dx(2:end)+dx(1:end-1)); + z(1) = (y(2)-y(1)) ./ (dx(1)); + z(end) = 2*z(end-1)-z(end-2); + if ~isequal(out.y, z), atest = false; end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(3).plists.isparam('method'), atest = false; end + if ~io(3).plists.isparam('f0'), atest = false; end + if ~io(3).plists.isparam('order'), atest = false; end + if ~io(3).plists.isparam('coeff'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('method'), '2POINT'), atest = false; end + if ~isequal(io(3).plists.find('f0'), '1/Nsecs'), atest = false; end + if ~isequal(io(3).plists.find('order'), 'ZERO'), atest = false; end + if ~isEmptyDouble(io(3).plists.find('coeff')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('method'), {'2POINT', '3POINT', '5POINT', 'ORDER2', 'ORDER2SMOOTH', 'FILTER', 'FPS'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('f0'), {'1/Nsecs'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('order'), {'ZERO', 'FIRST', 'SECOND'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('coeff'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_13 + + % + % + % Control the method with a plist. + % + % + function result = utp_13 + + % + % + % Test the computation of derivative using a 2nd order + % + % + + try + % + pl = plist('method', 'ORDER2'); + out = diff(at5, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the diff method uses the 2nd order derivative. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Compute derivative using a 2nd order + x = at5.data.getX; + dx = diff(x); + y = at5.data.getY; + z = zeros(size(y)); + m = length(y); + % y'(x1) + z(1) = (1/dx(1)+1/dx(2))*(y(2)-y(1))+... + dx(1)/(dx(1)*dx(2)+dx(2)^2)*(y(1)-y(3)); + % y'(xm) + z(m) = (1/dx(m-2)+1/dx(m-1))*(y(m)-y(m-1))+... + dx(m-1)/(dx(m-1)*dx(m-2)+dx(m-2)^2)*(y(m-2)-y(m)); + % y'(xi) (i>1 & i + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + %% UTP_14 + + % + % + % Control the method with a plist. + % + % + function result = utp_14 + + % + % + % Test the computation of derivative using a 2nd order with a parabolic fit + % + % + + try + % + pl = plist('method', 'ORDER2SMOOTH'); + out = diff(at5, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the diff method uses the 2nd order derivative with a + % parabolic fit + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Compute derivative using a 2nd order with a parabolic fit + x = at5.data.getX; + y = at5.data.getY; + dx = diff(x); + m = length(y); + h = mean(dx); + z = zeros(size(y)); + % y'(x1) + z(1) = sum(y(1:5).*[-54; 13; 40; 27; -26])/70/h; + % y'(x2) + z(2) = sum(y(1:5).*[-34; 3; 20; 17; -6])/70/h; + % y'(x{m-1}) + z(m-1) = sum(y(end-4:end).*[6; -17; -20; -3; 34])/70/h; + % y'(xm) + z(m) = sum(y(end-4:end).*[26; -27; -40; -13; 54])/70/h; + % y'(xi) (i>2 & i<(N-1)) + Dc = [2 1 0 -1 -2]; + tmp = convn(Dc,y)/10/h; + z(3:m-2) = tmp(5:m); + % Check the 2nd oder derivative + if ~isequal(out.y, z), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_14 + + %% UTP_15 + + % + % + % Control the method with a plist. + % + % + function result = utp_15 + + % + % + % Test the 5 point derivative. + % + % + + try + % + pl = plist('method', '5POINT'); + out = diff(at5, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the diff method uses the 5 point derivative. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Compute 5 point derivative + x = at5.data.getX; + dx = diff(x); + y = at5.data.getY; + z = zeros(size(y)); + z(1) = (y(2)-y(1)) ./ (dx(1)); + z(2) = (y(3)-y(1))./(dx(2)+dx(1)); + z(3:end-2) = (-y(5:end) + 8.*y(4:end-1) - 8.*y(2:end-3) + y(1:end-4)) ./ (3.*(x(5:end)-x(1:end-4))); + z(end-1) = 2*z(end-2)-z(end-3); + z(end) = 2*z(end-1)-z(end-2); + % Check the 5 point derivative + if ~isequal(out.y, z), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_15 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_display.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_display.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,361 @@ +% UTP_AO_DISPLAY a set of UTPs for the ao/display method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_display.m,v 1.3 2009/07/20 16:50:08 ingo Exp $ +% + +% +% +% The display method of the ao class prints defined values of an AO. +% MATLAB calls display when it interprets an object that is not terminated +% by a semicolon. +% +% + +function results = utp_ao_display(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'display'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the display method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the display method works for a vector of AOs as input. + % + % + + try + % + atvec + out = display(atvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + % Check the output + if ~iscell(out), atest = false; end; + for kk = 1:numel(atvec) + if isempty(strfind(out, atvec(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the display method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the display method works for a matrix of AOs as input. + % + % + + try + % + atmat + out = display(atmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(atmat) + if isempty(strfind(out, atmat(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the display method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the display method works for a list of AOs as input. + % + % + + try + % + at1,at2,at3 + out = display(at1,at2,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + aoin = [at1,at2,at3]; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(aoin) + if isempty(strfind(out, aoin(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the display method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the display method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = display(at1,atvec,at2,atmat,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + aoin = [at1,reshape(atvec,1,[]),at2,reshape(atmat,1,[]),at3]; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(aoin) + if isempty(strfind(out, aoin(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the display method properly applies history. + % + % + function result = utp_06 + + % + % + % The method display doesn't change the data, thus it is not possible to + % check the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_dopplercorr.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_dopplercorr.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,438 @@ +% UTP_AO_DOPPLERCORR a set of UTPs for the ao/dopplercorr method +% +% M Nofrarias 13-02-09 +% +% $Id: utp_ao_dopplercorr.m,v 1.6 2009/08/28 13:13:53 ingo Exp $ +% + +% +% +% The dopplercorr method corrects OPD data from the Doppler effect +% +% + +function results = utp_ao_dopplercorr(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'dopplercorr'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + pli = plist('bin', 1); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test output of the data + + results = [results utp_11(mthd, at1, ple1, pli)]; % Test plotinfo doesn't disappear + + % + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + % + try + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + % + atest = true; + if stest + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if ~io(3).plists.isparam('bin'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('bin'), 50), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('bin'), {50}), atest = false; end + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the dopplercorr method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the dopplercorr method works for a vector of AOs as input. + % + % + + % + try + avec = [at1 at5 at6]; + pl = plist('bin',1); + out = dopplercorr(avec,pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the dopplercorr method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the dopplercorr method works for a matrix of AOs as input. + % + % + + % + try + amat = [at1 at5 at6; at5 at6 at1]; + pl = plist('bin',1); + out = dopplercorr(amat,pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the dopplercorr method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the dopplercorr method works for a list of AOs as input. + % + % + + % + try + pl = plist('bin',1); + out = dopplercorr(at1,at5,at6,pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the dopplercorr method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the dopplercorr method works with an input of matrices and vectors + % and single AOs. + % + % + + % + try + pl = plist('bin',1); + out = dopplercorr(at1,[at5 at6],at5,[at5 at1; at6 at1],at6,pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + % + % + % Tests that the dopplercorr method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the dopplercorr method can be processed back + % to an m-file. + % + % + + % + try + pl = plist('bin',1); + out = dopplercorr(at5,pl); + mout = rebuild(out); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'dopplercorr'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + % + atest = true; + if stest + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'dopplercorr'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the dopplercorr method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + pl = plist('bin',1); + [o1, o2] = dopplercorr(at5, at6,pl); + o3 = dopplercorr(at5, at6,pl); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + + +end + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_downsample.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_downsample.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,642 @@ +% UTP_AO_DOWNSAMPLE a set of UTPs for the ao/downsample method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_downsample.m,v 1.14 2009/09/20 16:51:33 hewitson Exp $ +% + +% +% +% The downsample method of the ao class downsamples time-series AOs. +% +% + +function results = utp_ao_downsample(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'downsample'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test the data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test with plist: 'offset' and 'factor' + + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + results = [results utp_12(mthd, at1, ple1)]; % Test errors are cleared + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('factor'), atest = false; end + if ~io(3).plists.isparam('offset'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('factor'), 1), atest = false; end + if ~isequal(io(3).plists.find('offset'), 0), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('factor'), {1}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('offset'), {0}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the downsample method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the downsample method works for a vector of AOs as input. + % + % + + try + % + factor = 2; + avec = [at1 at5 at6]; + out = downsample(avec, plist('Factor', factor)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + TOL = 1e-13; + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + % Check the downsampling + for kk = 1:numel(avec) + samples = 1:factor:length(avec(kk).y); + if ~isequal(avec(kk).data.getY(samples), out(kk).y), atest = false; end + if any(abs(avec(kk).data.getX(samples)-out(kk).x)>TOL), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the downsample method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the downsample method works for a matrix of AOs as input. + % + % + + try + % + factor = 3; + amat = [at1 at5 at6; at5 at6 at1]; + out = downsample(amat, plist('Factor', factor)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + TOL = 1e-6; + atest = true; + warning('### This UTP have very high tolerance'); + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + % Check the downsampling + for kk = 1:numel(amat) + samples = 1:factor:length(amat(kk).y); + if ~isequal(amat(kk).data.getY(samples), out(kk).y), atest = false; end + if any(abs(amat(kk).data.getX(samples)-out(kk).x)>TOL), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the downsample method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the downsample method works for a list of AOs as input. + % + % + + try + % + factor = 2; + out = downsample(at1,at5,at6, plist('Factor', factor)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, at5, at6]; + TOL = 1e-14; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check the downsampling + for kk = 1:numel(aoin) + samples = 1:factor:length(aoin(kk).y); + if ~isequal(aoin(kk).data.getY(samples), out(kk).y), atest = false; end + if any(abs(aoin(kk).data.getX(samples)-out(kk).x)>TOL), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the downsample method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the downsample method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + factor = 2; + out = downsample(at1,[at5 at6],at5,[at5 at1; at6 at1],at6, plist('Factor', factor)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, reshape([at5 at6], 1, []), at5, reshape([at5 at1; at6 at1], 1, []), at6]; + TOL = 1e-14; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + % Check the downsampling + for kk = 1:numel(aoin) + samples = 1:factor:length(aoin(kk).y); + if ~isequal(aoin(kk).data.getY(samples), out(kk).y), atest = false; end + if any(abs(aoin(kk).data.getX(samples)-out(kk).x)>TOL), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the downsample method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the downsample method can be processed back + % to an m-file. + % + % + + try + % + out = downsample(at5,plist('Factor', 2)); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'downsample'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'downsample'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the downsample method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the downsample method can modify the input AO by calling with no + % output. + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + factor = 5; + pl = plist('factor', factor); + aout = ain.downsample(pl); + ain.downsample(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is downsample(at1). + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check that downsample modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that downsample doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the downsample of the copy + samples = 1:factor:length(at1.y); + if ~isequal(at1.data.getY(samples), ain.y), atest = false; end + if any(abs(at1.data.getX(samples)-ain.x)>TOL), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the downsample method keeps the data shape of the input object. + % + % + function result = utp_08 + + % + % + % Test that the downsample method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + factor = 3; + pl = plist('factor', factor); + out1 = downsample(at5, pl); + out2 = downsample(at6, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,2) ~= 1, atest = false; end + if size(out2.data.y,1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the downsample method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + factor = 3; + pl = plist('factor', factor); + [o1, o2] = downsample(at5, at6, pl); + o3 = downsample(at5, at6, pl); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Control the method with a plist. + % + % + function result = utp_10 + + % + % + % Test the downsample method with a factor and an offset. + % + % + + try + % + factor = 3; + offset = 30; + pl = plist('factor', factor, 'offset', offset); + out = downsample(at5, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the downsample method with an offset and a factor + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + TOL = 1e-6; + warning('### This UTP have very high tolerance'); + if stest + % + samples = offset+1:factor:length(at5.data.y); + if ~isequal(at5.data.getY(samples), out.y), atest = false; end + % Add the t0 offset to the input AO + at5_x = at5.data.getX(samples); + out_x = out.x; + at5_x = at5_x - (out.t0.utc_epoch_milli - at5.t0.utc_epoch_milli)/1e3; + if any(abs(at5_x-out_x)>TOL), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_dropduplicates.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_dropduplicates.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,682 @@ +% UTP_AO_DROPDUPLICATES a set of UTPs for the ao/dropduplicates method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_dropduplicates.m,v 1.10 2009/08/07 10:05:39 hewitson Exp $ +% + +% +% +% The dropduplicates method of the ao class drops duplicate samples from AOs. +% +% + +function results = utp_ao_dropduplicates(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'dropduplicates'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test the data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test with different tolerances. + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('tol'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('tol'), .005), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('tol'), {.005}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the dropduplicates method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the dropduplicates method works for a vector of AOs as input. + % + % + + try + % + x = 1:100; + x = sort([x x+1e-4]); + y = randn(length(x),1); + at1 = ao(plist('xvals', x, 'yvals', y, 'type', 'tsdata')); + avec = [at1 at5 at6]; + out = dropduplicates(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + % Check the output data + for kk = 1:numel(avec) + x = avec(kk).x; + y = avec(kk).y; + d = abs(diff(x)); + idx = find(d<5e-3); + x(idx) = []; + y(idx) = []; + if ~isequal(out(kk).x, x), atest = false; end + if ~isequal(out(kk).y, y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the dropduplicates method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the dropduplicates method works for a matrix of AOs as input. + % + % + + try + % + x = 1:100; + x = sort([x x+1e-4]); + y = randn(length(x),1); + at1 = ao(plist('xvals', x, 'yvals', y, 'type', 'tsdata')); + amat = [at1 at5 at6; at5 at6 at1]; + out = dropduplicates(amat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + % Check the output data + for kk = 1:numel(amat) + x = amat(kk).x; + y = amat(kk).y; + d = abs(diff(x)); + idx = find(d<5e-3); + x(idx) = []; + y(idx) = []; + if ~isequal(out(kk).x, x), atest = false; end + if ~isequal(out(kk).y, y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the dropduplicates method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the dropduplicates method works for a list of AOs as input. + % + % + + try + % + x = 1:100; + x = sort([x x+1e-4]); + y = randn(length(x),1); + at1 = ao(plist('xvals', x, 'yvals', y, 'type', 'tsdata')); + out = dropduplicates(at1,at5,at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, at5, at6]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check the output data + for kk = 1:numel(aoin) + x = aoin(kk).x; + y = aoin(kk).y; + d = abs(diff(x)); + idx = find(d<5e-3); + x(idx) = []; + y(idx) = []; + if ~isequal(out(kk).x, x), atest = false; end + if ~isequal(out(kk).y, y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the dropduplicates method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the dropduplicates method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + x = 1:100; + x = sort([x x+1e-4]); + y = randn(length(x),1); + at1 = ao(plist('xvals', x, 'yvals', y, 'type', 'tsdata')); + out = dropduplicates(at1,[at5 at6],at5,[at5 at1; at6 at1],at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, reshape([at5 at6], 1, []), at5, reshape([at5 at1; at6 at1], 1, []), at6]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + % Check the output data + for kk = 1:numel(aoin) + x = aoin(kk).x; + y = aoin(kk).y; + d = abs(diff(x)); + idx = find(d<5e-3); + x(idx) = []; + y(idx) = []; + if ~isequal(out(kk).x, x), atest = false; end + if ~isequal(out(kk).y, y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the dropduplicates method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the dropduplicates method can be processed back + % to an m-file. + % + % + + try + % + out = dropduplicates(at5); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'dropduplicates'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'dropduplicates'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the dropduplicates method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the dropduplicates method can modify the input AO by calling + % with no output. + % + % + + try + % + % copy at1 to work with + x = 1:100; + x = sort([x x+1e-4]); + y = randn(length(x),1); + at1 = ao(plist('xvals', x, 'yvals', y, 'type', 'tsdata')); + ain = ao(at1); + % modify ain + aout = ain.dropduplicates(); + ain.dropduplicates(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is dropduplicates(at1). + % + % + + atest = true; + if stest + % + % Check that dropduplicates modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that dropduplicates doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the dropduplicates of the copy + x = at1.x; + y = at1.y; + d = abs(diff(x)); + idx = find(d<5e-3); + x(idx) = []; + y(idx) = []; + if ~isequal(ain.x, x), atest = false; end + if ~isequal(ain.y, y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the dropduplicates method keeps the data shape of the input object. + % + % + function result = utp_08 + + % + % + % Test that the dropduplicates method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + x = 1:100; + x = sort([x x+1e-4]); + y = randn(length(x),1); + at5 = ao(plist('xvals', x, 'yvals', y, 'type', 'tsdata')); + at6 = at5.'; + out1 = dropduplicates(at5); + out2 = dropduplicates(at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.x, 2) ~= 1, atest = false; end + if size(out1.data.y, 2) ~= 1, atest = false; end + if size(out2.data.x, 1) ~= 1, atest = false; end + if size(out2.data.y, 1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the dropduplicates method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + x = 1:100; + x = sort([x x+1e-4]); + y = randn(length(x),1); + at5 = ao(plist('xvals', x, 'yvals', y, 'type', 'tsdata')); + at6 = at5.'; + [o1, o2] = dropduplicates(at5, at6); + o3 = dropduplicates(at5, at6); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Control the method with a plist. + % + % + function result = utp_10 + + % + % + % Test the dropduplicates method with different tolerances. + % + % + + try + % + x = 1:100; + x = sort([x x+.01]); + y = randn(length(x),1); + at1 = ao(plist('xvals', x, 'yvals', y, 'type', 'tsdata')); + tol1 = 0.1; + tol2 = 0.001; + pl1 = plist('tol', tol1); + pl2 = plist('tol', tol2); + out1 = dropduplicates(at1, pl1); + out2 = dropduplicates(at1, pl2); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the different tolerances + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % The sensitivity of 'tol' is high enough to remove data points + if eq(at1, out1, ple3), atest = false; end + % The sensitivity of 'tol' is NOT high enough to remove data points + % This means that input and output objectsare the same except the history + if ~eq(at1, out2, ple3), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_dsmean.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_dsmean.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,611 @@ +% UTP_AO_DSMEAN a set of UTPs for the ao/dsmean method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_dsmean.m,v 1.11 2009/09/20 16:51:33 hewitson Exp $ +% + +% +% +% The dsmean method of the ao class performs downsampling by taking the +% mean of every N samples of a time-series AOs. +% +% + +function results = utp_ao_dsmean(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'dsmean'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test the data shape + results = [results utp_09]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + results = [results utp_12(mthd, at1, ple1)]; % Test errors are cleared + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('fsout'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('fsout'), 10), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('fsout'), {10}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the dsmean method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the dsmean method works for a vector of AOs as input. + % + % + + try + % + fsout = 3; + avec = [at1 at5 at6]; + out = dsmean(avec, plist('fsout', fsout)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + % Check the output data + for kk = 1:numel(avec) + dsf = round(avec(kk).data.fs/fsout); + n = floor(length(avec(kk).data.y) / dsf); + y = avec(kk).data.getY(1:n*dsf); + y = mean(reshape(y, dsf, length(y)/dsf)).'; + % Check y-axis + if ~isequal(out(kk).y, y), atest = false; end + % Check t0 + t0 = avec(kk).data.t0 + dsf/(2*avec(kk).data.fs); + if ~eq(out(kk).t0, t0), atest = false; end + % Check fs + if ~eq(out(kk).fs, fsout), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the dsmean method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the dsmean method works for a matrix of AOs as input. + % + % + + try + % + fsout = 3; + amat = [at1 at5 at6; at5 at6 at1]; + out = dsmean(amat, plist('fsout', fsout)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + % Check the output data + for kk = 1:numel(amat) + dsf = round(amat(kk).data.fs/fsout); + n = floor(length(amat(kk).data.y) / dsf); + y = amat(kk).data.getY(1:n*dsf); + y = mean(reshape(y, dsf, length(y)/dsf)).'; + % Check y-axis + if ~isequal(out(kk).y, y), atest = false; end + % Check t0 + t0 = amat(kk).data.t0 + dsf/(2*amat(kk).data.fs); + if ~eq(out(kk).t0, t0), atest = false; end + % Check fs + if ~eq(out(kk).fs, fsout), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the dsmean method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the dsmean method works for a list of AOs as input. + % + % + + try + % + fsout = 3; + out = dsmean(at1,at5,at6, plist('fsout', fsout)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, at5, at6]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check the output data + for kk = 1:numel(aoin) + dsf = round(aoin(kk).data.fs/fsout); + n = floor(length(aoin(kk).data.y) / dsf); + y = aoin(kk).data.getY(1:n*dsf); + y = mean(reshape(y, dsf, length(y)/dsf)).'; + % Check y-axis + if ~isequal(out(kk).y, y), atest = false; end + % Check t0 + t0 = aoin(kk).data.t0 + dsf/(2*aoin(kk).data.fs); + if ~eq(out(kk).t0, t0), atest = false; end + % Check fs + if ~eq(out(kk).fs, fsout), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the dsmean method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the dsmean method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + fsout = 2; + out = dsmean(at1,[at5 at6],at5,[at5 at1; at6 at1],at6, plist('fsout', fsout)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, reshape([at5 at6], 1, []), at5, reshape([at5 at1; at6 at1], 1, []), at6]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + % Check the output data + for kk = 1:numel(aoin) + dsf = round(aoin(kk).data.fs/fsout); + n = floor(length(aoin(kk).data.y) / dsf); + y = aoin(kk).data.getY(1:n*dsf); + y = mean(reshape(y, dsf, length(y)/dsf)).'; + % Check y-axis + if ~isequal(out(kk).y, y), atest = false; end + % Check t0 + t0 = aoin(kk).data.t0 + dsf/(2*aoin(kk).data.fs); + if ~eq(out(kk).t0, t0), atest = false; end + % Check fs + if ~eq(out(kk).fs, fsout), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the dsmean method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the dsmean method can be processed back + % to an m-file. + % + % + + try + % + out = dsmean(at5,plist('fsout', 2)); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'dsmean'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'dsmean'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the dsmean method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the dsmean method can modify the input AO by calling + % with no output. + % + % + + try + % + % copy at1 to work with + fsout = 3; + pl = plist('fsout', fsout); + ain = ao(at1); + % modify ain + aout = ain.dsmean(pl); + ain.dsmean(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is dsmean(at1). + % + % + + atest = true; + if stest + % + % Check that dsmean modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that dsmean doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the dsmean of the copy + dsf = round(at1.data.fs/fsout); + n = floor(length(at1.data.y) / dsf); + y = at1.data.getY(1:n*dsf); + y = mean(reshape(y, dsf, length(y)/dsf)).'; + % Check y-axis + if ~isequal(ain.y, y), atest = false; end + % Check t0 + t0 = at1.data.t0 + dsf/(2*at1.data.fs); + if ~eq(ain.t0, t0), atest = false; end + % Check fs + if ~eq(ain.fs, fsout), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the dsmean method keeps the data shape of the input object. + % + % + function result = utp_08 + + % + % + % Test that the dsmean method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + fsout = 4; + pl = plist('fsout', fsout); + out1 = dsmean(at5, pl); + out2 = dsmean(at6, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,2) ~= 1, atest = false; end + if size(out2.data.y,1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the dsmean method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = dsmean(at5, at6); + o3 = dsmean(at5, at6); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_ecdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_ecdf.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,479 @@ +% UTP_AO_ECDF a set of UTPs for the ao/ecdf method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_ecdf.m,v 1.1 2011/07/08 13:13:59 luigi Exp $ +% + +% +% +% The ifft method of the ao class computes the inverse fast fourier +% transform of time-series AOs. +% +% + +function results = utp_ao_ecdf(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'ecdf'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call does not work + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the ecdf method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the ecdf method works for a vector of AOs as input. + % + % + + try + % + avec = [at5 at5]; + out1 = ecdf(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= numel(avec), atest = false; end + % Check each output + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the ecdf method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the ecdf method works for a matrix of AOs as input. + % + % + + try + % + amat = [at5 at5 at5; at5 at5 at5]; + out1 = ecdf(amat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= numel(amat), atest = false; end + % Check each output + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the ecdf method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the ecdf method works for a list of AOs as input. + % + % + + try + % + out1 = ecdf(at5, at5, at5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 3, atest = false; end + % Check each output + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the ecdf method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the ecdf method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out1 = ecdf(at5,[at6 at6],at5,[at5 at5; at5 at5],at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; +% aoin = [at1, reshape([at1 at1], 1, []), at1, reshape([at1 at1; at1 at1], 1, []), at1]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 9, atest = false; end + % Check each output + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the ecdf method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the ecdf method can be processed back + % to an m-file. + % + % + + try + % + out1 = ecdf(at5, at6); + mout1 = rebuild(out1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ecdf'. + % 2) % Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out1(1).hist.methodInfo.mname, 'ecdf'), atest = false; end + if ~strcmp(out1(2).hist.methodInfo.mname, 'ecdf'), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the ecdf method cannot modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the ecdf method cannot modify the input AO by calling with no + % output. + % + % + + try + % + % copy at2 to work with + ain1 = ao(at5); + % modify ain + ain1.ecdf; + % + stest = false; + catch err + disp(err.message) + stest = true; + end + + % + % + % + % + + atest = true; + + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + + %% UTP_09 + + % + % + % Check that the ecdf method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o11, o12] = ecdf(at5, at6); + no1 = ecdf(at5, at6); + mout11 = rebuild(o11); + mout12 = rebuild(o12); + moutn1 = rebuild(no1); + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o11) ~=1, atest = false; end + if numel(o12) ~=1, atest = false; end + if numel(no1) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o11, mout11, ple2), atest = false; end + if ~eq(o12, mout12, ple2), atest = false; end + if ~eq(no1, moutn1, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_eig.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_eig.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,666 @@ +% UTP_AO_EIG a set of UTPs for the ao/eig method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_eig.m,v 1.13 2011/04/17 10:09:29 hewitson Exp $ +% + +% +% +% The eig method of the ao class computes the eigenvalues of a square matrix in y +% and/or x data. +% +% + +function results = utp_ao_eig(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'eig'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with additional plist with the key 'axis' + results = [results utp_09]; % Test input data shape == output data shape + results = [results utp_10]; % Test output of the data + results = [results utp_11(mthd, at4, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = true; + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, '1D')), atest = false; end + if ~any(strcmpi(io(2).sets, '2D')), atest = false; end + if ~any(strcmpi(io(2).sets, '3D')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET '1D' + % Check key + if ~io(3).plists.isparam('axis'), atest = false; end + if ~io(3).plists.isparam('dim'), atest = false; end + if ~io(3).plists.isparam('option'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('axis'), 'y'), atest = false; end + if ~isEmptyDouble(io(3).plists.find('dim')), atest = false; end + if ~isEmptyChar(io(3).plists.find('option')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('axis'), {'y'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('dim'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('option'), {'', 'nobalance'}), atest = false; end + % SET '2D' + % Check key + if ~io(4).plists.isparam('axis'), atest = false; end + if ~io(4).plists.isparam('dim'), atest = false; end + if ~io(4).plists.isparam('option'), atest = false; end + % Check default value + if ~isequal(io(4).plists.find('axis'), 'y'), atest = false; end + if ~isEmptyDouble(io(4).plists.find('dim')), atest = false; end + if ~isEmptyChar(io(4).plists.find('option')), atest = false; end + % Check options + if ~isequal(io(4).plists.getOptionsForParam('axis'), {'x', 'y', 'xy'}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('dim'), {[]}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('option'), {'', 'nobalance'}), atest = false; end + % SET '3D' + % Check key + if ~io(5).plists.isparam('axis'), atest = false; end + if ~io(5).plists.isparam('dim'), atest = false; end + if ~io(5).plists.isparam('option'), atest = false; end + % Check default value + if ~isequal(io(5).plists.find('axis'), 'z'), atest = false; end + if ~isEmptyDouble(io(5).plists.find('dim')), atest = false; end + if ~isEmptyChar(io(5).plists.find('option')), atest = false; end + % Check options + if ~isequal(io(5).plists.getOptionsForParam('axis'), {'x', 'y', 'z', 'xyz'}), atest = false; end + if ~isequal(io(5).plists.getOptionsForParam('dim'), {[]}), atest = false; end + if ~isequal(io(5).plists.getOptionsForParam('option'), {'', 'nobalance'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the eig method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the eig method works for a vector of AOs as input. + % + % + + try + % + atvec = [at4, at4, at4]; + out = eig(atvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check each output against the eigenvalues of the input + for kk=1:numel(out) + if ~isequal(eig(atvec(kk).data.getY), out(kk).data.getY) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the eig method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the eig method works for a matrix of AOs as input. + % + % + + try + % + atmat = [at4 at4 at4; at4 at4 at4]; + out = eig(atmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check each output against the eigenvalues of the input + for kk=1:numel(out) + if ~isequal(eig(atmat(kk).data.getY), out(kk).data.getY) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the eig method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the eig method works for a list of AOs as input. + % + % + + try + % + out = eig(at4, at4, at4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the eigenvalues of the input + if ~isequal(eig(at4.data.getY), out(1).data.getY), atest = false; end + if ~isequal(eig(at4.data.getY), out(2).data.getY), atest = false; end + if ~isequal(eig(at4.data.getY), out(3).data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the eig method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the eig method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + atmat = [at4 at4; at4 at4]; + atvec = [at4 at4]; + out = eig(at4,atvec,at4,atmat,at4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(atmat)+numel(atvec)), atest = false; end + % Check the first input + nout = 1; + if ~isequal(eig(at4.data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + % Check the elements of the input vector + for jj=1:numel(atvec) + if ~isequal(eig(atvec(jj).data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + end + % Check the 3rd input + if ~isequal(eig(at4.data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + % Check the elements of the input matrix + for jj=1:numel(atmat) + if ~isequal(eig(atmat(jj).data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + end + % Check the last input + if ~isequal(eig(at4.data.getY), out(nout).data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the eig method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the eig method can be processed back + % to an m-file. + % + % + + try + % + out = eig(at4); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'eig'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'eig'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the eig method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the eig method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at4 to work with + ain = ao(at4); + % modify ain + aout = ain.eig(); + ain.eig(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at4' and 'ain' are now different. + % 2) Check that 'ain' is eig(at4). + % + % + + atest = true; + if stest + % + % Check that eig modified the input by comparing to the copy + if eq(ao(at4), ain, ple1), atest = false; end + % Check that eig doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the eig value of the copy + if ~isequal(eig(at4.data.getY), ain.data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the eig method can modify the single axis controlled by the + % plist and the resuld can be processed back to an m-file. + % + % + + try + % + op1 = 'nobalance'; + op2 = [9 8 7; 6 5 4; 3 2 1]; + pl0 = plist('option', op1); + pl1 = plist('option', op2); + out1 = eig(at4, pl0); + out2 = eig(at4, pl1); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the svd method applies with different options. + % 2) Check that the re-built objects are the same object as 'out[1..2]'. + % + % + + atest = true; + if stest + % + % Check each output against the eigenvalues of the input + if ~isequal(eig(at4.data.getY, op1), out1.data.getY), atest = false; end + if ~isequal(eig(at4.data.getY, op2), out2.data.getY), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Control the method with a plist. + % + % + function result = utp_09 + + % + % + % Test that the eig method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = eig(at4); + out2 = eig(at4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y) ~= size(eig(at4.data.y)), atest = false; end + if size(out2.data.y) ~= size(eig(at4.data.y)), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the eig method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_10 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + at4_10 = at4+10; + [o1, o2] = eig(at4, at4_10); + o3 = eig(at4, at4_10); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_eq.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_eq.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,918 @@ +% UTP_AO_EQ a set of UTPs for the ao/eq method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_eq.m,v 1.11 2011/04/19 18:14:00 ingo Exp $ +% + +% +% +% The eq() method of the ao class ao1 == ao2 compares each element of an +% analysis object with the corresponding element of an second analysis object +% and returns a logical 1 (true) where ao1 and ao2 are equal, +% or logical 0 (false) where they are not equal. +% +% + +function results = utp_ao_eq(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'eq'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test with the exception list 'name' + results = [results utp_08]; % Test with the exception list 'plotinfo' + results = [results utp_09]; % Test with the exception list 't0' + results = [results utp_10]; % Test with the exception list 'x' + results = [results utp_11]; % Test with the exception list 'y' + results = [results utp_12]; % Test with the exception list 'xunits' + results = [results utp_13]; % Test with the exception list 'yunits' + results = [results utp_14]; % Test with the exception list 'fs' + results = [results utp_15]; % Test with the exception list 'description' + results = [results utp_16]; % Test exception list in a plist + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check number of SETS + if numel(io(2).sets) ~= 1, atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + % SET 'Default' + % Check key + if ~io(3).plists.isparam('Exceptions'), atest = false; end + if ~io(3).plists.isparam('Tol'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('Exceptions'), {}), atest = false; end + if ~isequal(io(3).plists.find('Tol'), eps(1)), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('Exceptions'), {{}}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('Tol'), {eps(1)}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the eq method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the eq method works for a vector of AOs as input. Test the + % positive and the negative case. + % + % + + try + % + aa = at1.setName('my name'); + avec1 = [at4, at3, at2, at1]; + avec2 = [at4, at3, at2, aa]; + out1 = eq(avec1, avec1); + out2 = eq(avec1, avec2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the eq function. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the eq method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the eq method works for a matrix of AOs as input. Test the + % positive and the negative case. + % + % + + try + % + aa = at1.setName('my name'); + amat1 = [at4, at3, at1, at1, at2, at4]; + amat2 = [at4, at3, aa; at1, at2, at4]; + out1 = eq(amat1, amat1); + out2 = eq(amat1, amat2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the eq function. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the eq method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % The eq method doesn't works for a list of AOs as input. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the eq method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % The eq method doesn't works for a list of AOs as input. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the eq method properly applies history. + % + % + function result = utp_06 + + % + % + % The eq method doesn't change the AO, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_07 + + % + % + % Test the eq method with the exception 'name'. Use the option 'internal' to + % suppress the history. It is necessary to add 'created' to the exception + % list because aa is created at an other time. + % + % + + try + % + aa = testCallerIsMethod(@setName, at1, 'my name'); + out1 = eq(aa, at1); + out2 = eqLocal(aa, at1, 'name'); + out3 = eqLocal(aa, at1, 'ao/name'); + out4 = eq(aa.hist, at1.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_08 + + % + % + % Test the eq method with the exception 'plotinfo'. Use the option 'internal' to + % suppress the history. It is necessary to add 'created' to the exception + % list because aa is created at an other time. + % + % + + try + % + aa = testCallerIsMethod(@setPlotinfo, at1, plist('line', 'k')); + out1 = eq(aa, at1); + out2 = eqLocal(aa, at1, 'plotinfo'); + out3 = eqLocal(aa, at1, 'ao/plotinfo'); + out4 = eq(aa.hist, at1.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_09 + + % + % + % Test the eq method with the exception 't0'. Use the option 'internal' to + % suppress the history. It is necessary to add 'created' to the exception + % list because aa is created at an other time. + % + % + + try + % + aa = testCallerIsMethod(@setT0, at1, time(123)); + out1 = eq(aa, at1); + out2 = eqLocal(aa, at1, 't0'); + out3 = eqLocal(aa, at1, 'tsdata/t0'); + out4 = eq(aa.hist, at1.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_10 + + % + % + % Test the eq method with the exception 'x'. Use the option 'internal' to + % suppress the history. It is necessary to add 'created' to the exception + % list because aa is created at an other time. + % + % + + try + % + aa = testCallerIsMethod(@setX, at1, randn(300,1)); + out1 = eq(aa, at1); + out2 = eqLocal(aa, at1, 'x'); + out3 = eqLocal(aa, at1, 'tsdata/x'); + out4 = eq(aa.hist, at1.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_11 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_11 + + % + % + % Test the eq method with the exception 'y'. Use the option 'internal' to + % suppress the history. It is necessary to add 'created' to the exception + % list because aa is created at an other time. + % + % + + try + % + aa = testCallerIsMethod(@setY, at1, randn(300,1)); + out1 = eq(aa, at1); + out2 = eqLocal(aa, at1, 'y'); + out3 = eqLocal(aa, at1, 'tsdata/y'); + out4 = eq(aa.hist, at1.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_11 + + %% UTP_12 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_12 + + % + % + % Test the eq method with the exception 'xunits'. Use the option 'internal' to + % suppress the history. It is necessary to add 'created' to the exception + % list because aa is created at an other time. + % + % + + try + % + aa = testCallerIsMethod(@setXunits, at1, 'Hz s^-2/3'); + out1 = eq(aa, at1); + out2 = eqLocal(aa, at1, 'xunits'); + out3 = eqLocal(aa, at1, 'tsdata/xunits'); + out4 = eq(aa.hist, at1.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_13 + + % + % + % Test the eq method with the exception 'yunits'. Use the option 'internal' to + % suppress the history. It is necessary to add 'created' to the exception + % list because aa is created at an other time. + % + % + + try + % + aa = testCallerIsMethod(@setYunits, at1, 'Hz s^-2/3'); + out1 = eq(aa, at1); + out2 = eqLocal(aa, at1, {'yunits', 'hist'}); + out3 = eqLocal(aa, at1, {'tsdata/yunits', 'hist'}); + out4 = eq(aa.hist, at1.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + %% UTP_14 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_14 + + % + % + % Test the eq method with the exception 'fs'. Use the option 'internal' to + % suppress the history. It is necessary to add 'created' to the exception + % list because aa is created at an other time. + % + % + + try + % + aa = testCallerIsMethod(@setFs, at2, 123.123); + out1 = eq(aa, at2); + out2 = eqLocal(aa, at2, 'fs'); + out3 = eqLocal(aa, at2, 'fsdata/fs'); + out4 = eq(aa.hist, at2.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_14 + + %% UTP_15 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_15 + + % + % + % Test the eq method with the exception 'description'. Use the option 'internal' to + % suppress the history. It is necessary to add 'created' to the exception + % list because aa is created at an other time. + % + % + + try + % + aa = testCallerIsMethod(@setDescription, at1, 'my description'); + out1 = eq(aa, at1); + out2 = eqLocal(aa, at1, 'description'); + out3 = eqLocal(aa, at1, 'ao/description'); + out4 = eq(aa.hist, at1.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_15 + + %% UTP_16 + + % + % + % Test the eq method with an exception list which is in a plist. + % + % + function result = utp_16 + + % + % + % Test that the eq method uses the exception list in a plist. + % + % + + try + % + aa = testCallerIsMethod(@setName, at1, 'my name'); + pl = plist('Exceptions', {'name', 'UUID'}); + out1 = eq(aa, at1); + out2 = eq(aa, at1, pl); + out3 = eq(aa, at1, pl); + out4 = eq(aa.hist, at1.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_16 + + function res = eqLocal(obj1, obj2, ex) + e = ple1.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e cellstr(ex)]); + + res = eq(obj1, obj2, ple); + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_exp.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_exp.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,127 @@ +% UTP_AO_EXP a set of UTPs for the ao/exp method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_exp.m,v 1.13 2011/04/17 10:48:51 hewitson Exp $ +% + +% +% +% The exp method of the ao class computes the exponential of the y +% and/or x data. +% +% + +function results = utp_ao_exp(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'exp'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple2)]; % Test the modify call works + results = [results utp_08(mthd, at1, ple2)]; % Test with additional plist with the key 'axis' + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at1, at2, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(exp(in.data.getY), out.data.getY) + atest = false; + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_export.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_export.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,344 @@ +% UTP_AO_EXPORT a set of UTPs for the ao/export method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_export.m,v 1.4 2011/04/18 16:57:44 ingo Exp $ +% + +% +% +% The export method of the ao class export an analysis object data to a +% text file. This is a very simple method which accepts only one parfrac as +% input thus are the most general units test not possible. +% +% + +function results = utp_ao_export(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'export'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Test with non complex data + results = [results utp_03]; % Test with complex data + results = [results utp_04]; % List with plist(filename) + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('filename'), atest = false; end + if ~io(3).plists.isparam('complex format'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('filename')), atest = false; end + if ~isequal(io(3).plists.find('complex format'), 'realimag'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('filename'), {''}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('complex format'), {'absdeg', 'realimag', 'absrad'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the export method works with non complex data in the AO. + % + % + function result = utp_02 + + % + % + % Tests that the export method works with non complex data in the AO. + % + % + + try + % + plts = plist('fs', '1', 'nsecs', 30, 'tsfcn', 'randn(size(t))'); + plfs = plist('f', '1:30', 'fsfcn', 'randn(size(f))'); + plxy = plist('x', '1:30', 'xyfcn', 'randn(size(x))'); + fn1 = ('at1.txt'); + fn2 = ('at2.txt'); + fn3 = ('at3.txt'); + at1 = ao(plts); + at2 = ao(plfs); + at3 = ao(plxy); + + export(at1, fn1); + export(at2, fn2); + export(at3, fn3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the file exist. + % 2) Check that the read data is the same as the saved data. + % + % + + atest = true; + if stest + % + % Check that the file exist + if exist(fn1, 'file') ~= 2, atest = false; end + if exist(fn2, 'file') ~= 2, atest = false; end + if exist(fn3, 'file') ~= 2, atest = false; end + % Check that the read data is the same as the saved data + a1 = ao(fn1, plist('type', 'tsdata', 'columns', [1 2])); + a2 = ao(fn2, plist('type', 'fsdata', 'columns', [1 2])); + a3 = ao(fn3, plist('type', 'xydata', 'columns', [1 2])); + if ~isequal(at1.x, a1.x), atest = false; end + if ~isequal(at1.y, a1.y), atest = false; end + if ~isequal(at2.x, a2.x), atest = false; end + if ~isequal(at2.y, a2.y), atest = false; end + if ~isequal(at3.x, a3.x), atest = false; end + if ~isequal(at3.y, a3.y), atest = false; end + % + delete(fn1); + delete(fn2); + delete(fn3); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the export method works with complex data in the AO. + % + % + function result = utp_03 + + % + % + % Tests that the export method works with complex data in the AO. + % + % + + try + % + plts = plist('fs', '1', 'nsecs', 30, 'tsfcn', 'randn(size(t)) + randn(size(t))*i'); + plfs = plist('f', '1:30', 'fsfcn', 'randn(size(f)) + randn(size(f))*i'); + plxy = plist('x', '1:30', 'xyfcn', 'randn(size(x)) + randn(size(x))*i'); + fn1 = ('at1.txt'); + fn2 = ('at2.txt'); + fn3 = ('at3.txt'); + at1 = ao(plts); + at2 = ao(plfs); + at3 = ao(plxy); + + export(at1, fn1); + export(at2, fn2); + export(at3, fn3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the file exist. + % 2) Check that the read data is the same as the saved data. + % + % + + atest = true; + if stest + % + % Check that the file exist + if exist(fn1, 'file') ~= 2, atest = false; end + if exist(fn2, 'file') ~= 2, atest = false; end + if exist(fn3, 'file') ~= 2, atest = false; end + % Check that the read data is the same as the saved data + a1r = ao(fn1, plist('type', 'tsdata', 'columns', [1 2])); + a1c = ao(fn1, plist('type', 'tsdata', 'columns', [1 3])); + a2r = ao(fn2, plist('type', 'fsdata', 'columns', [1 2])); + a2c = ao(fn2, plist('type', 'fsdata', 'columns', [1 3])); + a3r = ao(fn3, plist('type', 'xydata', 'columns', [1 2])); + a3c = ao(fn3, plist('type', 'xydata', 'columns', [1 3])); + a1 = complex(a1r, a1c); + a2 = complex(a2r, a2c); + a3 = complex(a3r, a3c); + if ~isequal(at1.x, a1.x), atest = false; end + if ~isequal(at1.y, a1.y), atest = false; end + if ~isequal(at2.x, a2.x), atest = false; end + if ~isequal(at2.y, a2.y), atest = false; end + if ~isequal(at3.x, a3.x), atest = false; end + if ~isequal(at3.y, a3.y), atest = false; end + % + delete(fn1); + delete(fn2); + delete(fn3); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the export method works with a plist which contains the filename. + % + % + function result = utp_04 + + % + % + % Tests that the export method works with a plist which contains the + % filename. + % + % + + try + % + plts = plist('fs', '1', 'nsecs', 30, 'tsfcn', 'randn(size(t)) + randn(size(t))*i'); + plfs = plist('f', '1:30', 'fsfcn', 'randn(size(f))'); + fn1 = ('at1.txt'); + fn2 = ('at2.txt'); + at1 = ao(plts); + at2 = ao(plfs); + + export(at1, plist('filename', fn1)); + export(at2, plist('filename', fn2)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the file exist. + % 2) Check that the read data is the same as the saved data. + % + % + + atest = true; + if stest + % + % Check that the file exist + if exist(fn1, 'file') ~= 2, atest = false; end + if exist(fn2, 'file') ~= 2, atest = false; end + % Check that the read data is the same as the saved data + a1r = ao(fn1, plist('type', 'tsdata', 'columns', [1 2])); + a1c = ao(fn1, plist('type', 'tsdata', 'columns', [1 3])); + a2 = ao(fn2, plist('type', 'fsdata', 'columns', [1 2])); + a1 = complex(a1r, a1c); + if ~isequal(at1.x, a1.x), atest = false; end + if ~isequal(at1.y, a1.y), atest = false; end + if ~isequal(at2.x, a2.x), atest = false; end + if ~isequal(at2.y, a2.y), atest = false; end + % + delete(fn1); + delete(fn2); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_fft.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_fft.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,345 @@ +% UTP_AO_FFT a set of UTPs for the ao/fft method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_fft.m,v 1.13 2011/02/04 11:08:54 luigi Exp $ +% + +% +% +% The fft method of the ao class computes the fast fourier transform of +% time-series AOs. +% +% + +function results = utp_ao_fft(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'fft'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + atvec = [at1 at5 at6]; + atmat = [at1 at5 at6; at5 at6 at1]; + + results = [results utp_01]; % getInfo call + + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at5, at6, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, plist('neval', true), ple2)]; % Test the modify call works + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at1, at5, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + results = [results utp_12]; % Test against MATLAB's fft + results = [results utp_13]; % Test with different data types + results = [results utp_14]; % Test with plist: 'type' = 'two' + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + fs = in.data.fs; + fmin = 0; + nfft = length(in.y); + ft = fft(in.y); + ft = ft(1:nfft/2+1); + f = linspace(fmin, fs/2, length(ft)).'; + % Check y-axis + if ~isequal(out.y, ft), atest = false; end + % Check x-axis + if ~isequal(out.x, f), atest = false; end + % Check fs + if ~isequal(out.fs, fs), atest = false; end + % Check units + if ~eq(out.xunits, unit('Hz')), atest = false; end + if ~eq(out.yunits, in.yunits), atest = false; end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('type'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('type'), 'one'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('type'), {'plain', 'one', 'two'}), atest = false; end + % Check key + if ~io(3).plists.isparam('scale'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('scale'), false), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('scale'), paramValue.FALSE_TRUE{2}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_12 + + % + % + % Tests that the fft method agrees with MATLAB's fft when + % configured to use the same parameters. + % + % + function result = utp_12 + + % + % + % Test that the applying fft works on a single AO. + % + % + + try + % + % Construct two test AOs + nsecs = 10; + fs = 1000; + pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'randn(size(t))'); + a1 = ao(pl); + % Compute fft + out = fft(a1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that output agrees with the output of MATLAB's fft. + % + % + + atest = true; + if stest + % + % Compute fft using MATLAB's fft + % ao/fft returns only one-sided fft (0-Nyquist) + yxx = fft(a1.data.y); + if ~isequal(yxx(1:length(yxx)/2+1), out.data.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Tests that the fft method works with different data types. The testing of + % tsdata types are done before. + % + % + function result = utp_13 + + % + % + % Test that the applying fft works on cdata and xydata. + % + % + + try + % + % Compute fft + out3 = fft(at3); + out4 = fft(at4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Compute fft for cdata and xydata + fs = 2+length(at3.y); + nfft = length(at3.y); + ft = fft(at3.y); + ft = ft(1:nfft/2+1); + f = (0:floor(nfft/2)).*fs./nfft; + % Check y-axis + if ~isequal(out3.y, ft), atest = false; end + % Check x-axis + if ~isequal(out3.x, f.'), atest = false; end + % Check fs + if ~isequal(out3.fs, fs), atest = false; end + % Check units + if ~eq(out3.xunits, unit('Hz')), atest = false; end + if ~eq(out3.yunits, at3.yunits), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + %% UTP_14 + + % + % + % Tests that the fft method works with a plist which constains the key/value + % pair 'type'/'two'. + % + % + function result = utp_14 + + % + % + % Test that the applying fft works with a plist. + % + % + + try + % + pl = plist('type', 'two'); + % Compute fft + out = fft(at5, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output AO contains the correct data. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Compute fft for cdata and xydata + fs = at5.data.fs; + nfft = length(at5.y); + ft = fft(at5.data.y); + ft = fftshift(ft); + f = fftshift([0:floor(nfft/2)-1 -floor(nfft/2):-1].*fs./nfft); + % Check y-axis + if ~isequal(out.y, ft), atest = false; end + % Check x-axis + if ~isequal(out.x, f.'), atest = false; end + % Check fs + if ~isequal(out.fs, fs), atest = false; end + % Check units + if ~eq(out.xunits, unit('Hz')), atest = false; end + if ~eq(out.yunits, at5.yunits), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_14 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_fftfilt.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_fftfilt.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,706 @@ +% UTP_AO_FFTFILT a set of UTPs for the ao/fftfilt method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_fftfilt.m,v 1.9 2011/05/28 05:38:23 mauro Exp $ +% + +% +% +% The ifft method of the ao class computes the inverse fast fourier +% transform of time-series AOs. +% +% + +function results = utp_ao_fftfilt(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'fftfilt'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + % Test filter objects + [iirhp,iirlp,iirbp,iirbr,iirpzm,iirab,iirv,iirm] = get_test_objects_miir; + [firhp,firlp,firbp,firbr,firpzm,firao,firv,firm] = get_test_objects_mfir; + [ra1,ra2,ra3,rav,ram] = get_test_objects_rational; + [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel; + [pf1,pf2,pf3,pfv,pfm] = get_test_objects_parfrac; + + % NOTE: smodel filtering will be tested as soon as standard test + % objects will be added + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test the data shape + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 3, atest = false; end + % Check key + if ~io(3).plists.isparam('filter'), atest = false; end + if ~io(3).plists.isparam('Npad'), atest = false; end + if ~io(3).plists.isparam('Initial Conditions'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('filter'), ''), atest = false; end + if ~isequal(io(3).plists.find('Npad'), []), atest = false; end + if ~isequal(io(3).plists.find('Initial Conditions'), {}), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('filter'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('Npad'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('Initial Conditions'), {{}}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the fftfilt method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the fftfilt method works for a vector of AOs as input. + % + % + + try + % + avec = [at1 at1]; + out1 = fftfilt(avec, redesign(iirlp, at1.fs)); + out2 = fftfilt(avec, redesign(firlp, at1.fs)); + out3 = fftfilt(avec, ra1); + out4 = fftfilt(avec, pz1); + out5 = fftfilt(avec, pf1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= numel(avec), atest = false; end + if numel(out2) ~= numel(avec), atest = false; end + if numel(out3) ~= numel(avec), atest = false; end + if numel(out4) ~= numel(avec), atest = false; end + if numel(out5) ~= numel(avec), atest = false; end + % Check each output + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the fftfilt method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the fftfilt method works for a matrix of AOs as input. + % + % + + try + % + amat = [at1 at1 at1; at1 at1 at1]; + out1 = fftfilt(amat, redesign(iirlp, at1.fs)); + out2 = fftfilt(amat, redesign(firlp, at1.fs)); + out3 = fftfilt(amat, ra1); + out4 = fftfilt(amat, pz1); + out5 = fftfilt(amat, pf1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= numel(amat), atest = false; end + if numel(out2) ~= numel(amat), atest = false; end + if numel(out3) ~= numel(amat), atest = false; end + if numel(out4) ~= numel(amat), atest = false; end + if numel(out5) ~= numel(amat), atest = false; end + % Check each output + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the fftfilt method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the fftfilt method works for a list of AOs as input. + % + % + + try + % + out1 = fftfilt(at1, at1, at1, redesign(iirlp, at1.fs)); + out2 = fftfilt(at1, at1, at1, redesign(firlp, at1.fs)); + out3 = fftfilt(at1, at1, at1, ra1); + out4 = fftfilt(at1, at1, at1, pz1); + out5 = fftfilt(at1, at1, at1, pf1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; +% aoin = [at1, at1, at1]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 3, atest = false; end + if numel(out2) ~= 3, atest = false; end + if numel(out3) ~= 3, atest = false; end + if numel(out4) ~= 3, atest = false; end + if numel(out5) ~= 3, atest = false; end + % Check each output + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the fftfilt method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the fftfilt method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out1 = fftfilt(at1,[at1 at1],at1,[at1 at1; at1 at1],at1, redesign(iirlp, at1.fs)); + out2 = fftfilt(at1,[at1 at1],at1,[at1 at1; at1 at1],at1, redesign(firlp, at1.fs)); + out3 = fftfilt(at1,[at1 at1],at1,[at1 at1; at1 at1],at1, ra1); + out4 = fftfilt(at1,[at1 at1],at1,[at1 at1; at1 at1],at1, pz1); + out5 = fftfilt(at1,[at1 at1],at1,[at1 at1; at1 at1],at1, pf1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; +% aoin = [at1, reshape([at1 at1], 1, []), at1, reshape([at1 at1; at1 at1], 1, []), at1]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 9, atest = false; end + if numel(out2) ~= 9, atest = false; end + if numel(out3) ~= 9, atest = false; end + if numel(out4) ~= 9, atest = false; end + if numel(out5) ~= 9, atest = false; end + % Check each output + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the fftfilt method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the fftfilt method can be processed back + % to an m-file. + % + % + + try + % + out1 = fftfilt(at1, redesign(iirlp, at1.fs)); + out2 = fftfilt(at1, redesign(firlp, at1.fs)); + out3 = fftfilt(at1, ra1); + out4 = fftfilt(at1, pz1); + out5 = fftfilt(at1, pf1); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + mout5 = rebuild(out5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'fftfilt'. + % 2) % Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'fftfilt'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'fftfilt'), atest = false; end + if ~strcmp(out3.hist.methodInfo.mname, 'fftfilt'), atest = false; end + if ~strcmp(out4.hist.methodInfo.mname, 'fftfilt'), atest = false; end + if ~strcmp(out5.hist.methodInfo.mname, 'fftfilt'), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + if ~eq(mout4, out4, ple2), atest = false; end + if ~eq(mout5, out5, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the fftfilt method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the fftfilt method can modify the input AO by calling with no + % output. + % + % + + try + % + % copy at2 to work with + ain1 = ao(at5); + ain2 = ao(at5); + ain3 = ao(at5); + ain4 = ao(at5); + ain5 = ao(at5); + % modify ain + out1 = fftfilt(ain1, redesign(iirlp, ain1.fs)); + out2 = fftfilt(ain2, redesign(firlp, ain2.fs)); + out3 = fftfilt(ain3, ra1); + out4 = fftfilt(ain4, pz1); + out5 = fftfilt(ain5, pf1); + ain1.fftfilt(redesign(iirlp, ain1.fs)); + ain2.fftfilt(redesign(firlp, ain2.fs)); + ain3.fftfilt(ra1); + ain4.fftfilt(pz1); + ain5.fftfilt(pf1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at2' and 'ain' are now different. + % 2) Check that 'ain' is fftfilt(at2). + % + % + + atest = true; + if stest + % + % Check that fftfilt modified the input by comparing to the copy + if eq(ao(at5), ain1, ple1), atest = false; end + if eq(ao(at5), ain2, ple1), atest = false; end + if eq(ao(at5), ain3, ple1), atest = false; end + if eq(ao(at5), ain4, ple1), atest = false; end + if eq(ao(at5), ain5, ple1), atest = false; end + + % Check that fftfilt doesn't modified the input for the function + % notation + if ~eq(out1, ain1, ple1), atest = false; end + if ~eq(out2, ain2, ple1), atest = false; end + if ~eq(out3, ain3, ple1), atest = false; end + if ~eq(out4, ain4, ple1), atest = false; end + if ~eq(out5, ain5, ple1), atest = false; end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the fftfilt method keeps the data shape of the input object. + % + % + function result = utp_08 + + % + % + % Test that the fftfilt method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out11 = fftfilt(at5, redesign(iirlp, at5.fs)); + out12 = fftfilt(at6, redesign(iirlp, at6.fs)); + out21 = fftfilt(at5, redesign(firlp, at5.fs)); + out22 = fftfilt(at6, redesign(firlp, at6.fs)); + out31 = fftfilt(at5, ra1); + out32 = fftfilt(at6, ra1); + out41 = fftfilt(at5, pz1); + out42 = fftfilt(at6, pz1); + out51 = fftfilt(at5, pf1); + out52 = fftfilt(at6, pf1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out11.data.y,1) == 1, atest = false; end + if size(out12.data.y,2) == 2, atest = false; end + if size(out21.data.y,1) == 1, atest = false; end + if size(out22.data.y,2) == 2, atest = false; end + if size(out31.data.y,1) == 1, atest = false; end + if size(out32.data.y,2) == 2, atest = false; end + if size(out41.data.y,1) == 1, atest = false; end + if size(out42.data.y,2) == 2, atest = false; end + if size(out51.data.y,1) == 1, atest = false; end + if size(out52.data.y,2) == 2, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the fftfilt method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o11, o12] = fftfilt(at5, at6, redesign(iirlp, 10)); + no1 = fftfilt(at5, at6, redesign(iirlp, 10)); + mout11 = rebuild(o11); + mout12 = rebuild(o12); + moutn1 = rebuild(no1); + + [o21, o22] = fftfilt(at5, at6, redesign(firlp, 10)); + no2 = fftfilt(at5, at6, redesign(firlp, 10)); + mout21 = rebuild(o21); + mout22 = rebuild(o22); + moutn2 = rebuild(no2); + + [o31, o32] = fftfilt(at5, at6, ra1); + no3 = fftfilt(at5, at6, ra1); + mout31 = rebuild(o31); + mout32 = rebuild(o32); + moutn3 = rebuild(no3); + + [o41, o42] = fftfilt(at5, at6, pz1); + no4 = fftfilt(at5, at6, pz1); + mout41 = rebuild(o41); + mout42 = rebuild(o42); + moutn4 = rebuild(no4); + + [o51, o52] = fftfilt(at5, at6, pf1); + no5 = fftfilt(at5, at6, pf1); + mout51 = rebuild(o51); + mout52 = rebuild(o52); + moutn5 = rebuild(no5); + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o11) ~=1, atest = false; end + if numel(o12) ~=1, atest = false; end + if numel(no1) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o11, mout11, ple2), atest = false; end + if ~eq(o12, mout12, ple2), atest = false; end + if ~eq(no1, moutn1, ple2), atest = false; end + + % Check the number of outputs + if numel(o21) ~=1, atest = false; end + if numel(o22) ~=1, atest = false; end + if numel(no2) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o21, mout21, ple2), atest = false; end + if ~eq(o22, mout22, ple2), atest = false; end + if ~eq(no2, moutn2, ple2), atest = false; end + + % Check the number of outputs + if numel(o31) ~=1, atest = false; end + if numel(o32) ~=1, atest = false; end + if numel(no3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o31, mout31, ple2), atest = false; end + if ~eq(o32, mout32, ple2), atest = false; end + if ~eq(no3, moutn3, ple2), atest = false; end + + % Check the number of outputs + if numel(o41) ~=1, atest = false; end + if numel(o42) ~=1, atest = false; end + if numel(no4) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o41, mout41, ple2), atest = false; end + if ~eq(o42, mout42, ple2), atest = false; end + if ~eq(no4, moutn4, ple2), atest = false; end + + % Check the number of outputs + if numel(o51) ~=1, atest = false; end + if numel(o52) ~=1, atest = false; end + if numel(no5) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o51, mout51, ple2), atest = false; end + if ~eq(o52, mout52, ple2), atest = false; end + if ~eq(no5, moutn5, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_filtSubtract.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_filtSubtract.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,424 @@ +% UTP_AO_FILTSUBTRACT a set of UTPs for the ao/filtSubtract method +% +% M Nofrarias 05-07-09 +% +% $Id: utp_ao_filtSubtract.m,v 1.3 2011/04/17 15:46:21 ingo Exp $ +% + +% +% +% FILTSUBTRACT subtracts a frequency dependent noise contribution from an +% input ao. +% +% + +function results = utp_ao_filtSubtract(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'filtSubtract'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + at1.setYunits('Hz'); + at2.setYunits('Hz'); + at3.setYunits('Hz'); + at4.setYunits('Hz'); + at5.setYunits('Hz'); + at6.setYunits('Hz'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test output of the data + + % + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + % + try + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + % + atest = true; + if stest + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 5, atest = false; end + % Check key + % Check default value + % Check options + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the filtSubtract method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the filtSubtract method works for a vector of AOs as input. + % + % + + % + try + avec = [at1 at5]; + fs = at1.fs; + out = filtSubtract(avec); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the filtSubtract method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the filtSubtract method works for a matrix of AOs as input. + % + % + + % + try + amat = [at1; at5]; + out = filtSubtract(amat); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the filtSubtract method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the filtSubtract method works for a list of AOs as input. + % + % + + % + try + out = filtSubtract(at1,at5); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + % + % + % Tests that the filtSubtract method works with a mix of different shaped AOs as + % input. + % + % DOES NOT APPLY TO THIS METHOD + % + % + function result = utp_05 + + % + % + % Test that the filtSubtract method works with an input of matrices and vectors + % and single AOs. + % + % + + % + try +% out = filtSubtract(at1,[at5 at6],at5,[at5 at1; at6 at1],at6,pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs +% if numel(out) ~= 1, atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + % + % + % Tests that the filtSubtract method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the filtSubtract method can be processed back + % to an m-file. + % + % + + % + try + out = filtSubtract(at1,at5); + mout = rebuild(out); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'filtSubtract'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + % + atest = true; + if stest + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'filtSubtract'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the filtSubtract method can not modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the tfe method can not modify the input AO. + % The method must throw an error for the modifier call. + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + ain.filtSubtract(at1,at5,at6); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + + +end + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_filter.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_filter.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,1374 @@ +% UTP_AO_FILTER a set of UTPs for the ao/filter method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_filter.m,v 1.25 2011/04/19 18:14:00 ingo Exp $ +% + +% +% +% The filter method of the ao class filters time-series AOs. +% +% + +function results = utp_ao_filter(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'filter'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + pli = plist('filter', miir(plist('type', 'lowpass'))); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test the data shape + results = [results utp_09]; % Test with miir filter and different fs + results = [results utp_10]; % Test with mfir filter + + results = [results utp_11(mthd, at1, ple1, pli)]; % Test plotinfo doesn't disappear + + results = [results utp_12]; % Test with fsdata + miir filter + results = [results utp_13]; % Test with parallel filter bank + results = [results utp_14]; % Test with serial filter bank + results = [results utp_15]; % Test with fsdata and parallel filter bank + results = [results utp_16]; % Test with fsdata and serial filter bank + + results = [results utp_17]; % Test with fsdata + mfir filter + + results = [results utp_18]; % Test with tsdata + 1D matrix in a plist + results = [results utp_19]; % Test with tsdata + 1D matrix as second input + results = [results utp_20]; % Test with tsdata + 2D matrix in a plist (test it do not work) + results = [results utp_21]; % Test with tsdata + 2D matrix as second input (test it do not work) + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(3).plists.isparam('filter'), atest = false; end + if ~io(3).plists.isparam('gdoff'), atest = false; end + if ~io(3).plists.isparam('bank'), atest = false; end + if ~io(3).plists.isparam('initialize'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('filter')), atest = false; end + if ~isequal(io(3).plists.find('gdoff'), 'no'), atest = false; end + if ~isequal(io(3).plists.find('bank'), 'parallel'), atest = false; end + if ~isequal(io(3).plists.find('initialize'), false), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('filter'), {''}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('gdoff'), {'yes', 'no'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('bank'), {'parallel', 'serial'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('initialize'), {false true}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the filter method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the filter method works for a vector of AOs as input. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = miir(plist('type', 'highpass', 'fs', 10, 'iunits', iunits, 'ounits', ounits)); + pl = plist('filter', fobj); + avec = [at5 at6]; + out = filter(avec, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % 3) Check the output-filter + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + % Check the output data + for kk = 1:numel(avec) + % don't init the history of the filter + [y, Zf] = filter(fobj.a, fobj.b, avec(kk).y, fobj.histout); + % Check y-axis + if ~isequal(out(kk).y, y), atest = false; end + % y-units: yunits.*ounits./iunits + if ~eq(out(kk).yunits, avec(kk).data.yunits.*ounits./iunits), atest = false; end + % check the output filter in ao.procinfo + fout = find(out(kk).procinfo, 'Filter'); + if ~isa(fout, 'miir'), atest = false; end + if ~isequal(fout.histout, Zf), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the filter method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the filter method works for a matrix of AOs as input. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = miir(plist('type', 'highpass', 'fs', 10, 'iunits', iunits, 'ounits', ounits)); + pl = plist('filter', fobj); + amat = [at1 at5 at6; at5 at6 at1]; + out = filter(amat, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % 3) Check the output-filter + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + % Check the output data + for kk = 1:numel(amat) + % Don't init the history of the filter + [y, Zf] = filter(fobj.a, fobj.b, amat(kk).y, fobj.histout); + % Check y-axis + if ~isequal(out(kk).y, y), atest = false; end + % y-units: yunits.*ounits./iunits + if ~eq(out(kk).yunits, amat(kk).data.yunits.*ounits./iunits), atest = false; end + % Check filter + fout = find(out(kk).procinfo, 'Filter'); + if ~isa(fout, 'miir'), atest = false; end + if ~isequal(fout.histout, Zf), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the filter method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the filter method works for a list of AOs as input. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = miir(plist('type', 'highpass', 'fs', 10, 'iunits', iunits, 'ounits', ounits)); + pl = plist('filter', fobj); + out = filter(at1,at5,at6,pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, at5, at6]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check the output data + for kk = 1:numel(aoin) + % Don't init the history of the filter + [y, Zf] = filter(fobj.a, fobj.b, aoin(kk).y, fobj.histout); + % Check y-axis + if ~isequal(out(kk).y, y), atest = false; end + % y-units: yunits.*ounits./iunits + if ~eq(out(kk).yunits, aoin(kk).data.yunits.*ounits./iunits), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the filter method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the filter method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = miir(plist('type', 'highpass', 'fs', 10, 'iunits', iunits, 'ounits', ounits)); + pl = plist('filter', fobj); + out = filter(at1,[at5 at6],at5,[at5 at1; at6 at1],at6,pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, reshape([at5 at6], 1, []), at5, reshape([at5 at1; at6 at1], 1, []), at6]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + % Check the output data + for kk = 1:numel(aoin) + % Don't init the history of the filter + [y, Zf] = filter(fobj.a, fobj.b, aoin(kk).y, fobj.histout); + % Check y-axis + if ~isequal(out(kk).y, y), atest = false; end + % y-units: yunits.*ounits./iunits + if ~eq(out(kk).yunits, aoin(kk).data.yunits.*ounits./iunits), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the filter method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the filter method can be processed back + % to an m-file. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = miir(plist('type', 'highpass', 'fs', 10, 'iunits', iunits, 'ounits', ounits)); + pl = plist('filter', fobj); + out = filter(at5,pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'filter'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'filter'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the filter method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the filter method can modify the input AO by calling + % with no output. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = miir(plist('type', 'highpass', 'fs', 10, 'iunits', iunits, 'ounits', ounits)); + pl = plist('filter', fobj); + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = ain.filter(pl); + ain.filter(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is filter(at1). + % + % + + atest = true; + if stest + % + % Check that filter modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that filter doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the filter of the copy + % Don't init the history of the filter + [y, Zf] = filter(fobj.a, fobj.b, at1.y, fobj.histout); + % Check y-axis + if ~isequal(ain.y, y), atest = false; end + % y-units: yunits.*ounits./iunits + if ~eq(ain.yunits, at1.data.yunits.*ounits./iunits), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the filter method keeps the data shape of the input object. + % + % + function result = utp_08 + + % + % + % Test that the filter method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = miir(plist('type', 'highpass', 'fs', 10, 'iunits', iunits, 'ounits', ounits)); + pl = plist('filter', fobj); + out1 = filter(at5, pl); + out2 = filter(at6, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y, 2) ~= 1, atest = false; end + if size(out2.data.y, 1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Tests that the filter method with a iir filter which have a different sample + % rate as the input object. + % + % + function result = utp_09 + + % + % + % Test that the filter method can change the sample rate of the filter and + % that the filter-object is returned. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobjin = miir(plist('type', 'highpass', 'fs', 3, 'iunits', iunits, 'ounits', ounits)); + pl = plist('filter', fobjin); + % modify ain + [out, outf] = at1.filter(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output AO contains the correct data. + % 2) Check that the second output is a iir filter. + % + % + + atest = true; + if stest + % + % Check the output data + fobj = fobjin.redesign(at1.fs); + [y, Zf] = filter(fobj.a, fobj.b, at1.y, fobj.histout); + % Check y-axis + if ~isequal(out.y, y), atest = false; end + % y-units: yunits.*ounits./iunits + if ~eq(out.yunits, at1.data.yunits.*ounits./iunits), atest = false; end + % Check the output filter. The filter must have the new frequency + if ~isa(outf, 'miir'), atest = false; end + if ~isequal(outf.fs, out.fs), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Tests that the filter method with a fir filter. + % + % + function result = utp_10 + + % + % + % Test that the filter method with a fir filter. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = mfir(plist('type', 'highpass', 'iunits', iunits, 'ounits', ounits)); + pl = plist('filter', fobj); + % modify ain + [out, outf] = at5.filter(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output AO contains the correct data. + % 2) Check that the second output is a fir filter. + % + % + + TOL = 1e-14; + atest = true; + if stest + % + % Check the output data + [y, Zf] = filter(fobj.a, 1, at5.y, fobj.histout); + gd = floor(fobj.gd); + x = at5.x; + x = x(1:end-gd); + y = y(1+gd:end); + % Check y-axis + if ~isequal(out.y, y), atest = false; end + % Check x-axis + if any(abs(out.x-x)>TOL), atest = false; end + % y-units: yunits.*ounits./iunits + if ~eq(out.yunits, at5.data.yunits.*ounits./iunits), atest = false; end + % Check the output filter. The filter must have the new frequency + if ~isa(outf, 'mfir'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + + %% UTP_12 + + % + % + % Tests the filter method with an AO and fsdata-object and an iir filter. + % + % + function result = utp_12 + + % + % + % Test that the result of the filter method is the product of the AO and the + % response of the filter. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = miir(plist('type', 'highpass', 'iunits', iunits, 'ounits', ounits)); + fobj = redesign(fobj, at2.fs); + pl = plist('filter', fobj); + % modify ain + [out, outf] = at2.filter(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output AO contains the correct data. + % 2) Check that the second output is a iir filter. + % 3) Check the units + % + % + + atest = true; + if stest + % + % Check the output data + r = resp(fobj, plist('f', at2)); + a = at2.*r; + if ~isequal(a.x, out.x), atest = false; end + if ~isequal(a.y, out.y), atest = false; end + % Check the output filter. The filter must have the new frequency + if ~isa(outf, 'miir'), atest = false; end + % Check units + if ~eq(out.xunits, unit('Hz')), atest = false; end + if ~eq(out.yunits, at2.yunits.*r.yunits), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Tests that the filter method works with a bank of parallel filters. + % + % + function result = utp_13 + + % + % + % Test that the filter method works for bank of parallel filters. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj1 = miir(plist('type', 'lowpass', 'fs', 10,'fc', 0.1, 'order', 2, 'iunits', iunits, 'ounits', ounits)); + fobj2 = miir(plist('type', 'highpass', 'fs', 10,'fc', 1, 'order', 3, 'iunits', iunits, 'ounits', ounits)); + fobj = [fobj1 fobj2]; + pl = plist('filter', fobj, 'bank', 'parallel', 'initialize', true); + [out, filtout] = filter(at1,pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same of the + % number of elements in 'input' + % 2) Check that output AO contains the correct number of data. + % 3) Check that output AO contains the correct data. + % 4) Check that histout is properly assigned + % + % + + atest = true; + aoin = copy(at1,1); + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(aoin), atest = false; end + + % Check we have the correct number of elements in outputs + if length(out.y) ~= length(aoin.y), atest = false; end + + % Check the output data + % filtering separately + y = zeros(length(aoin.y),numel(fobj)); + Zf = cell(numel(fobj),1); + for kk = 1:numel(fobj) + zi = utils.math.iirinit(fobj(kk).a,fobj(kk).b); + testCallerIsMethod(@setHistout, fobj(kk), zi*aoin.y(1)); + [yt, Zft] = filter(fobj(kk).a, fobj(kk).b, aoin.y, fobj(kk).histout); + if ~isequal(size(yt),size(y(kk))) + y(:,kk) = yt.'; + else + y(:,kk) = yt; + end + Zf{kk,1} = Zft; + end + yf = y(:,1); + for jj = 2:size(y,2) + yf = yf + y(:,jj); + end + % Check y-axis + if ~isequal(out.y, yf), atest = false; end + % y-units: yunits.*ounits./iunits + if ~eq(out.yunits, aoin.data.yunits.*ounits./iunits), atest = false; end + + % Checking histout + for ii = 1:numel(fobj) + if ~isequal(filtout(ii).histout, Zf{ii,1}), atest = false; end + end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + %% UTP_14 + + % + % + % Tests that the filter method works with a bank of serial filters. + % + % + function result = utp_14 + + % + % + % Test that the filter method works for bank of serial filters. + % + % + + try + % + iunits1 = unit('m'); + ounits1 = unit('V'); + iunits2 = unit('V'); + ounits2 = unit('C'); + fobj1 = miir(plist('type', 'lowpass', 'fs', 10,'fc', 0.1, 'order', 2, 'iunits', iunits1, 'ounits', ounits1)); + fobj2 = miir(plist('type', 'highpass', 'fs', 10,'fc', 1, 'order', 3, 'iunits', iunits2, 'ounits', ounits2)); + fobj = [fobj1 fobj2]; + pl = plist('filter', fobj, 'bank', 'serial'); + [out, filtout] = filter(at1,pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same of the + % number of elements in 'input' + % 2) Check that output AO contains the correct number of data. + % 3) Check that output AO contains the correct data. + % 4) Check that histout is properly assigned + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(at1), atest = false; end + + % Check we have the correct number of elements in outputs + if length(out.y) ~= length(at1.y), atest = false; end + + % Check the output data + % filtering separately + Zf = cell(numel(fobj),1); + y = at1.y; + for kk = 1:numel(fobj) + zi = utils.math.iirinit(fobj(kk).a,fobj(kk).b); + testCallerIsMethod(@setHistout, fobj(kk), zi*y(1)); + [yf, Zft] = filter(fobj(kk).a, fobj(kk).b, y, fobj(kk).histout); + if ~isequal(size(yf),size(y)) + y = yf.'; + else + y = yf; + end + Zf{kk,1} = Zft; + end + % Check y-axis + if ~isequal(out.y, y), atest = false; end + % y-units: yunits.*ounits./iunits + if ~eq(out.yunits, at1.data.yunits.*(ounits1./iunits1).*(ounits2./iunits2)), atest = false; end + + % Checking histout + for ii = 1:numel(fobj) + if ~isequal(filtout(ii).histout, Zf{ii}), atest = false; end + end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_14 + + + %% UTP_15 + + % + % + % Tests the filter method with an AO of fsdata-object and a bank of iir + % parallel filter. + % + % + function result = utp_15 + + % + % + % Test that the result of the filter method is the product of the AO and the + % response of the parallel filter bank. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj1 = miir(plist('type', 'lowpass', 'fs', 10,'fc', 0.1, 'order', 2, 'iunits', iunits, 'ounits', ounits)); + fobj2 = miir(plist('type', 'highpass', 'fs', 10,'fc', 1, 'order', 3, 'iunits', iunits, 'ounits', ounits)); + fobj = [fobj1 fobj2]; + pl = plist('filter', fobj, 'bank', 'parallel'); + % modify ain + [out, outf] = filter(at2,pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output AO contains the correct data. + % 2) Check that the second output is a iir filter. + % 3) Check the units + % + % + + atest = true; + if stest + % + % Check the output data + sr = resp(fobj, plist('f', at2.x)); + r = sr(1); + for kk = 2:numel(sr) + r = r + sr(kk); + end + a = at2.*r; + if ~isequal(a.x, out.x), atest = false; end + if ~isequal(a.y, out.y), atest = false; end + + % Check the output filter. The filter must have the new frequency + if ~isa(outf, 'miir'), atest = false; end + + % Check units + if ~eq(out.xunits, unit('Hz')), atest = false; end + if ~eq(out.yunits, at2.yunits.*sr(1).yunits), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_15 + + %% UTP_16 + + % + % + % Tests the filter method with an AO of fsdata-object and a bank of iir + % serial filter. + % + % + function result = utp_16 + + % + % + % Test that the result of the filter method is the product of the AO and the + % response of the serial filter bank. + % + % + + try + % + iunits1 = unit('m'); + ounits1 = unit('V'); + iunits2 = unit('V'); + ounits2 = unit('C'); + fobj1 = miir(plist('type', 'lowpass', 'fs', 10,'fc', 0.1, 'order', 2, 'iunits', iunits1, 'ounits', ounits1)); + fobj2 = miir(plist('type', 'highpass', 'fs', 10,'fc', 1, 'order', 3, 'iunits', iunits2, 'ounits', ounits2)); + fobj = [fobj1 fobj2]; + pl = plist('filter', fobj, 'bank', 'serial'); + % modify ain + [out, outf] = at2.filter(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output AO contains the correct data. + % 2) Check that the second output is a iir filter. + % 3) Check the units + % + % + + atest = true; + if stest + % + % Check the output data + sr = resp(fobj, plist('f', at2)); + r = sr(1); + for kk = 2:numel(fobj) + r = r.*sr(kk); + end + a = at2.*r; + if ~isequal(a.x, out.x), atest = false; end + if ~isequal(a.y, out.y), atest = false; end + + % Check the output filter. The filter must have the new frequency + if ~isa(outf, 'miir'), atest = false; end + + % Check units + if ~eq(out.xunits, unit('Hz')), atest = false; end + if ~eq(out.yunits, simplify(at2.yunits.*sr(1).yunits.*sr(2).yunits)), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_16 + + + %% UTP_17 + + % + % + % Tests the filter method with an AO and fsdata-object and an mfir filter. + % + % + function result = utp_17 + + % + % + % Test that the result of the filter method is the product of the AO and the + % response of the filter. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = mfir(plist('type', 'highpass', 'iunits', iunits, 'ounits', ounits)); + fobj = redesign(fobj, at2.fs); + pl = plist('filter', fobj); + % modify ain + [out, outf] = at2.filter(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output AO contains the correct data. + % 2) Check that the second output is a fir filter. + % 3) Check the units + % + % + + atest = true; + if stest + % + % Check the output data + r = resp(fobj, plist('f', at2)); + a = at2.*r; + if ~isequal(a.x, out.x), atest = false; end + if ~isequal(a.y, out.y), atest = false; end + % Check the output filter. The filter must have the new frequency + if ~isa(outf, 'mfir'), atest = false; end + % Check units + if ~eq(out.xunits, unit('Hz')), atest = false; end + if ~eq(out.yunits, at2.yunits.*r.yunits), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_17 + +%% UTP_18 + + % + % + % Test that the filter method works with a filter embedded into a matrix + % and input in a plist + % + % + function result = utp_18 + + % + % + % Test that the filter method works with a filter embedded into a + % matrix + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = miir(plist('type', 'lowpass', 'fs', 10, 'iunits', iunits, 'ounits', ounits)); + mobj = matrix(fobj); + pl = plist('filter', mobj); + out = filter(at5, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % 3) Check the output-filter + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Check the output data + y = filter(at5,plist('filter',fobj)); + % Check y-axis + if ~eq(out, y, ple3), atest = false; end + % Check y-units + if ~eq(out.yunits, y.yunits, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_18 + +%% UTP_19 + + % + % + % Test that the filter method works with a filter embedded into a matrix + % and input as a second input + % + % + function result = utp_19 + + % + % + % Test that the filter method works with a filter embedded into a + % matrix + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = miir(plist('type', 'lowpass', 'fs', 10, 'iunits', iunits, 'ounits', ounits)); + mobj = matrix(fobj); + out = filter(at5, mobj); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % 3) Check the output-filter + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Check the output data + y = filter(at5,fobj); + % Check y-axis + if ~eq(out, y, ple3), atest = false; end + % Check y-units + if ~eq(out.yunits, y.yunits, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_19 + +%% UTP_20 + + % + % + % Test that the filter method does not works with a N-dim matrix of + % filters input in a plist. + % + % + function result = utp_20 + + % + % + % Test that the filter method does not works with a N-dim matrix of + % filters input in a plist. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj1 = miir(plist('type', 'lowpass', 'fc', 0.2, 'fs', 10, 'iunits', iunits, 'ounits', ounits)); + fobj2 = miir(plist('type', 'lowpass', 'fc', 0.02, 'fs', 10, 'iunits', iunits, 'ounits', ounits)); + mobj = matrix(fobj1,fobj2); + pl = plist('filter', mobj); + out = filter(at5, pl); + % + stest = false; + catch err + disp(err.message) + stest = true; + end + + % + % + % 1) Nothing to do. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_20 + +%% UTP_21 + + % + % + % Test that the filter method does not works with a N-dim matrix of + % filters input as a second object + % + % + function result = utp_21 + + % + % + % Test that the filter method does not works with a N-dim matrix of + % filters input in a plist. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj1 = miir(plist('type', 'lowpass', 'fc', 0.2, 'fs', 10, 'iunits', iunits, 'ounits', ounits)); + fobj2 = miir(plist('type', 'lowpass', 'fc', 0.02, 'fs', 10, 'iunits', iunits, 'ounits', ounits)); + mobj = matrix(fobj1,fobj2); + out = filter(at5, mobj); + % + stest = false; + catch err + disp(err.message) + stest = true; + end + + % + % + % 1) Nothing to do. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_21 + +end + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_filtfilt.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_filtfilt.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,804 @@ +% UTP_AO_FILTFILT a set of UTPs for the ao/filtfilt method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_filtfilt.m,v 1.12 2010/03/23 20:36:38 ingo Exp $ +% + +% +% +% The filtfilt method of the ao class filters time-series AOs forwards and +% backwards. +% +% + +function results = utp_ao_filtfilt(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'filtfilt'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + pli = plist('filter', miir(plist('type', 'lowpass', 'fs', at1.fs))); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test the data shape + results = [results utp_09]; % Test with miir filter and different fs + results = [results utp_10]; % Test with mfir filter + + results = [results utp_11(mthd, at1, ple1, pli)]; % Test plotinfo doesn't disappear + + results = [results utp_12]; % Test with fsdata + miir filter + results = [results utp_13]; % Test with fsdata + mfir filter + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('filter'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('filter')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('filter'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the filtfilt method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the filtfilt method works for a vector of AOs as input. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = miir(plist('type', 'highpass', 'fs', 10, 'iunits', iunits, 'ounits', ounits)); + pl = plist('filter', fobj); + avec = [at1 at5 at6]; + [out, outf] = filtfilt(avec, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % 3) Check the output-filter + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + % Check the output data + for kk = 1:numel(avec) + y = filtfilt(fobj.a, fobj.b, avec(kk).y); + % Check y-axis + if ~isequal(out(kk).y, y), atest = false; end + % y-units: yunits.*ounits./iunits + if ~eq(out(kk).yunits, avec(kk).data.yunits.*ounits./iunits), atest = false; end + end + % Check filter + if numel(outf) ~= numel(avec), atest = false; end + if ~isa(outf, 'miir'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the filtfilt method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the filtfilt method works for a matrix of AOs as input. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = miir(plist('type', 'highpass', 'fs', 10, 'iunits', iunits, 'ounits', ounits)); + pl = plist('filter', fobj); + amat = [at1 at5 at6; at5 at6 at1]; + [out, outf] = filtfilt(amat, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % 3) Check the output-filter + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + % Check the output data + for kk = 1:numel(amat) + y = filtfilt(fobj.a, fobj.b, amat(kk).y); + % Check y-axis + if ~isequal(out(kk).y, y), atest = false; end + % y-units: yunits.*ounits./iunits + if ~eq(out(kk).yunits, amat(kk).data.yunits.*ounits./iunits), atest = false; end + end + % Check filter + if numel(outf) ~= numel(amat), atest = false; end + if ~isa(outf, 'miir'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the filtfilt method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the filtfilt method works for a list of AOs as input. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = miir(plist('type', 'highpass', 'fs', 10, 'iunits', iunits, 'ounits', ounits)); + pl = plist('filter', fobj); + out = filtfilt(at1,at5,at6,pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, at5, at6]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check the output data + for kk = 1:numel(aoin) + y = filtfilt(fobj.a, fobj.b, aoin(kk).y); + % Check y-axis + if ~isequal(out(kk).y, y), atest = false; end + % y-units: yunits.*ounits./iunits + if ~eq(out(kk).yunits, aoin(kk).data.yunits.*ounits./iunits), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the filtfilt method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the filtfilt method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = miir(plist('type', 'highpass', 'fs', 10, 'iunits', iunits, 'ounits', ounits)); + pl = plist('filter', fobj); + out = filtfilt(at1,[at5 at6],at5,[at5 at1; at6 at1],at6,pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, reshape([at5 at6], 1, []), at5, reshape([at5 at1; at6 at1], 1, []), at6]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + % Check the output data + for kk = 1:numel(aoin) + y = filtfilt(fobj.a, fobj.b, aoin(kk).y); + % Check y-axis + if ~isequal(out(kk).y, y), atest = false; end + % y-units: yunits.*ounits./iunits + if ~eq(out(kk).yunits, aoin(kk).data.yunits.*ounits./iunits), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the filtfilt method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the filtfilt method can be processed back + % to an m-file. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = miir(plist('type', 'highpass', 'fs', 10, 'iunits', iunits, 'ounits', ounits)); + pl = plist('filter', fobj); + out = filtfilt(at5,pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'filtfilt'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'filtfilt'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the filtfilt method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the filtfilt method can modify the input AO by calling + % with no output. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = miir(plist('type', 'highpass', 'fs', 10, 'iunits', iunits, 'ounits', ounits)); + pl = plist('filter', fobj); + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = ain.filtfilt(pl); + ain.filtfilt(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is filtfilt(at1). + % + % + + atest = true; + if stest + % + % Check that filtfilt modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that filtfilt doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the filtfilt of the copy + y = filtfilt(fobj.a, fobj.b, at1.y); + % Check y-axis + if ~isequal(ain.y, y), atest = false; end + % y-units: yunits.*ounits./iunits + if ~eq(ain.yunits, at1.data.yunits.*ounits./iunits), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the filtfilt method keeps the data shape of the input object. + % + % + function result = utp_08 + + % + % + % Test that the filtfilt method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = miir(plist('type', 'highpass', 'fs', 10, 'iunits', iunits, 'ounits', ounits)); + pl = plist('filter', fobj); + out1 = filtfilt(at5, pl); + out2 = filtfilt(at6, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,2) ~= 1, atest = false; end + if size(out2.data.y,1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Tests that the filtfilt method with a iir filter which have a different sample + % rate as the input object. + % + % + function result = utp_09 + + % + % + % Test that the filtfilt method can change the sample rate of the filter and + % that the filtfilt-object is returned. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobjin = miir(plist('type', 'highpass', 'fs', 3, 'iunits', iunits, 'ounits', ounits)); + pl = plist('filter', fobjin); + % modify ain + [out, outf] = at1.filtfilt(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output AO contains the correct data. + % 2) Check that the second output is a iir filtfilt. + % + % + + atest = true; + if stest + % + % Check the output data + fobj = fobjin.redesign(at1.fs); + y = filtfilt(fobj.a, fobj.b, at1.y); + % Check y-axis + if ~isequal(out.y, y), atest = false; end + % y-units: yunits.*ounits./iunits + if ~eq(out.yunits, at1.data.yunits.*ounits./iunits), atest = false; end + % Check the output filter. The filter must have the new frequency + if ~isa(outf, 'miir'), atest = false; end + if ~isequal(outf.fs, out.fs), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Tests that the filtfilt method with a fir filter. + % + % + function result = utp_10 + + % + % + % Test that the filtfilt method with a fir filter. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = mfir(plist('type', 'highpass', 'iunits', iunits, 'ounits', ounits, 'order', 64, 'fs', 10)); + pl = plist('filter', fobj); + % modify ain + [out, outf] = at5.filtfilt(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output AO contains the correct data. + % 2) Check that the second output is a fir filter. + % + % + + atest = true; + if stest + % + % Check the output data + fobj = redesign(fobj, at5.fs); + y = filtfilt(fobj.a, 1, at5.y); + % Check y-axis + if ~isequal(out.y, y), atest = false; end + % y-units: yunits.*ounits./iunits + if ~eq(out.yunits, at5.data.yunits.*ounits./iunits), atest = false; end + % Check the output filter. The filter must have the new frequency + if ~isa(outf, 'mfir'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + + %% UTP_12 + + % + % + % Tests the filtfilt method with an AO and fsdata-object and an iir filter. + % + % + function result = utp_12 + + % + % + % Test that the result of the filtfilt method is the product of the AO and the + % response of the filter. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = miir(plist('type', 'highpass', 'iunits', iunits, 'ounits', ounits)); + fobj = redesign(fobj, at2.fs); + pl = plist('filter', fobj); + % modify ain + [out, outf] = at2.filtfilt(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output AO contains the correct data. + % 2) Check that the second output is a iir filter. + % 3) Check the units + % + % + + atest = true; + if stest + % + % Check the output data + r = resp(fobj, plist('f', at2)); + a = at2.*r.*conj(r); + if ~isequal(a.x, out.x), atest = false; end + if ~isequal(a.y, out.y), atest = false; end + % Check the output filter. The filter must have the new frequency + if ~isa(outf, 'miir'), atest = false; end + % Check units + if ~eq(out.xunits, unit('Hz')), atest = false; end + y_units = simplify(at2.yunits.*r.yunits.*r.yunits, 'Hz'); + if ~eq(out.yunits, y_units), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Tests the filtfilt method with an AO and fsdata-object and an iir filter. + % + % + function result = utp_13 + + % + % + % Test that the result of the filtfilt method is the product of the AO and the + % response of the filter. + % + % + + try + % + iunits = unit('m'); + ounits = unit('V'); + fobj = mfir(plist('type', 'highpass', 'iunits', iunits, 'ounits', ounits)); + fobj = redesign(fobj, at2.fs); + pl = plist('filter', fobj); + % modify ain + [out, outf] = at2.filtfilt(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output AO contains the correct data. + % 2) Check that the second output is a fir filter. + % 3) Check the units + % + % + + atest = true; + if stest + % + % Check the output data + r = resp(fobj, plist('f', at2)); + a = at2.*r.*conj(r); + if ~isequal(a.x, out.x), atest = false; end + if ~isequal(a.y, out.y), atest = false; end + % Check the output filter. The filter must have the new frequency + if ~isa(outf, 'mfir'), atest = false; end + % Check units + if ~eq(out.xunits, unit('Hz')), atest = false; end + % Compute y-units + y_units = simplify(at2.yunits.*r.yunits.*r.yunits, 'Hz'); + if ~eq(out.yunits, y_units), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_find.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_find.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,801 @@ +% UTP_AO_FIND a set of UTPs for the ao/find method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_find.m,v 1.7 2010/08/18 15:35:25 ingo Exp $ +% + +% +% +% The find method of the ao class computes the FIND particular samples that +% satisfy the input query and return a new AO. +% +% + +function results = utp_ao_find(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'find'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + pli = plist('QUERY', 'x < 4'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with with different queries. + results = [results utp_09]; % Test input data shape == output data shape + results = [results utp_10]; % Test output of the data + + results = [results utp_11(mthd, at1, ple1, pli)]; % Test plotinfo doesn't disappear + + results = [results utp_12]; % Test with AO(cdata) + results = [results utp_13]; % Test with plist(query) + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('query'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('query')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('query'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the find method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the find method works for a vector of AOs as input. + % + % + + try + % + out = find(atvec, 'x < 4'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check each output must have x-values which are smaler 4 + for kk=1:numel(out) + x = atvec(kk).x; + idx = find(x < 4); + if any(abs(out(kk).x - atvec(kk).x(idx)) > TOL),atest = false; end + if ~isequal(out(kk).y, atvec(kk).y(idx)),atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the find method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Tests that the find method works with a matrix of AOs as input. + % + % + + try + % + out = find(atmat, 'y < 4'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check each output must have y-values which are smaler 4 + for kk=1:numel(out) + y = atmat(kk).y; + idx = find(y < 4); + if ~isa(out(kk).data, 'cdata') + if any(abs(out(kk).x - atmat(kk).x(idx)) > TOL),atest = false; end + end + if ~isequal(out(kk).y, atmat(kk).y(idx)),atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the find method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Tests that the find method works with a list of AOs as input. + % + % + + try + % + out = find(at1, at2, at3, 'x < 4'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + TOL = 1e-14; + atest = true; + aoin = [at1, at2, at3]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(aoin)), atest = false; end + % Check each output must have x-values which are smaler 4 + for kk=1:numel(out) + if ~isa(out(kk).data, 'cdata') + x = aoin(kk).x; + idx = find(x < 4); + if any(abs(out(kk).x - aoin(kk).x(idx)) > TOL),atest = false; end + if ~isequal(out(kk).y, aoin(kk).y(idx)),atest = false; end + else + if ~eq(out(kk), aoin(kk), ple1), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the find method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Tests that the find method works with a mix of different shaped AOs + % as input. + % + % + + try + % + out = find(at1, atmat, at3, atvec, 'y < 4'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-14; + aoin = [at1, reshape(atmat, 1, []), at3, reshape(atvec, 1, [])]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(aoin)), atest = false; end + % Check each output must have y-values which are smaler 4 + for kk=1:numel(out) + y = aoin(kk).y; + idx = find(y < 4); + if ~isa(out(kk).data, 'cdata') + if any(abs(out(kk).x - aoin(kk).x(idx)) > TOL),atest = false; end + end + if ~isequal(out(kk).y, aoin(kk).y(idx)),atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the find method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the find method can be processed back. + % + % + + try + % + out = find(at1, 'x < 4'); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'finf'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'find'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the find method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the find method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at1 to work with + amodi = ao(at1); + aeq = ao(at1); + out = aeq.find('x < 4'); + amodi.find('x < 4'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'out' and 'aeq' are now different. + % 2) Check that 'aeq' is not changed + % 3) Check that the modified input is the abs value of the copy + % 4) Check that out and amodi are the same + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check that 'out' and 'aeq' are now different. + if eq(out, aeq, ple2), atest = false; end + % Check that 'aeq' is not changed + if ~eq(aeq, ao(at1), ple1), atest = false; end + % Check that the modified input have the correct data + x = at1.x; + idx = find(x < 4); + if any(abs(out.x - at1.x(idx)) > TOL),atest = false; end + if ~isequal(out.y, at1.y(idx)),atest = false; end + % Check that out and amodi are the same + if ~eq(out, amodi, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test that the find method works with different queries to the x-/y- + % axis. + % + % + function result = utp_08 + + % + % + % Test that the find method works with different queries to the x-/y- + % axis. + % + % + + try + % + out1 = find(at1, 'x > 5 & x < 25'); + out2 = find(at1, 'x > 5 & y < .4'); + out3 = find(at1, 'y < 0.4 & y > -0.4'); + out4 = find(at1, 'x > 5', 'x < 25'); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + TOL = 1e-14; + if stest + % + x = at1.x; + y = at1.y; + % Check 'out1' + idx1 = find(x > 5 & x < 25); + t0off = (out1.t0.utc_epoch_milli - at1.t0.utc_epoch_milli)/1e3; + if any(abs(out1.x + t0off - at1.x(idx1)) > TOL),atest = false; end + if ~isequal(out1.y, at1.y(idx1)),atest = false; end + % Check 'out2' + idx2 = find(x > 5 & y < .4); + if any(abs(out2.x - at1.x(idx2)) > TOL),atest = false; end + if ~isequal(out2.y, at1.y(idx2)),atest = false; end + % Check 'out3' + idx3 = find(y < 0.4 & y > -0.4); + if any(abs(out3.x - at1.x(idx3)) > TOL),atest = false; end + if ~isequal(out3.y, at1.y(idx3)),atest = false; end + % Check 'out4' + idx4 = find(x > 5 & x < 25); + t0off = (out4.t0.utc_epoch_milli - at1.t0.utc_epoch_milli)/1e3; + if any(abs(out4.x + t0off - at1.x(idx4)) > TOL),atest = false; end + if ~isequal(out4.y, at1.y(idx4)),atest = false; end + % Check the re-built objects + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + if ~eq(mout4, out4, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test the shape of the output. + % + % + function result = utp_09 + + % + % + % Test that the find method keeps the data shape of the input object. + % The input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = find(at5 ,'x > 5 & x < 20 & y < 1'); + out2 = find(at6, 'x > 5 & x < 20 & y < 1'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y, 1) == 1, atest = false; end + if size(out2.data.y, 2) == 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the find method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_10 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = find(at5, at6, 'y < 5'); + o3 = abs(at5, at6, 'y < 5'); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + + %% UTP_12 + + % + % + % Test that the find method works with AOs which have cdata. + % + % + function result = utp_12 + + % + % + % Test that the find method works with AOs which have cdata. + % + % + + try + % + a1 = ao([1 -2 3; -4 7 -1 ; 5 3 -8]); + a2 = ao(1:12); + out1 = find(a1, 'y > 1'); + out2 = find(a2, 'y > 3 & y < 8'); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + % Check 'out1' + y = a1.y; + idx1 = find(y > 1); + if ~isequal(out1.y, a1.y(idx1)),atest = false; end + % Check 'out2' + y = a2.y; + idx2 = find(y > 3 & y < 8); + if ~isequal(out2.y, a2.y(idx2)),atest = false; end + % Check the re-built objects + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Test that the find method works with a plist which contains different + % queries to the x-/y- axis. + % + % + function result = utp_13 + + % + % + % Test that the find method works with a plist which contains different + % queries to the x-/y- axis. + % + % + + try + % + + out1 = find(at1, plist('query', 'x > 5 & x < 25')); + out2 = find(at1, plist('query', 'x > 5 & y < .4')); + out3 = find(at1, plist('query', 'y < 0.4 & y > -0.4')); + out4 = find(at1, plist('query', 'x > 5 & x < 25')); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + TOL = 1e-14; + if stest + % + x = at1.x; + y = at1.y; + % Check 'out1' + idx1 = find(x > 5 & x < 25); + t0off = (out1.t0.utc_epoch_milli - at1.t0.utc_epoch_milli)/1000; + if any(abs(out1.x + t0off - at1.x(idx1)) > TOL),atest = false; end + if ~isequal(out1.y, at1.y(idx1)),atest = false; end + % Check 'out2' + idx2 = find(x > 5 & y < .4); + if any(abs(out2.x - at1.x(idx2)) > TOL),atest = false; end + if ~isequal(out2.y, at1.y(idx2)),atest = false; end + % Check 'out3' + idx3 = find(y < 0.4 & y > -0.4); + if any(abs(out3.x - at1.x(idx3)) > TOL),atest = false; end + if ~isequal(out3.y, at1.y(idx3)),atest = false; end + % Check 'out4' + idx4 = find(x > 5 & x < 25); + t0off = (out4.t0.utc_epoch_milli - at1.t0.utc_epoch_milli)/1e3; + if any(abs(out4.x + t0off - at1.x(idx4)) > TOL),atest = false; end + if ~isequal(out4.y, at1.y(idx4)),atest = false; end + % Check the re-built objects + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + if ~eq(mout4, out4, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_firwhiten.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_firwhiten.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,723 @@ +% UTP_AO_PSD a set of UTPs for the ao/firwhiten method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_firwhiten.m,v 1.21 2011/11/16 08:16:08 mauro Exp $ +% + +% +% +% The firwhiten method of the ao class computes the spectral density of time-series AOs. +% +% + +function results = utp_ao_firwhiten(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'firwhiten'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test the data shape + results = [results utp_09]; % Test with complex plist + results = [results utp_10]; % Test the spectral falttening + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + results = [results utp_12(mthd, at1, ple1)]; % Test errors are cleared + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + defaultWinType = char(prefs.getMiscPrefs.getDefaultWindow); + + %%% SET 'None' + pn = 1; + if ~isempty(io(pn).sets), atest = false; end + if ~isempty(io(pn).plists), atest = false; end + %%% Check all Sets + pn = 2; + if ~any(strcmpi(io(pn).sets, 'Default')), atest = false; end + if numel(io(pn).plists) ~= numel(io(pn).sets), atest = false; end + %%%%%%%%%% SET 'Default' + pn = 3; + if io(pn).plists.nparams ~= 7, atest = false; end + % Check key + if ~io(pn).plists.isparam('nfft'), atest = false; end + if ~io(pn).plists.isparam('bw'), atest = false; end + if ~io(pn).plists.isparam('hc'), atest = false; end + if ~io(pn).plists.isparam('win'), atest = false; end + if ~io(pn).plists.isparam('order'), atest = false; end + if ~io(pn).plists.isparam('firwin'), atest = false; end + if ~io(pn).plists.isparam('ntaps'), atest = false; end + % Check default value + if ~isequal(io(pn).plists.find('nfft'), -1), atest = false; end + if ~isequal(io(pn).plists.find('bw'), 20), atest = false; end + if ~isequal(io(pn).plists.find('hc'), .8), atest = false; end + if ~strcmpi(io(pn).plists.find('win'), defaultWinType), atest = false; end + if ~isequal(io(pn).plists.find('order'), -1), atest = false; end + if ~strcmpi(io(pn).plists.find('win'), defaultWinType), atest = false; end + if ~isequal(io(pn).plists.find('ntaps'), 256), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('nfft'), {-1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('bw'), {20}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('hc'), {.8}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('win'), specwin.getTypes), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('order'), {-1 0 1 2 3 4 5 6 7 8 9}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('firwin'), specwin.getTypes), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('ntaps'), {256}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the firwhiten method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the firwhiten method works for a vector of AOs as input. + % + % + + try + % + avec = [at5 at5 at6]; + N = 512; + fwin = specwin('Hanning', N+1); + [out, outf, outxx] = firwhiten(avec, plist('Ntaps', N, 'FIRwin', fwin)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of elements in 'out' + % 2) Check the number of filters (outf) and noise-floor estimates (outxx) + % 3) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + if numel(outf) ~= numel(avec), atest = false; end + if numel(outxx) ~= numel(avec), atest = false; end + % Check the output data + prefs = getappdata(0, 'LTPDApreferences'); + swin = char(prefs.getMiscPrefs.getDefaultWindow); + for kk = 1:numel(avec) + pl_psd = plist('Nfft', length(avec(kk).y), 'Win', specwin(swin), 'Order', -1, 'Scale', 'ASD'); + axx = psd(avec(kk), pl_psd); + nxx = smoother(axx, plist('width', 20, 'hc', 0.8)); + w = 1./nxx; + ff = mfir(w, plist('Win', fwin, 'N', N)); + res = filter(avec(kk), ff); + if ~isequal(res.x, out(kk).x), atest = false; end + if ~isequal(res.y, out(kk).y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the firwhiten method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the firwhiten method works for a matrix of AOs as input. + % + % + + try + % + amat = [at1 at5 at6; at5 at6 at1]; + N = 512; + fwin = specwin('Hanning', N+1); + [out, outf, outxx] = firwhiten(amat, plist('Ntaps', N, 'FIRwin', fwin)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of elements in 'out' + % 2) Check the number of filters (outf) and noise-floor estimates (outxx) + % 3) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + if numel(outf) ~= numel(amat), atest = false; end + if numel(outxx) ~= numel(amat), atest = false; end + % Check the output data + prefs = getappdata(0, 'LTPDApreferences'); + swin = char(prefs.getMiscPrefs.getDefaultWindow); + for kk = 1:numel(amat) + pl_psd = plist('Nfft', length(amat(kk).y), 'Win', specwin(swin), 'Order', -1, 'Scale', 'ASD'); + axx = psd(amat(kk), pl_psd); + nxx = smoother(axx, plist('width', 20, 'hc', 0.8)); + w = 1./nxx; + ff = mfir(w, plist('Win', fwin, 'N', N)); + res = filter(amat(kk), ff); + if ~isequal(res.x, out(kk).x), atest = false; end + if ~isequal(res.y, out(kk).y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the firwhiten method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the firwhiten method works for a list of AOs as input. + % + % + + try + % + N = 512; + fwin = specwin('Hanning', N+1); + [out, outf, outxx] = firwhiten(at1,at5,at6, plist('Ntaps', N, 'FIRwin', fwin)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of elements in 'out' + % 2) Check the number of filters (outf) and noise-floor estimates (outxx) + % 3) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, at5, at6]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + if numel(outf) ~= 3, atest = false; end + if numel(outxx) ~= 3, atest = false; end + % Check the output data + prefs = getappdata(0, 'LTPDApreferences'); + swin = char(prefs.getMiscPrefs.getDefaultWindow); + for kk = 1:numel(aoin) + pl_psd = plist('Nfft', length(aoin(kk).y), 'Win', specwin(swin), 'Order', -1, 'Scale', 'ASD'); + axx = psd(aoin(kk), pl_psd); + nxx = smoother(axx, plist('width', 20, 'hc', 0.8)); + w = 1./nxx; + ff = mfir(w, plist('Win', fwin, 'N', N)); + res = filter(aoin(kk), ff); + if ~isequal(res.x, out(kk).x), atest = false; end + if ~isequal(res.y, out(kk).y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the firwhiten method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the firwhiten method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + N = 512; + fwin = specwin('Hanning', N+1); + pl = plist('Ntaps', N, 'FIRwin', fwin); + [out, outf, outxx] = firwhiten(at1,[at5 at6],at5,[at5 at1; at6 at1],at6, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of elements in 'out' + % 2) Check the number of filters (outf) and noise-floor estimates (outxx) + % 3) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, reshape([at5 at6], 1, []), at5, reshape([at5 at1; at6 at1], 1, []), at6]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + if numel(outf) ~= 9, atest = false; end + if numel(outxx) ~= 9, atest = false; end + % Check the output data + prefs = getappdata(0, 'LTPDApreferences'); + swin = char(prefs.getMiscPrefs.getDefaultWindow); + for kk = 1:numel(aoin) + pl_psd = plist('Nfft', length(aoin(kk).y), 'Win', specwin(swin), 'Order', -1, 'Scale', 'ASD'); + axx = psd(aoin(kk), pl_psd); + nxx = smoother(axx, plist('width', 20, 'hc', 0.8)); + w = 1./nxx; + ff = mfir(w, plist('Win', fwin, 'N', N)); + res = filter(aoin(kk), ff); + if ~isequal(res.x, out(kk).x), atest = false; end + if ~isequal(res.y, out(kk).y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the firwhiten method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the firwhiten method can be processed back + % to an m-file. + % + % + + try + % + N = 512; + fwin = specwin('Hanning', N+1); + pl = plist('Ntaps', N, 'FIRwin', fwin); + out = firwhiten(at5, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'firwhiten'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'firwhiten'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple4), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the firwhiten method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the firwhiten method can modify the input AO by calling + % with no output. + % + % + + try + % + N = 512; + fwin = specwin('Hanning', N+1); + pl = plist('Ntaps', N, 'FIRwin', fwin); + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = ain.firwhiten(pl); + ain.firwhiten(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is firwhiten(at1). + % + % + + atest = true; + if stest + % + % Check that firwhiten modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that firwhiten doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the firwhiten of the copy + % Check the output data of ain + prefs = getappdata(0, 'LTPDApreferences'); + swin = char(prefs.getMiscPrefs.getDefaultWindow); + pl_psd = plist('Nfft', length(at1.y), 'Win', specwin(swin), 'Order', -1, 'Scale', 'ASD'); + axx = psd(at1, pl_psd); + nxx = smoother(axx, plist('width', 20, 'hc', 0.8)); + w = 1./nxx; + ff = mfir(w, plist('Win', fwin, 'N', N)); + res = filter(at1, ff); + if ~isequal(res.x, ain.x), atest = false; end + if ~isequal(res.y, ain.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the firwhiten method keeps the data shape of the input object. + % + % + function result = utp_08 + + % + % + % Test that the firwhiten method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + N = 512; + fwin = specwin('Hanning', N+1); + pl = plist('Ntaps', N, 'FIRwin', fwin); + out1 = firwhiten(at5, pl); + out2 = firwhiten(at6, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,2) ~= 1, atest = false; end + if size(out2.data.y,1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Tests that the firwhiten method with a complex plist. + % + % + function result = utp_09 + + % + % + % Test that the result of applying the firwhiten method with a complex plist + % can be processed back to a m-file. + % + % + + try + % + N = 512; + Nfft = 100; + order = 1; + fwin = specwin('Hanning', N+1); + swin = specwin('Kaiser', 10, 100); + pl = plist('Ntaps', N, 'FIRwin', fwin, 'win', swin, 'Nfft', Nfft, 'order', order); + [out, outf, outxx] = firwhiten(at5, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output data + % 2) Check the output filter + % 3) Check the noise-floor estimates + % 4) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'firwhiten'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Test the spectral falttening capability of firwhiten method. + % + % + function result = utp_10 + + % + % + % Test that the application of the firwhiten method enhances the + % spectral flatness of input data. + % + % + + try + % + % Making test data + fs = at5.fs; + pzm = pzmodel(2, [pz(0.1, 2) pz(0.5, 1)] , [pz(1) pz(2.55, 2)]); + ft = miir(pzm,plist('fs',fs)); + af = filter(at5, ft); % Colored noise + + % Whitening + N = 512; + Nfft = 100; + order = 1; + fwin = specwin('Hanning', N+1); + swin = specwin('Kaiser', 10, 100); + pl = plist('Ntaps', N, 'FIRwin', fwin, 'win', swin, 'Nfft', Nfft, 'order', order); + out = firwhiten(af, pl); + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Calculate PSD of input and whitened data + % 2) Compare relative spectral flatness coefficients + % + % + + atest = true; + if stest + % + % Check the output data +% pl_psd = plist('Nfft', Nfft, 'Win', swin, 'Order', order, 'Scale', 'PSD'); + axx = af.psd; + awxx = out.psd; + + % Claculating flatness + sf1 = utils.math.spflat(axx.data.y); + sf2 = utils.math.spflat(awxx.data.y); + + % Checking flatness + if sf1>sf2, atest = false; end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_fixfs.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_fixfs.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,887 @@ +% UTP_AO_FIXFS a set of UTPs for the ao/fixfs method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_fixfs.m,v 1.19 2011/08/22 05:04:49 hewitson Exp $ +% + +% +% +% The fixfs method of the ao class resamples time-series AOs to have a +% fixed sample rate. +% +% + +function results = utp_ao_fixfs(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'fixfs'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test the data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test multiple 'fs' for multiple input AOs + + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + results = [results utp_12]; % Test with plist: method == 'samples' + results = [results utp_13]; % Test with antialising filter + results = [results utp_14]; % Test AO with non evenly sampled data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(3).plists.isparam('fs'), atest = false; end + if ~io(3).plists.isparam('method'), atest = false; end + if ~io(3).plists.isparam('filter'), atest = false; end + if ~io(3).plists.isparam('interpolation'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('fs'), -1), atest = false; end + if ~strcmpi(io(3).plists.find('method'), 'time'), atest = false; end + if ~isequal(io(3).plists.find('filter'), 'off'), atest = false; end + if ~isequal(io(3).plists.find('interpolation'), 'spline'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('fs'), {-1}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('method'), {'time', 'samples'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('interpolation'), {'nearest', 'linear', 'spline', 'cubic'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the fixfs method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the fixfs method works for a vector of AOs as input. + % + % + + try + % + avec = [at1 at5 at6]; + out = fixfs(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as + % the number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + % Check the output data + for kk = 1:numel(avec) + fs = avec(kk).fs; + t0 = 0; + Nsecs = avec(kk).data.nsecs; + t = t0 + [0:1/fs:Nsecs-1/fs].'; + y = interp1(avec(kk).x,avec(kk).y, t, 'spline', 'extrap'); + if ~isequal(y, out(kk).y), atest = false; end + if ~isequal(t, out(kk).x), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the fixfs method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the fixfs method works for a matrix of AOs as input. + % + % + + try + % + amat = [at1 at5 at6; at5 at6 at1]; + out = fixfs(amat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as + % the number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + % Check the output data + for kk = 1:numel(amat) + fs = amat(kk).fs; + t0 = 0; + Nsecs = amat(kk).data.nsecs; + t = t0 + [0:1/fs:Nsecs-1/fs].'; + y = interp1(amat(kk).x,amat(kk).y, t, 'spline', 'extrap'); + if ~isequal(y, out(kk).y), atest = false; end + if ~isequal(t, out(kk).x), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the fixfs method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the fixfs method works for a list of AOs as input. + % + % + + try + % + out = fixfs(at1,at5,at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as + % the number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, at5, at6]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check the output data + for kk = 1:numel(aoin) + fs = aoin(kk).fs; + t0 = 0; + Nsecs = aoin(kk).data.nsecs; + t = t0 + [0:1/fs:Nsecs-1/fs].'; + y = interp1(aoin(kk).x,aoin(kk).y, t, 'spline', 'extrap'); + if ~isequal(y, out(kk).y), atest = false; end + if ~isequal(t, out(kk).x), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the fixfs method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the fixfs method works with an input of matrices and vectors + % and single AOs. Additionally define a 'fs' in a plist. + % + % + + try + % + fs = 7; + pl = plist('fs', fs); + out = fixfs(at1,[at5 at6],at5,[at5 at1; at6 at1],at6, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % 3) Check that 't0' and 'fs' are correct. + % + % + + TOL = 1e-14; + atest = true; + aoin = [at1, reshape([at5 at6], 1, []), at5, reshape([at5 at1; at6 at1], 1, []), at6]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + % Check the output data + for kk = 1:numel(aoin) + Nsecs = aoin(kk).data.nsecs; + % We have to think about what we want to do with t0 + t0 = aoin(kk).data.t0.double; + % This is numerically more accurate + t = [0:1/fs:Nsecs-1/fs].'; + y = interp1(aoin(kk).x, aoin(kk).y, t, 'spline', 'extrap'); + if ~isequal(y, out(kk).y), atest = false; end + if any(abs(t-out(kk).x)>TOL), atest = false; end + % Check 't0' and 'fs' + if ~isequal(out(kk).fs, fs), atest = false; end + if ~isequal(out(kk).t0.utc_epoch_milli, t0*1000), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the fixfs method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the fixfs method can be processed back + % to an m-file. Additionally define a 'fs' in a plist. + % + % + + try + % + fs = 7; + pl = plist('fs', fs); + out = fixfs(at5, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'fixfs'. + % 2) % Check that the re-built object is the same object as 'out'. + % + % + + TOL = 1e-14; + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'fixfs'), atest = false; end + % Check the output data + Nsecs = at5.data.nsecs; + % We have to think about what we want to do with t0 + t0 = at5.data.t0.double; + % This is numerically more accurate + t = [0:1/fs:Nsecs-1/fs].'; + y = interp1(at5.x, at5.y, t, 'spline', 'extrap'); + if ~isequal(y, out.y), atest = false; end + if any(abs(t-out.x)>TOL), atest = false; end + % Check 't0' and 'fs' + if ~isequal(out.fs, fs), atest = false; end + if ~isequal(out.t0.utc_epoch_milli, t0*1000), atest = false; end + % % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the fixfs method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the fixfs method can modify the input AO by calling + % with no output. + % + % + + try + % + fs = 27; + pl = plist('fs', fs); + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = ain.fixfs(pl); + ain.fixfs(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is fixfs(at1). + % + % + + TOL = 1e-14; + atest = true; + if stest + % + % Check that fixfs modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that fixfs doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check the output data + Nsecs = at1.data.nsecs; + % We have to think about what we want to do with t0 + t0 = at1.data.t0.double; + % This is numerically more accurate + t = [0:1/fs:Nsecs-1/fs].'; + y = interp1(at1.x, at1.y, t, 'spline', 'extrap'); + if ~isequal(y, ain.y), atest = false; end + if any(abs(t-ain.x)>TOL), atest = false; end + % Check 't0' and 'fs' + if ~isequal(ain.fs, fs), atest = false; end + if ~isequal(ain.t0.utc_epoch_milli, t0*1000), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the fixfs method keeps the data shape of the input object. + % + % + function result = utp_08 + + % + % + % Test that the fixfs method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + fs = 27; + pl = plist('fs', fs); + out1 = fixfs(at5, pl); + out2 = fixfs(at6, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,2) ~= 1, atest = false; end + if size(out2.data.y,1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the fixfs method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + fs = 27; + pl = plist('fs', fs); + [o1, o2] = fixfs(at5, at6, pl); + o3 = fixfs(at5, at6, pl); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Tests that the fixfs method works with a list of AOs as input and different + % 't0' and 'fs' for the inputs. + % + % + function result = utp_10 + + % + % + % Test that the fixfs method works for a list of AOs as input and different + % 't0' and 'fs' + % + % + + try + % + fs_in = [ 3 7 9 ]; + pl = plist('fs', fs_in); + out = fixfs(at1,at5,at6, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as + % the number in the input. + % 2) Check that each output AO contains the correct data. + % 3) Check that each output contains the correct frequency and start time. + % + % + + TOL = 1e-14; + atest = true; + aoin = [at1, at5, at6]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check the output data + for kk = 1:numel(aoin) + fs = fs_in(kk); + t0 = aoin(kk).data.t0.double; + Nsecs = aoin(kk).data.nsecs; + t = [0:1/fs:Nsecs-1/fs].'; + y = interp1(aoin(kk).x,aoin(kk).y, t, 'spline', 'extrap'); + if ~isequal(y, out(kk).y), atest = false; end + if any(abs(t-out(kk).x)>TOL), atest = false; end + % Check 't0' and 'fs' + if abs(out(kk).fs - fs)>TOL, atest = false; end + if ~isequal(out(kk).t0.utc_epoch_milli, t0*1000), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + + %% UTP_12 + + % + % + % Tests that the fixfs method works with the method 'samples'. + % + % + function result = utp_12 + + % + % + % Test that the fixfs method works for the method 'samples'. + % + % + + try + % + pl = plist('method', 'Samples'); + out = fixfs(at1, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output AO contains the correct data. + % 2) Check that each output contains the correct frequency and start time. + % + % + + TOL = 1e-14; + atest = true; + if stest + % + % Check the output data + N = length(at1.y); + t = linspace(0, (N-1)/at1.fs, N).'; + y = interp1(at1.x,at1.y, t, 'spline', 'extrap'); + if ~isequal(y, out.y), atest = false; end + if any(abs(t-out.x)>TOL), atest = false; end + % Check 'fs' + if ~isequal(out.fs, 1/(t(2)-t(1))), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Tests that the fixfs method works with antialising filter. + % + % + function result = utp_13 + + % + % + % Test that the fixfs method works for the antialising filters iir and fir. + % + % + + try + % + pl_iir = plist('filter', 'iir'); + pl_fir = plist('filter', 'fir'); + out_iir = fixfs(at1, pl_iir); + out_fir = fixfs(at1, pl_fir); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output AO contains the correct data. + % 2) Check that each output contains the correct frequency and start time. + % + % + + TOL = 1e-14; + atest = true; + if stest + % + % Check the output data + Nsecs = at1.data.nsecs; + t = [0:1/at1.fs:Nsecs-1/at1.fs].'; + % Compute antialiasing filter (iir filter) + pl = plist('type', 'lowpass', 'order', 8, 'fs', at1.fs,'fc', 0.9*(at1.fs/2)); + f = miir(pl); + at1_iir = filtfilt(at1, f); + y_iir = interp1(at1_iir.x, at1_iir.y, t, 'spline', 'extrap'); + % Compute antialiasing filter (fir filter) + pl = plist('type', 'lowpass', 'order', 64, 'fs', at1.fs, 'fc', 0.9*(at1.fs/2)); + f = mfir(pl); + at1_fir = filter(at1, f); + y_fir = interp1(at1_fir.x, at1_fir.y, t, 'spline', 'extrap'); + + % Check with iir filter + if ~isequal(y_iir, out_iir.y), atest = false; end + if any(abs(t-out_iir.x)>TOL), atest = false; end + if ~isequal(out_iir.fs, 1/(t(2)-t(1))), atest = false; end + % Check with fir filter + if ~isequal(y_fir, out_fir.y), atest = false; end + if any(abs(t-out_fir.x)>TOL), atest = false; end + if ~isequal(out_fir.fs, 1/(t(2)-t(1))), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + %% UTP_14 + + % + % + % Tests that the fixfs method works with an AO with non evenly sampled data. + % + % + function result = utp_14 + + % + % + % Test that the fixfs method works for an AO with non evenly samples data. + % + % + msg = ''; + try + % + xvals = sort(randn(30,1)); + yvals = randn(30,1); + pl_ao = plist('xvals', xvals, 'yvals', yvals, 'type', 'tsdata'); + aa = ao(pl_ao); + + fs = 13; + t0 = 7; + pl = plist('t0', t0, 'fs', fs); + out = fixfs(aa, pl); + % + stest = true; + catch err + disp(err.message) + msg = err.message; + stest = false; + end + + % + % + % 1) Check that each output AO contains the correct data. + % 2) Check that each output contains the correct frequency and start time. + % + % + + TOL = 1e-14; + atest = true; + if stest + % + % Check the output data + Nsecs = aa.data.nsecs; + t0 = aa.data.getX(1); + t = t0 + [0:1/fs:Nsecs-1/fs].'; + y = interp1(aa.x,aa.y, t, 'spline', 'extrap'); + if ~isequal(y, out.y), msg = 'y values are not equal'; atest = false; end + if any(abs(t-out.x)>TOL), msg = 'x values are not evenly spaced'; atest = false; end + % Check 't0' and 'fs' + if abs(out.fs - fs)>TOL, msg = 'the sample rates are not correct'; atest = false; end + if ~eq(out.t0, aa.t0), msg = 'the t0 is not correct'; atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename, msg); + end % END UTP_14 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_fs.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_fs.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,376 @@ +% UTP_AO_FS a set of UTPs for the ao/fs method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_fs.m,v 1.3 2011/03/23 10:25:20 mauro Exp $ +% + +% +% +% The fs method of the ao class is a get-function to get the fs value +% of the data object +% +% + +function results = utp_ao_fs(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'fs'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test with all data objects + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the fs method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % The fs method doesn't work with a vector of AOs. Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the fs method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % The fs method doesn't work with a matrix of AOs. Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the fs method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % The fs method doesn't work with a list of AOs. Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the fs method works with a mix of different shaped AOs as input. + % + % + function result = utp_05 + + % + % + % The fs method can only return the fs value of one AO. Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the fs method properly applies history. + % + % + function result = utp_06 + + % + % + % The fs method doesn't change the AO, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the fs method works for AOs with different data objects. + % + % + function result = utp_07 + + % + % + % Test that the fs method returns the fs value for AOs with cdata, + % fsdata, tsdata and xydata objects. + % + % + + try + % + fs1 = at1.fs; + fs2 = at2.fs; + fs3 = at3.fs; + fs4 = at4.fs; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if ~isequal(fs1, at1.data.fs), atest = false; end; + if ~isequal(fs2, at2.data.fs), atest = false; end; + if ~isequalwithequalnans(fs3, NaN), atest = false; end; + if ~isequalwithequalnans(fs4, NaN), atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_ge.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_ge.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,258 @@ +% UTP_AO_GE a set of UTPs for the ao/ge method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_ge.m,v 1.5 2009/08/14 11:02:24 ingo Exp $ +% + +% +% +% The lt() function of the ao class ao1 ≥ ao2 compares the y-axis values of +% ao1 with y-axis values of ao2 and returns an array with elements set to +% logical 1 (true) where the relation is true and elements set to logical 0 +% where it is not. +% +% + +function results = utp_ao_ge(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'ge'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Compare against scalar + results = [results utp_03]; % Compare against AO + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the ge method compare an AO with scalar value + % + % + function result = utp_02 + + % + % + % Test that the ge method works with relational operators and the function + % command. Use for this AOs with different data objects. + % + % + + try + % + scalar = 0.2; + out11 = at1 >= scalar; + out12 = ge(at1,scalar); + out21 = at2 >= scalar; + out22 = ge(at2,scalar); + out31 = at3 >= scalar; + out32 = ge(at3,scalar); + out41 = at4 >= scalar; + out42 = ge(at4,scalar); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the result of the 'relational operator' and the 'function' + % command are the same. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check the different commands + if ~isequal(out11, out12), atest = false; end + if ~isequal(out21, out22), atest = false; end + if ~isequal(out31, out32), atest = false; end + if ~isequal(out41, out42), atest = false; end + % Check the output data + y1 = at1.y; + y2 = at2.y; + y3 = at3.y; + y4 = at4.y; + if ~isequal(out11, y1>=scalar), atest = false; end + if ~isequal(out21, y2>=scalar), atest = false; end + if ~isequal(out31, y3>=scalar), atest = false; end + if ~isequal(out41, y4>=scalar), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the ge method compare an AO with one other AO + % + % + function result = utp_03 + + % + % + % Test that the ge method works with relational operators and the function + % command. Use for this AOs with different data objects. + % Remark that both AOs must have the same size. + % + % + + try + % + out11 = at1 >= ao(1:300, zeros(300,1)); + out12 = ge(at1,ao(1:300, zeros(300,1))); + out21 = at2 >= ao(1:151, zeros(151,1)); + out22 = ge(at2,ao(1:151, zeros(151,1))); + out31 = at3 >= ao(1:100, zeros(100,1)); + out32 = ge(at3,ao(1:100, zeros(100,1))); + out41 = at4 >= ao(zeros(3,3)); + out42 = ge(at4,ao(zeros(3,3))); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the result of the 'relational operator' and the 'function' + % command are the same. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check the different commands + if ~isequal(out11, out12), atest = false; end + if ~isequal(out21, out22), atest = false; end + if ~isequal(out31, out32), atest = false; end + if ~isequal(out41, out42), atest = false; end + % Check the output data + y1 = at1.y; + y2 = at2.y; + y3 = at3.y; + y4 = at4.y; + if ~isequal(out11, y1>=0), atest = false; end + if ~isequal(out21, y2>=0), atest = false; end + if ~isequal(out31, y3>=0), atest = false; end + if ~isequal(out41, y4>=0), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_get.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_get.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,289 @@ +% UTP_AO_GET a set of UTPs for the ao/get method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_get.m,v 1.4 2011/03/29 13:03:28 ingo Exp $ +% + +% +% +% The get method of the ao class returns the value of an object +% property. This is a very simple method which accepts only one ao as +% input thus are the most general units test not possible. +% +% + +function results = utp_ao_get(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'get'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Algorithm test + results = [results utp_03]; % Algorithm test with a plist + results = [results utp_04]; % Negative test with more than one ao + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('property'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('property')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('property'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests the get method of the ao class. + % + % + function result = utp_02 + + % + % + % Test that the get returns returns the value of the specified + % property. Do this for all properties of the AO. + % + % + + try + % + aa = ao(plist('tsfcn', 'randn(size(t))', 'nsecs', 30, 'fs', 10)); + out1 = get(aa, 'data'); + out4 = get(aa, 'mdlfile'); + out6 = get(aa, 'procinfo'); + out7 = get(aa, 'plotinfo'); + out8 = get(aa, 'description'); + out10= get(aa, 'hist'); + out11= get(aa, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the correct value of the output + % + % + + atest = true; + if stest + % + if ~eq(out1, aa.data), atest = false; end + if ~isequal(out4, aa.mdlfile), atest = false; end + if ~eq(out6, aa.procinfo), atest = false; end + if ~eq(out7, aa.plotinfo), atest = false; end + if ~isequal(out8, aa.description), atest = false; end + if ~eq(out10,aa.hist), atest = false; end + if ~isequal(out11,aa.name), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the get method works with a plist. + % + % + function result = utp_03 + + % + % + % Test that the get returns returns the value of the specified + % property which is defined in a plist. + % + % + + try + % + aa = ao(plist('tsfcn', 'randn(size(t))', 'nsecs', 30, 'fs', 10)); + pl1 = plist('property', 'data'); + pl4 = plist('property', 'mdlfile'); + pl6 = plist('property', 'procinfo'); + pl7 = plist('property', 'plotinfo'); + pl8 = plist('property', 'description'); + pl10= plist('property', 'hist'); + pl11= plist('property', 'name'); + out1 = get(aa, pl1); + out4 = get(aa, pl4); + out6 = get(aa, pl6); + out7 = get(aa, pl7); + out8 = get(aa, pl8); + out10= get(aa, pl10); + out11= get(aa, pl11); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the correct value of the output + % + % + + atest = true; + if stest + % + if ~eq(out1, aa.data), atest = false; end + if ~isequal(out4, aa.mdlfile), atest = false; end + if ~eq(out6, aa.procinfo), atest = false; end + if ~eq(out7, aa.plotinfo), atest = false; end + if ~isequal(out8, aa.description), atest = false; end + if ~eq(out10,aa.hist), atest = false; end + if ~isequal(out11,aa.name), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests the get method of the ao class. + % + % + function result = utp_04 + + % + % + % Test that the get throws an error if the input are more than + % one AO. + % + % + + try + % + aa = ao(plist('tsfcn', 'randn(size(t))', 'nsecs', 30, 'fs', 10)); + out = get([aa, aa], 'name'); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_getdof.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_getdof.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,261 @@ +% UTP_AO_GETDOF a set of UTPs for the ao/getdof method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_getdof.m,v 1.3 2011/07/14 05:32:11 mauro Exp $ +% + +% +% +% The getdof method of the ao class computes the degrees of freedom for spectral estimate. +% +% + +function results = utp_ao_getdof(varargin) + + % Check the inputs + if nargin == 0 + + addpath(fullfile(fileparts(which(mfilename)), 'reference_files')) + + % Some keywords + class = 'ao'; + mthd = 'getdof'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % reference dofs + rdof = [32;34;38;44;52;59;62;63;63;63]; + + % reference ao for dof test + plrefdata = plist('fs', 1, 'nsecs', 1024, ... + 'tsfcn', 'randn(size(t))'); + refdata = ao(plrefdata); + + % reference overlap for dof test + rolap = (0:10:90); + + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test against reference data + + + 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 + + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + % + try + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + % + atest = true; + if stest + % check we have minfo objects + if isa(io, 'minfo') + + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% Default PList + if io(3).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(3).plists.isparam('method'), atest = false; end + if ~io(3).plists.isparam('DataLength'), atest = false; end + if ~io(3).plists.isparam('conf'), atest = false; end + if ~io(3).plists.isparam('dof'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('method'), 'psd'), atest = false; end + if ~isequal(io(3).plists.find('DataLength'), paramValue.EMPTY_DOUBLE), atest = false; end + if ~isequal(io(3).plists.find('conf'), 95), atest = false; end + if ~isequal(io(3).plists.find('dof'), paramValue.EMPTY_DOUBLE), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('method'), {'psd','lpsd','mscohere','mslcohere'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('DataLength'), {paramValue.EMPTY_DOUBLE}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('conf'), {95}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('dof'), {paramValue.EMPTY_DOUBLE}), atest = false; end + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_06 + + % + % + % Tests that the getdof method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the getdof method can be processed back + % to an m-file. + % + % + + % + try + plsp = plist('order',1,'navs',1); + rsp = psd(refdata,plsp); + pldof = plist('method','psd','DataLength',numel(refdata.y)); + out = getdof(rsp,pldof); + mout = rebuild(out); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'getdof'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + % + atest = true; + if stest + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'getdof'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the getdof method provides correct values for spectra + % degrees of freedom. + % Rreference on D B Percival and A T Walden, Spectral Analysis for + % Physical Applications, pg. 293 + % + % + function result = utp_07 + + % + % + % Test that the applying psd works on a single AO. + % + % + + % + try + dofs = zeros(numel(rolap),1); + for jj=1:numel(rolap) + plsp = plist('win','Hanning','order',1,'nfft',64,'olap',rolap(jj)); + axx = psd(refdata,plsp); + + df = getdof(axx,plist('method','psd','DataLength',numel(refdata.y))); + dofs(jj) = df.y; + end + + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that output agrees with the reference values. + % + % + + % + atest = true; + TOL = eps; + + if stest + if ~isequal(dofs, rdof) || any((abs(dofs - rdof) ./ rdof) >= TOL) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_gt.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_gt.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,255 @@ +% UTP_AO_GT a set of UTPs for the ao/gt method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_gt.m,v 1.2 2009/07/20 16:50:09 ingo Exp $ +% + +% +% +% The lt() function of the ao class ao1 > ao2 compares the y-axis values of +% ao1 with y-axis values of ao2 and returns an array with elements set to +% logical 1 (true) where the relation is true and elements set to logical 0 +% where it is not. +% +% + +function results = utp_ao_gt(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'gt'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Compare against scalar + results = [results utp_03]; % Compare against AO + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the gt method compare an AO with scalar value + % + % + function result = utp_02 + + % + % + % Test that the gt method works with relational operators and the function + % command. Use for this AOs with different data objects. + % + % + + try + % + scalar = 0.2; + out11 = at1 > scalar; + out12 = gt(at1,scalar); + out21 = at2 > scalar; + out22 = gt(at2,scalar); + out31 = at3 > scalar; + out32 = gt(at3,scalar); + out41 = at4 > scalar; + out42 = gt(at4,scalar); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the result of the 'relational operator' and the 'function' + % command are the same. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check the different commands + if ~isequal(out11, out12), atest = false; end + if ~isequal(out21, out22), atest = false; end + if ~isequal(out31, out32), atest = false; end + if ~isequal(out41, out42), atest = false; end + % Check the output data + y1 = at1.y; + y2 = at2.y; + y3 = at3.y; + y4 = at4.y; + if ~isequal(out11, y1>scalar), atest = false; end + if ~isequal(out21, y2>scalar), atest = false; end + if ~isequal(out31, y3>scalar), atest = false; end + if ~isequal(out41, y4>scalar), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the gt method compare an AO with one other AO + % + % + function result = utp_03 + + % + % + % Test that the gt method works with relational operators and the function + % command. Use for this AOs with different data objects. + % Remark that both AOs must have the same size. + % + % + + try + % + out11 = at1 > ao(1:300, zeros(300,1)); + out12 = gt(at1,ao(1:300, zeros(300,1))); + out21 = at2 > ao(1:151, zeros(151,1)); + out22 = gt(at2,ao(1:151, zeros(151,1))); + out31 = at3 > ao(1:100, zeros(100,1)); + out32 = gt(at3,ao(1:100, zeros(100,1))); + out41 = at4 > ao(zeros(3,3)); + out42 = gt(at4,ao(zeros(3,3))); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the result of the 'relational operator' and the 'function' + % command are the same. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check the different commands + if ~isequal(out11, out12), atest = false; end + if ~isequal(out21, out22), atest = false; end + if ~isequal(out31, out32), atest = false; end + if ~isequal(out41, out42), atest = false; end + % Check the output data + y1 = at1.y; + y2 = at2.y; + y3 = at3.y; + y4 = at4.y; + if ~isequal(out11, y1>0), atest = false; end + if ~isequal(out21, y2>0), atest = false; end + if ~isequal(out31, y3>0), atest = false; end + if ~isequal(out41, y4>0), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_heterodyne.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_heterodyne.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,529 @@ +% UTP_AO_HETERODYNE a set of UTPs for the ao/heterodyne method +% +% M Nofrarias 19-12-08 +% +% $Id: utp_ao_heterodyne.m,v 1.8 2010/07/08 08:49:37 mauro Exp $ +% + +% +% +% The hetrodyne method mixes the input ao at the specified frequency +% +% + +function results = utp_ao_heterodyne(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'heterodyne'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test functionality, no downsample + results = [results utp_08]; % Test functionality, downsampling + + results = [results utp_11(mthd, at1, ple1, plist('f0', 1))]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + % + try + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + % + atest = true; + if stest + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 7, atest = false; end + % Check key + if ~io(3).plists.isparam('f0'), atest = false; end + if ~io(3).plists.isparam('t0'), atest = false; end + if ~io(3).plists.isparam('quad'), atest = false; end + if ~io(3).plists.isparam('bw'), atest = false; end + if ~io(3).plists.isparam('lp'), atest = false; end + if ~io(3).plists.isparam('filter'), atest = false; end + if ~io(3).plists.isparam('ds'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('f0')), atest = false; end + if ~isequal(io(3).plists.find('t0'), 0), atest = false; end + if ~strcmp(io(3).plists.find('quad'), 'cos'), atest = false; end + if ~isEmptyDouble(io(3).plists.find('bw')), atest = false; end + if ~isequal(io(3).plists.find('lp'), 'yes'), atest = false; end + if ~isEmptyDouble(io(3).plists.find('filter')), atest = false; end + if ~isequal(io(3).plists.find('ds'), 'yes'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('f0'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('t0'), {0}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('quad'), {'sin', 'cos'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('bw'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('lp'), {'yes', 'no'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('filter'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('ds'), {'yes', 'no'}), atest = false; end + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the heterodyne method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the heterodyne method works for a vector of AOs as input. + % + % + + % + try + avec = [at1 at5 at6]; + pl = plist('f0',1); + out = heterodyne(avec,pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the heterodyne method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the heterodyne method works for a matrix of AOs as input. + % + % + + % + try + amat = [at1 at5 at6; at5 at6 at1]; + pl = plist('f0',1); + out = heterodyne(amat,pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the heterodyne method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the heterodyne method works for a list of AOs as input. + % + % + + % + try + pl = plist('f0',1); + out = heterodyne(at1,at5,at6,pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the heterodyne method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the heterodyne method works with an input of matrices and vectors + % and single AOs. + % + % + + % + try + pl = plist('f0',1); + out = heterodyne(at1,[at5 at6],at5,[at5 at1; at6 at1],at6,pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + % + % + % Tests that the heterodyne method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the heterodyne method can be processed back + % to an m-file. + % + % + + % + try + pl = plist('f0',1); + out = heterodyne(at5,pl); + mout = rebuild(out); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'heterodyne'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + % + atest = true; + if stest + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'heterodyne'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests the heterodyne method functionality. + % + % + function result = utp_07 + + % + % + % Build reference signal, mixed signal and heterodyne the 2nd to obtain the first + % Downsample is set to 'no' + % + % + + % + try + % generate reference ao + fs = 50; + fhet = 5; + nsecs = 1000; + pl = plist(... + 'tsfcn', '(1 + sin(2*pi*0.01*t))', ... + 'fs', fs, ... + 'nsecs', nsecs); + a1 = ao(pl); + % generate reference ao at f_heterodyne + pl = plist('tsfcn', '(1 + sin(2*pi*0.01*t))','fs', fhet, 'nsecs', nsecs); + a1h = ao(pl); + % generate same ao mixed and noisy + pl = plist('tsfcn', ... + '(1 + sin(2*pi*0.01*t)) .* cos(2*pi*5*t)',... + 'fs', fs, 'nsecs', nsecs); + a2 = ao(pl); + % compute heterodyne + a2h = heterodyne(a2,plist('f0', fhet, 'bw', fhet,'ds','no')); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % Test that we can recover the initial signal after heterodyne up to + % a numerical error given by tol + % + % + atest = false; + % + if stest + tol = 1e-5; % numerical tolerance + trans = 150; % samples out of test at the beginning and end due to transient + if all(abs(a2h.y(1+trans:end-trans) - a1.y(1+trans:end-trans) ) < tol) + atest = true; + else + atest = false; + end + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests the heterodyne method functionality. + % + % + function result = utp_08 + + % + % + % Build reference signal, mixed signal and heterodyne the 2nd to obtain the first + % Downsample is set to 'yes' + % + % + + % + try + % generate reference ao + fs = 50; + fhet = 5; + nsecs = 1000; + pl = plist(... + 'tsfcn', '(1 + sin(2*pi*0.01*t))', ... + 'fs', fs, ... + 'nsecs', nsecs); + a1 = ao(pl); + % generate reference ao at f_heterodyne + pl = plist('tsfcn', ... + '(1 + sin(2*pi*0.01*t))','fs', fhet, 'nsecs', nsecs); + a1h = ao(pl); + % generate same ao mixed and noisy + pl = plist('tsfcn', ... + '(1 + sin(2*pi*0.01*t)) .* cos(2*pi*5*t)',... + 'fs', fs, 'nsecs', nsecs); + a2 = ao(pl); + % compute heterodyne + a2h = heterodyne(a2,plist('f0', fhet, 'bw', fhet,'ds','yes')); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % Test that we can recover the initial signal after heterodyne up to + % a numerical error given by tol + % + % + atest = false; + % + if stest + tol = 1e-5; % numerical tolerance + trans = 15; % samples out of test at the beginning and end due to transient + if all(abs(a2h.y(1+trans:end-trans)-a1h.y(1+trans:end-trans)) < tol) + atest = true; + else + atest = false; + end + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_hist.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_hist.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,698 @@ +% UTP_AO_HIST a set of UTPs for the ao/hist method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_hist.m,v 1.12 2010/06/07 16:43:06 ingo Exp $ +% + +% +% +% The hist method of the ao class histograms the y +% and/or x data. +% +% + +function results = utp_ao_hist(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'hist'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test the data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test with plist: 'N' + + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + results = [results utp_12]; % Test with plist: 'X' + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Number of bins')), atest = false; end + if ~any(strcmpi(io(2).sets, 'Bin centres')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Number of bins' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('N'), atest = false; end + if ~io(3).plists.isparam('Norm'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('N'), 10), atest = false; end + if ~isequal(io(3).plists.find('Norm'), false), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('N'), {10}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('Norm'), {false, true}), atest = false; end + %%%%%%%%%% SET 'Bin centres' + if io(4).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(4).plists.isparam('X'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('X')), atest = false; end + % Check options + if ~isequal(io(4).plists.getOptionsForParam('X'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the hist method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the hist method works for a vector of AOs as input. + % + % + + try + % + out = hist(atvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check each output against the histogram of the input + for kk=1:numel(out) + if ~isequal(hist(atvec(kk).data.getY).', out(kk).data.getY) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the hist method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the hist method works for a matrix of AOs as input. + % + % + + try + % + % We need a matrix without matrix cdata AOs in it + amat = [at1 at5 at6; at6 at1 at2]; + out = hist(amat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(amat)), atest = false; end + % Check each output against the histogram value of the input + for kk=1:numel(out) + if ~isequal(hist(amat(kk).data.getY).', out(kk).data.getY) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the hist method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the hist method works for a list of AOs as input. + % + % + + try + % + out = hist(at1,at2,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the histogram value of the input + if ~isequal(hist(at1.data.getY).', out(1).data.getY), atest = false; end + if ~isequal(hist(at2.data.getY).', out(2).data.getY), atest = false; end + if ~isequal(hist(at3.data.getY).', out(3).data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the hist method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the hist method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + % We need a matrix without matrix cdata AOs in it + amat = [at1 at5 at6; at6 at1 at2]; + out = hist(at1,atvec,at2,amat,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(amat)+numel(atvec)), atest = false; end + % Check the first input + nout = 1; + if ~isequal(hist(at1.data.getY).', out(nout).data.getY), atest = false; end + nout = nout+1; + % Check the elements of the input vector + for jj=1:numel(atvec) + if ~isequal(hist(atvec(jj).data.getY).', out(nout).data.getY), atest = false; end + nout = nout+1; + end + % Check the 3rd input + if ~isequal(hist(at2.data.getY).', out(nout).data.getY), atest = false; end + nout = nout+1; + % Check the elements of the input matrix + for jj=1:numel(amat) + if ~isequal(hist(amat(jj).data.getY).', out(nout).data.getY), atest = false; end + nout = nout+1; + end + % Check the last input + if ~isequal(hist(at3.data.getY).', out(nout).data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the hist method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the hist method can be processed back + % to an m-file. + % + % + + try + % + out = hist(at1); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'hist'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'hist'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple4), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the hist method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the hist method can modify the input AO by calling with no + % output. Remark that the command at1.hist() doesn't call the histogram + % method because an AO have a property with the name 'hist'. Thus the + % command at1.hist returns the value in the property hist. + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = hist(ain); + hist(ain); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is hist(at1). + % + % + + atest = true; + if stest + % + % Check that hist modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that hist doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the hist of the copy + [n, x] = hist(at1.y, 10); + if ~isequal(n.', ain.y), atest = false; end + if ~isequal(x.', ain.x), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the hist method keeps the data shape of the input object. + % + % + function result = utp_08 + + % + % + % Test that the hist method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = hist(at5); + out2 = hist(at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y) ~= size(at5.data.y), atest = false; end + if size(out2.data.y) ~= size(at6.data.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the hist method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = hist(at5, at6); + o3 = hist(at5, at6); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Control the method with a plist. + % + % + function result = utp_10 + + % + % + % Test the hist method with a factor and an offset. + % + % + + try + % + N = 10; + pl = plist('N', N); + out = hist(at5, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the hist method with defined number of bins + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + [n, x] = hist(at5.y, N); + if ~isequal(n.', out.y), atest = false; end + if ~isequal(x.', out.x), atest = false; end + if ~isequal(length(out.y), N), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_12 + + % + % + % Control the method with a plist. + % + % + function result = utp_12 + + % + % + % Test the hist method with a factor and an offset. + % + % + + try + % + X = [-1.5:.1:1.5]; + pl = plist('X', X); + out = hist(at5, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the hist method with set of bin centers + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + [n, x] = hist(at5.y, X); + if ~isequal(n.', out.y), atest = false; end + if ~isequal(x.', out.x), atest = false; end + if ~isequal(X.', out.x), atest = false; end + if ~isequal(length(out.y), length(X)), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_ifft.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_ifft.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,708 @@ +% UTP_AO_IFFT a set of UTPs for the ao/ifft method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_ifft.m,v 1.14 2011/02/07 11:15:36 luigi Exp $ +% + +% +% +% The ifft method of the ao class computes the inverse fast fourier +% transform of time-series AOs. +% +% + +function results = utp_ao_ifft(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'ifft'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test the data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test against MATLAB's ifft - symmetric + results = [results utp_11(mthd, at2, ple1)]; % Test plotinfo doesn't disappear + results = [results utp_12]; % Test against MATLAB's ifft - nonsymmetric + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('type'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('type'), 'symmetric'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('type'), {'symmetric', 'nonsymmetric'}), atest = false; end + % Check key + if ~io(3).plists.isparam('scale'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('scale'), false), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('scale'), paramValue.FALSE_TRUE{2}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the ifft method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the ifft method works for a vector of AOs as input. + % + % + + try + % + avec = [at2 at2]; + out = ifft(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + % Check each output + for kk=1:numel(out) + y = [avec(kk).y; avec(kk).data.getY(end-1:-1:2)]; + y = ifft(y, 'symmetric'); + % Compute time axis + N = length(y); + x = linspace(0, (N-1)/avec(kk).fs, N).'; + if any(abs(out(kk).x - x)>TOL), atest = false; end + if ~isequal(out(kk).y, y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the ifft method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the ifft method works for a matrix of AOs as input. + % + % + + try + % + amat = [at2 at2 at2; at2 at2 at2]; + out = ifft(amat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + % Check each output + for kk=1:numel(out) + y = [amat(kk).y; amat(kk).data.getY(end-1:-1:2)]; + y = ifft(y, 'symmetric'); + % Compute time axis + N = length(y); + x = linspace(0, (N-1)/amat(kk).fs, N).'; + if any(abs(out(kk).x - x)>TOL), atest = false; end + if ~isequal(out(kk).y, y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the ifft method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the ifft method works for a list of AOs as input. + % + % + + try + % + out = ifft(at2,at2,at2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at2, at2, at2]; + TOL = 1e-14; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output + for kk=1:numel(out) + y = [aoin(kk).y; aoin(kk).data.getY(end-1:-1:2)]; + y = ifft(y, 'symmetric'); + % Compute time axis + N = length(y); + x = linspace(0, (N-1)/aoin(kk).fs, N).'; + if any(abs(out(kk).x - x)>TOL), atest = false; end + if ~isequal(out(kk).y, y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the ifft method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the ifft method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = ifft(at2,[at2 at2],at2,[at2 at2; at2 at2],at2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at2, reshape([at2 at2], 1, []), at2, reshape([at2 at2; at2 at2], 1, []), at2]; + TOL = 1e-14; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + % Check each output + for kk=1:numel(out) + y = [aoin(kk).y; aoin(kk).data.getY(end-1:-1:2)]; + y = ifft(y, 'symmetric'); + % Compute time axis + N = length(y); + x = linspace(0, (N-1)/aoin(kk).fs, N).'; + if any(abs(out(kk).x - x)>TOL), atest = false; end + if ~isequal(out(kk).y, y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the ifft method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the ifft method can be processed back + % to an m-file. + % + % + + try + % + out = ifft(at2); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ifft'. + % 2) % Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'ifft'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the ifft method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the ifft method can modify the input AO by calling with no + % output. + % + % + + try + % + % copy at2 to work with + ain = ao(at2); + % modify ain + aout = ifft(ain); + ain.ifft; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at2' and 'ain' are now different. + % 2) Check that 'ain' is ifft(at2). + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check that ifft modified the input by comparing to the copy + if eq(ao(at2), ain, ple1), atest = false; end + + % Check that ifft doesn't modified the input for the function + % notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the ifft of the copy + y = [at2.y; at2.data.getY(end-1:-1:2)]; + y = ifft(y, 'symmetric'); + % Compute time axis + N = length(y); + x = linspace(0, (N-1)/at2.fs, N).'; + if any(abs(ain.x - x)>TOL), atest = false; end + if ~isequal(ain.y, y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the ifft method keeps the data shape of the input object. + % + % + function result = utp_08 + + % + % + % Test that the ifft method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + aa1 = at5.psd; + aa2 = at6.psd; + out1 = ifft(aa1); + out2 = ifft(aa2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,1) == 1, atest = false; end + if size(out2.data.y,2) == 2, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the ifft method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + aa1 = at5.psd; + aa2 = at6.psd; + [o1, o2] = ifft(aa1, aa2); + o3 = ifft(aa1, aa2); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Tests that the ifft method agrees with MATLAB's ifft when + % configured to use the same parameters. + % + % + function result = utp_10 + + % + % + % Test that the applying ifft works on two AOs. + % + % + + try + % + % Construct two test AOs + nsecs = 10; + fs = 1000; + pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'randn(size(t))'); + a1 = fft(ao(pl),plist('type','plain')); + % Compute fft + out = ifft(a1,plist('type','symmetric')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that output agrees with the output of MATLAB's ifft. + % + % + + atest = true; + if stest + % + % Compute ifft using MATLAB's ifft + yxx = ifft(a1.data.y, 'symmetric'); + if ~isequal(yxx(:), out.data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_12 + + % + % + % Tests that the ifft method agrees with MATLAB's ifft when + % configured to use the same parameters. + % + % + function result = utp_12 + + % + % + % Test that the applying ifft works on a single AO with 'nonsymmetric' + % option. + % + % + + try + % + % Construct two test AOs + nsecs = 10; + fs = 1000; + pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'randn(size(t))'); + a1 = fft(ao(pl),plist('type','plain')); + % Compute fft + out = ifft(a1, plist('type', 'nonsymmetric')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that output agrees with the output of MATLAB's ifft. + % + % + + atest = true; + if stest + % + % Compute ifft using MATLAB's ifft + yxx = ifft(a1.data.y, 'nonsymmetric'); + if ~isequal(yxx(:), out.data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_imag.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_imag.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,624 @@ +% UTP_AO_IMAG a set of UTPs for the ao/imag method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_imag.m,v 1.12 2011/04/17 10:48:41 hewitson Exp $ +% + +% +% +% The imag method of the ao class computes the imaginary part of the y +% and/or x data. +% +% + +function results = utp_ao_imag(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'imag'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with additional plist with the key 'axis' + results = [results utp_09]; % Test input data shape == output data shape + results = [results utp_10]; % Test output of the data + results = [results utp_11(mthd, at4, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the imag method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the imag method works for a vector of AOs as input. + % + % + + try + % + out = imag(atvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check each output against the imaginary part of the input + for kk=1:numel(out) + if ~isequal(imag(atvec(kk).data.getY), out(kk).data.getY) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the imag method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the imag method works for a matrix of AOs as input. + % + % + + try + % + out = imag(atmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check each output against the imaginary part of the input + for kk=1:numel(out) + if ~isequal(imag(atmat(kk).data.getY), out(kk).data.getY) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the imag method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the imag method works for a list of AOs as input. + % + % + + try + % + out = imag(at1,at2,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the imaginary part of the input + if ~isequal(imag(at1.data.getY), out(1).data.getY), atest = false; end + if ~isequal(imag(at2.data.getY), out(2).data.getY), atest = false; end + if ~isequal(imag(at3.data.getY), out(3).data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the imag method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the imag method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = imag(at1,atvec,at2,atmat,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(atmat)+numel(atvec)), atest = false; end + % Check the first input + nout = 1; + if ~isequal(imag(at1.data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + % Check the elements of the input vector + for jj=1:numel(atvec) + if ~isequal(imag(atvec(jj).data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + end + % Check the 3rd input + if ~isequal(imag(at2.data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + % Check the elements of the input matrix + for jj=1:numel(atmat) + if ~isequal(imag(atmat(jj).data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + end + % Check the last input + if ~isequal(imag(at3.data.getY), out(nout).data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the imag method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the imag method can be processed back + % to an m-file. + % + % + + try + % + out = imag(at1); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'imag'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'imag'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple4), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the imag method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the imag method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = ain.imag(); + ain.imag(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is imag(at1). + % + % + + atest = true; + if stest + % + % Check that imag modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that imag doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the imag value of the copy + if ~isequal(imag(at1.data.getY), ain.data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the imag method can modify the single axis controlled by the + % plist and the resuld can be processed back to an m-file. + % + % + + try + % + plx = plist('axis', 'X'); + ply = plist('axis', 'Y'); + plxy = plist('axis', 'XY'); + out1 = imag(at1, plx); + out2 = imag(at1, ply); + out3 = imag(at1, plxy); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the imag method applies to the x-axis + % 2) Check that the imag method applies to the y-axis + % 3) Check that the imag method applies to both axes + % 4) Check that the re-built objects are the same object as 'out[1..3]'. + % + % + + atest = true; + if stest + % + % Check each output against the imaginary part of the input + if ~isequal(imag(at1.data.getX), out1.data.getX), atest = false; end + if ~isequal(at1.data.getY, out1.data.getY), atest = false; end + if ~isequal(at1.data.getX, out2.data.getX), atest = false; end + if ~isequal(imag(at1.data.getY), out2.data.getY), atest = false; end + if ~isequal(imag(at1.data.getX), out3.data.getX), atest = false; end + if ~isequal(imag(at1.data.getY), out3.data.getY), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple4), atest = false; end + if ~eq(mout2, out2, ple4), atest = false; end + if ~eq(mout3, out3, ple4), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Control the method with a plist. + % + % + function result = utp_09 + + % + % + % Test that the imag method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = imag(at5); + out2 = imag(at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.x) ~= size(at5.data.x), atest = false; end + if size(out1.data.y) ~= size(at5.data.y), atest = false; end + if size(out2.data.x) ~= size(at6.data.x), atest = false; end + if size(out2.data.y) ~= size(at6.data.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the imag method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_10 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = imag(at5, at6); + o3 = imag(at5, at6); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_index.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_index.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,524 @@ +% UTP_AO_INDEX a set of UTPs for the ao/index method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_index.m,v 1.6 2009/08/07 10:28:36 hewitson Exp $ +% + +% +% +% The index method of the ao class index into a AO vector or matrix. This +% properly captures the history. +% +% + +function results = utp_ao_index(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'index'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test history is working + results = [results utp_06]; % Test the modify call works + results = [results utp_07]; % Test with plist + results = [results utp_08]; % Test select more objects with an index + + results = [results utp_11(mthd, at1, ple1, plist('i', 1))]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('i'), atest = false; end + if ~io(3).plists.isparam('j'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('i')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('j')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('i'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('j'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the index method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the index method works for a vector of AOs as input. The + % following indexing should work: + % I = [ 1 2 3 ] or (I/J) = [(1,1), (1,2), (1,3)] + % + % + + try + % + objvec = [at1, at2, at3]; + out1 = objvec.index(1); + out2 = objvec.index(3); + out3 = objvec.index(1,2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the index method selects the correct object. + % + % + + atest = true; + if stest + % + if ~eq(out1, at1, ple3), atest = false; end + if ~eq(out2, at3, ple3), atest = false; end + if ~eq(out3, at2, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the index method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the index method works for a matrix of AOs as input. The + % following indexing should work: + % I = [ 1 3 5 ] or (I/J) = [(1,1), (1,2), (1,3)] + % [ 2 4 6 ] [(2,1), (2,2), (2,3)] + % + + try + % + objmat = [at1, at2, at3; ... + at3, at1, at2]; + out1 = objmat.index(5); + out2 = objmat.index(4); + out3 = objmat.index(1,2); + out4 = objmat.index(2,1); + out5 = objmat.index(2,2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the index method selects the correct object. + % + % + + atest = true; + if stest + % + if ~eq(out1, at3, ple3), atest = false; end + if ~eq(out2, at1, ple3), atest = false; end + if ~eq(out3, at2, ple3), atest = false; end + if ~eq(out4, at3, ple3), atest = false; end + if ~eq(out5, at1, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the index method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % The index method doesn't work for a list of AOs as input. + % + % + + try + % + out = index(at1,at2,at3, 4); + % + stest = false; + catch + stest = true; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the index method properly applies history. + % + % + function result = utp_05 + + % + % + % Test that the result of index have an additional history step. + % + % + + try + % + i = 2; + j = 3; + objmat = [at1, at2, at3; ... + at3, at1, at2]; + out = index(objmat, i, j); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds + % to 'index'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'index'), atest = false; end + % Check that the history-plist contains the used indices. + pl = out.hist.plistUsed; + if pl.find('i') ~= i, atest = false; end + if pl.find('j') ~= j, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the index method works for the modifier command. + % + % + function result = utp_06 + + % + % + % Tests that the index method works for the modifier command. + % + % + + try + % + i = 1; + j = 1; + objmat = [at1, at2, at3; ... + at3, at1, at2]; + out1 = index(objmat, i, j); + out2 = objmat.index(i,j); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history-plist contains the used indices. + % 2) Check that the index method selects the correct object + % + % + + atest = true; + if stest + % + % Check that the history-plist contains the used indices. + pl = out1.hist.plistUsed; + if pl.find('i') ~= i, atest = false; end + if pl.find('j') ~= j, atest = false; end + % Check that the index method selects the correct object + if ~eq(out1, at1, ple3), atest = false; end + % Check that the history-plist contains the used indices. + pl = out2.hist.plistUsed; + if pl.find('i') ~= i, atest = false; end + if pl.find('j') ~= j, atest = false; end + % Check that the index method selects the correct object + if ~eq(out2, at1, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Control the method with a plist. + % + % + function result = utp_07 + + % + % + % Test that the index method can be controled with a plist. + % + % + + try + % + i1 = 6; + i2 = 1; + j2 = 3; + objmat = [at1, at2, at3; ... + at3, at1, at2]; + pl1 = plist('i', i1); + pl2 = plist('i', i2, 'j', j2); + out1 = index(objmat, pl1); + out2 = index(objmat, pl2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history-plist contains the used indices. + % 2) Check that the index method selects the correct object + % + % + + atest = true; + if stest + % + % Check that the history-plist contains the used indices. + pl = out1.hist.plistUsed; + if ~isequal(pl.find('i'), i1), atest = false; end + if ~isequal(pl.find('j'), []), atest = false; end + % Check that the index method selects the correct object + if ~eq(out1, at2, ple3), atest = false; end + % Check that the history-plist contains the used indices. + pl = out2.hist.plistUsed; + if ~isequal(pl.find('i'), i2), atest = false; end + if ~isequal(pl.find('j'), j2), atest = false; end + % Check that the index method selects the correct object + if ~eq(out2, at3, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test that the index method selects more objects if I have more indices. + % + % + function result = utp_08 + + % + % + % Test that the index method selects more objects if I have more indices. + % + % + + try + % + i = [2 6]; + objmat = [at1, at2, at3; ... + at3, at1, at2]; + pl = plist('i', i); + out1 = objmat.index(i); + out2 = objmat.index(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history-plist contains the used indices. + % 2) Check that the index method selects the correct object + % + % + + atest = true; + if stest + % + % Check that the history-plist contains the used indices. + pl = out1(1).hist.plistUsed; + if ~isequal(pl.find('i'), i), atest = false; end + if ~isequal(pl.find('j'), []), atest = false; end + % Check that the index method selects the correct object + if ~eq(out1(1), at3, ple3), atest = false; end + if ~eq(out1(2), at2, ple3), atest = false; end + % Check that the history-plist contains the used indices. + pl = out2(2).hist.plistUsed; + if ~isequal(pl.find('i'), i), atest = false; end + if ~isequal(pl.find('j'), []), atest = false; end + % Check that the index method selects the correct object + if ~eq(out2(1), at3, ple3), atest = false; end + if ~eq(out2(2), at2, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_integrate.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_integrate.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,624 @@ +% UTP_AO_INTEGRATE a set of UTPs for the ao/integrate method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_integrate.m,v 1.12 2009/07/30 16:59:54 ingo Exp $ +% + +% +% +% The integrate method of the ao class computes the integral of the input data +% using integrateerent methods. +% +% + +function results = utp_ao_integrate(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'integrate'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input (default: method = '3POINT') + results = [results utp_03]; % Matrix input (default: method = '3POINT') + results = [results utp_04]; % List input (default: method = '3POINT') + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test the data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test with plist: method = 'TRAPEZOIDAL' + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('method'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('method'), 'Trapezoidal'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('method'), {'Trapezoidal'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the integrate method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the integrate method works for a vector of AOs as input. Use for + % this test the trapezoidal method. + % + % + + try + % + out = integrate(atvec, plist('method', 'Trapezoidal')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check each output against the integral of the input + for kk = 1:numel(atvec) + % Trapezoidal + x = atvec(kk).data.getX; + y = atvec(kk).data.getY; + if ~isequal(out(kk).y, trapz(x,y)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the integrate method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the integrate method works for a matrix of AOs as input. Use for + % this test the Trapezoidal method. + % + % + + try + % + % We need a matrix without cdata AOs in it + amat = [at1 at5 at6; at6 at1 at2]; + out = integrate(amat, plist('method', 'Trapezoidal')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(amat)), atest = false; end + % Check each output against the integral of the input + for kk = 1:numel(amat) + % Trapezoidal integral + x = amat(kk).data.getX; + y = amat(kk).data.getY; + if ~isequal(out(kk).y, trapz(x,y)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the integrate method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the integrate method works for a list of AOs as input. Use for + % this test the trapezoidal. + % + % + + try + % + out = integrate(at1,at2,at3, plist('method', 'trapezoidal')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, at2, at3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the integral of the input + for kk = 1:numel(aoin) + % Trapezoidal integral + x = aoin(kk).data.getX; + y = aoin(kk).data.getY; + if ~isequal(out(kk).y, trapz(x,y)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the integrate method works with a mix of integrateerent shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the integrate method works with an input of matrices and vectors + % and single AOs. Use for this test the trapezoidal. + % + % + + try + % + % We need a matrix without cdata AOs in it + amat = [at1 at5 at6; at6 at1 at2]; + out = integrate(at1,atvec,at2,amat,at3, plist('method', 'trapezoidal')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, reshape(atvec, 1, []), at2, reshape(amat, 1, []), at3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(amat)+numel(atvec)), atest = false; end + % Check each output against the integral of the input + for kk = 1:numel(aoin) + % Trapezoidal integral + x = aoin(kk).data.getX; + y = aoin(kk).data.getY; + if ~isequal(out(kk).y, trapz(x,y)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the integrate method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the integrate method can be processed back + % to an m-file. + % + % + + try + % + out = integrate(at1); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'integrate'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'integrate'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the integrate method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the integrate method can modify the input AO by calling with no + % output. Use for this test the trapezoidal. + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = ain.integrate(plist('method', 'trapezoidal')); + ain.integrate(plist('method', 'trapezoidal')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now integrateerent. + % 2) Check that 'ain' is integrate(at1). + % + % + + atest = true; + if stest + % + % Check that integrate modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that integrate doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the integrate value of the copy + % trapezoidal integral + x = at1.data.getX; + y = at1.data.getY; + if ~isequal(ain.y, trapz(x,y)), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the integrate method keeps the data shape of the input object. + % + % + function result = utp_08 + + % + % + % Test that the integrate method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = integrate(at5); + out2 = integrate(at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y) ~= size(at5.data.y), atest = false; end + if size(out2.data.y) ~= size(at6.data.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the integrate method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = integrate(at5, at6); + o3 = integrate(at5, at6); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Control the method with a plist. + % + % + function result = utp_10 + + % + % + % Test the trapezoidal. + % + % + + try + % + pl = plist('method', 'trapezoidal'); + out = integrate(at5, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the integrate method uses the trapezoidal method. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Compute trapezoidal integral + x = at5.data.getX; + y = at5.data.getY; + % Check the trapezoidal integral + if ~isequal(out.y, trapz(x,y)), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_interp.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_interp.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,682 @@ +% UTP_AO_INTERP a set of UTPs for the ao/interp method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_interp.m,v 1.10 2009/08/07 10:28:36 hewitson Exp $ +% + +% +% +% The interp method of the ao class interpolates AOs. +% +% + +function results = utp_ao_interp(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'interp'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test the data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test different interpolations + results = [results utp_11(mthd, at1, ple1, plist('vertices', 0:10))]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('vertices'), atest = false; end + if ~io(3).plists.isparam('method'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('vertices')), atest = false; end + if ~isequal(io(3).plists.find('method'), 'spline'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('vertices'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('method'), {'nearest', 'linear', 'spline', 'cubic'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the interp method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the interp method works for a vector of AOs as input. + % + % + + try + % + v = linspace(0,100).'; + out = interp(atvec, plist('vertices', v)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 7e-14; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(atvec), atest = false; end + % Check the data + for kk = 1:numel(atvec) + if isa(atvec(kk).data, 'cdata') + % for cdata object + y = interp1(atvec(kk).y, v, 'spline', 'extrap'); + if ~isequal(y, out(kk).y), atest = false; end + else + % for tsdata, fsdata and xydata objects + y = interp1(atvec(kk).x, atvec(kk).y, v, 'spline', 'extrap'); + if any(abs(v - out(kk).x) > TOL), atest = false; end + if ~isequal(y, out(kk).y), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the interp method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the interp method works for a matrix of AOs as input. + % + % + + try + % + v = linspace(0,100).'; + out = interp(atmat, plist('vertices', v)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 7e-14; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(atmat), atest = false; end + % Check the data + for kk = 1:numel(atmat) + if isa(atmat(kk).data, 'cdata') + % for cdata object + y = interp1(atmat(kk).y, v, 'spline', 'extrap'); + if ~isequal(y, out(kk).y), atest = false; end + else + % for tsdata, fsdata and xydata objects + y = interp1(atmat(kk).x, atmat(kk).y, v, 'spline', 'extrap'); + if any(abs(v - out(kk).x) > TOL), atest = false; end + if ~isequal(y, out(kk).y), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the interp method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the interp method works for a list of AOs as input. + % + % + + try + % + v = linspace(0,100).'; + out = interp(at1,at5,at6, plist('vertices', v)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, at5, at6]; + TOL = 7e-14; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check the data + for kk = 1:numel(aoin) + if isa(aoin(kk).data, 'cdata') + % for cdata object + y = interp1(aoin(kk).y, v, 'spline', 'extrap'); + if ~isequal(y, out(kk).y), atest = false; end + else + % for tsdata, fsdata and xydata objects + y = interp1(aoin(kk).x, aoin(kk).y, v, 'spline', 'extrap'); + if any(abs(v - out(kk).x) > TOL), atest = false; end + if ~isequal(y, out(kk).y), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the interp method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the interp method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + v = linspace(0,100).'; + out = interp(at1,[at5 at6],at5,[at5 at1; at6 at1],at6, plist('vertices', v)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + aoin = [at1, reshape([at5 at6], 1, []), at5, reshape([at5 at1; at6 at1], 1, []), at6]; + TOL = 7e-14; + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + % Check the data + for kk = 1:numel(aoin) + if isa(aoin(kk).data, 'cdata') + % for cdata object + y = interp1(aoin(kk).y, v, 'spline', 'extrap'); + if ~isequal(y, out(kk).y), atest = false; end + else + % for tsdata, fsdata and xydata objects + y = interp1(aoin(kk).x, aoin(kk).y, v, 'spline', 'extrap'); + if any(abs(v - out(kk).x) > TOL), atest = false; end + if ~isequal(y, out(kk).y), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the interp method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the interp method can be processed back + % to an m-file. + % + % + + try + % + v = linspace(0,100); + out = interp(at5, plist('vertices', v)); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'interp'. + % 2) Check that the re-built object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'interp'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the interp method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the interp method can modify the input AO by calling with no + % output. + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + v = linspace(0,100).'; + pl = plist('vertices', v); + aout = ain.interp(pl); + ain.interp(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is interp(at1). + % + % + + atest = true; + TOL = 7e-14; + if stest + % + % Check that interp modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that interp doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the interp of the copy + y = interp1(at1.x, at1.y, v, 'spline', 'extrap'); + if any(abs(v - ain.x) > TOL), atest = false; end + if ~isequal(y, ain.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the interp method keeps the data shape of the input object. + % + % + function result = utp_08 + + % + % + % Test that the interp method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + v = linspace(0,100); + pl = plist('vertices', v); + out1 = interp(at5, pl); + out2 = interp(at6, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,2) ~= 1, atest = false; end + if size(out2.data.y,1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the interp method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + v = linspace(0,100); + pl = plist('vertices', v); + [o1, o2] = interp(at5, at6, pl); + o3 = interp(at5, at6, pl); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Tests that the interp method can different interpolations. + % + % + function result = utp_10 + + % + % + % Test that the interp method can all of MATLAB interpolates methods. + % 'nearest' - Nearest neighbor interpolation + % 'linear' - Linear interpolation + % 'spline' - Cubic spline interpolation (see UTPs above) + % 'pchip' - Piecewise cubic Hermite interpolation + % + % + + try + % + v = linspace(0,100).'; + mtd1 = 'nearest'; + mtd2 = 'linear'; + mtd3 = 'pchip'; + pl1 = plist('vertices', v, 'method', mtd1); + pl2 = plist('vertices', v, 'method', mtd2); + pl3 = plist('vertices', v, 'method', mtd3); + out1 = at1.interp(pl1); + out2 = at1.interp(pl2); + out3 = at1.interp(pl3); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the different interpolations + % 2) Check that the re-built objects are the same as 'out1..3'. + % + % + + atest = true; + TOL = 7e-14; + if stest + % + % Check the data + y1 = interp1(at1.x, at1.y, v, mtd1, 'extrap'); + y2 = interp1(at1.x, at1.y, v, mtd2, 'extrap'); + y3 = interp1(at1.x, at1.y, v, mtd3, 'extrap'); + if any(abs(v - out1.x) > TOL), atest = false; end + if ~isequal(y1, out1.y), atest = false; end + if any(abs(v - out2.x) > TOL), atest = false; end + if ~isequal(y2, out2.y), atest = false; end + if any(abs(v - out3.x) > TOL), atest = false; end + if ~isequal(y3, out3.y), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_interpmissing.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_interpmissing.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,704 @@ +% UTP_AO_INTERPMISSING a set of UTPs for the ao/interpmissing method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_interpmissing.m,v 1.13 2010/06/07 16:43:06 ingo Exp $ +% + +% +% +% The interpmissing method of the ao class interpolates over any missing +% samples in a time-series AO. +% For this UTP contain the test objects different gaps. These gaps are created +% with the AO method select. Thus at1, at5 and at5 get gaps at the positions +% idx = 30 and idx = 51 +% +% + +function results = utp_ao_interpmissing(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'interpmissing'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Create gaps + samples = [1:30, 70:90, 150:300]; + at1 = at1.select(plist('samples', samples)); + at5 = at5.select(plist('samples', samples)); + at6 = at6.select(plist('samples', samples)); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test with different tolerances + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('d'), atest = false; end + if ~io(3).plists.isparam('method'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('d'), 1.5), atest = false; end + if ~isequal(io(3).plists.find('method'), 'spline'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('d'), {1.5}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('method'), {'nearest', 'linear', 'spline', 'cubic'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the interpmissing method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the interpmissing method works for a vector of AOs as input. + % Known gaps at the position idx = 30 and 51 + % + % + + try + % + avec = [at1 at5 at6]; + out = interpmissing(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + % Check each output data + for kk = 1:numel(avec) + x = avec(kk).data.getX; + % Gap at index position 30 + gap1 = x(30+1) - x(30) - 1/avec(kk).fs; + gap1_t = ((1/avec(kk).fs : 1/avec(kk).fs : gap1) + x(30)).'; + % Gap at index position 51 + gap2 = x(51+1) - x(51) - 1/avec(kk).fs; + gap2_t = ((1/avec(kk).fs : 1/avec(kk).fs : gap2) + x(51)).'; + % Create t + t = [x(1:30); gap1_t; x(31:51); gap2_t; x(52:end)]; + % Interpolate the missing samples + res = interp(avec(kk), plist('vertices', t)); + if ~isequal(out(kk).x, res.x), atest = false; end + if ~isequal(out(kk).y, res.y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the interpmissing method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the interpmissing method works for a matrix of AOs as input. + % Known gaps at the position idx = 30 and 51 + % + % + + try + % + amat = [at1 at5 at6; at6 at5 at1]; + out = interpmissing(amat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + % Check each output data + for kk = 1:numel(amat) + x = amat(kk).data.getX; + % Gap at index position 30 + gap1 = x(30+1) - x(30) - 1/amat(kk).fs; + gap1_t = ((1/amat(kk).fs : 1/amat(kk).fs : gap1) + x(30)).'; + % Gap at index position 51 + gap2 = x(51+1) - x(51) - 1/amat(kk).fs; + gap2_t = ((1/amat(kk).fs : 1/amat(kk).fs : gap2) + x(51)).'; + % Create t + t = [x(1:30); gap1_t; x(31:51); gap2_t; x(52:end)]; + % Interpolate the missing samples + res = interp(amat(kk), plist('vertices', t)); + if ~isequal(out(kk).x, res.x), atest = false; end + if ~isequal(out(kk).y, res.y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the interpmissing method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the interpmissing method works for a list of AOs as input. + % Known gaps at the position idx = 30 and 51 + % + % + + try + % + out = interpmissing(at1,at5,at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, at5, at6]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output data + for kk = 1:numel(aoin) + x = aoin(kk).data.getX; + % Gap at index position 30 + gap1 = x(30+1) - x(30) - 1/aoin(kk).fs; + gap1_t = ((1/aoin(kk).fs : 1/aoin(kk).fs : gap1) + x(30)).'; + % Gap at index position 51 + gap2 = x(51+1) - x(51) - 1/aoin(kk).fs; + gap2_t = ((1/aoin(kk).fs : 1/aoin(kk).fs : gap2) + x(51)).'; + % Create t + t = [x(1:30); gap1_t; x(31:51); gap2_t; x(52:end)]; + % Interpolate the missing samples + res = interp(aoin(kk), plist('vertices', t)); + if ~isequal(out(kk).x, res.x), atest = false; end + if ~isequal(out(kk).y, res.y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the interpmissing method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the interpmissing method works with an input of matrices and vectors + % and single AOs. Known gaps at the position idx = 30 and 51 + % + % + + try + % + out = interpmissing(at1,[at5 at6],at5,[at5 at1; at6 at1],at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, reshape([at5 at6], 1, []), at5, reshape([at5 at1; at6 at1], 1, []), at6]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + % Check each output data + for kk = 1:numel(aoin) + x = aoin(kk).data.getX; + % Gap at index position 30 + gap1 = x(30+1) - x(30) - 1/aoin(kk).fs; + gap1_t = ((1/aoin(kk).fs : 1/aoin(kk).fs : gap1) + x(30)).'; + % Gap at index position 51 + gap2 = x(51+1) - x(51) - 1/aoin(kk).fs; + gap2_t = ((1/aoin(kk).fs : 1/aoin(kk).fs : gap2) + x(51)).'; + % Create t + t = [x(1:30); gap1_t; x(31:51); gap2_t; x(52:end)]; + % Interpolate the missing samples + res = interp(aoin(kk), plist('vertices', t)); + if ~isequal(out(kk).x, res.x), atest = false; end + if ~isequal(out(kk).y, res.y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the interpmissing method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the interpmissing method can be processed back + % to an m-file. + % + % + + try + % + % remove some samples + ac = ao(at5); + out = interpmissing(ac); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'interpmissing'. + % 2) Check that the re-built object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'interpmissing'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the interpmissing method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the interpmissing method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % Known gaps at the position idx = 30 and 51 + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = ain.interpmissing(); + ain.interpmissing(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is interpmissing(at1). + % + % + + atest = true; + if stest + % + % Check that interpmissing modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that interpmissing doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the interpmissing value of the copy + x = at1.data.getX; + % Gap at index position 30 + gap1 = x(30+1) - x(30) - 1/at1.fs; + gap1_t = ((1/at1.fs : 1/at1.fs : gap1) + x(30)).'; + % Gap at index position 51 + gap2 = x(51+1) - x(51) - 1/at1.fs; + gap2_t = ((1/at1.fs : 1/at1.fs : gap2) + x(51)).'; + % Create t + t = [x(1:30); gap1_t; x(31:51); gap2_t; x(52:end)]; + % Interpolate the missing samples + res = interp(at1, plist('vertices', t)); + if ~isequal(ain.x, res.x), atest = false; end + if ~isequal(ain.y, res.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the interpmissing method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = interpmissing(at5); + out2 = interpmissing(at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,2) ~= 1, atest = false; end + if size(out2.data.y,1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the interpmissing method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = interpmissing(at5, at6); + o3 = interpmissing(at5, at6); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Tests that the interpmissing method can change the tolerance for finding + % missing samples. + % + % + function result = utp_10 + + % + % + % Test that the interpmissing method works with a plist which changes the + % tolerance. Known gaps at the position idx = 30 and 51 with the width of 40 + % and 60 + % + % + + try + % + pl1 = plist('d', 41); % This tolerance supress the first gap + pl2 = plist('d', 61); % This tolerance supress all gaps + out1 = interpmissing(at1, pl1); + out2 = interpmissing(at1, pl2); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % 3) Check that the re-built object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check each output data + x = at1.data.getX; + % Gap at index position 51 + gap2 = x(51+1) - x(51) - 1/at1.fs; + gap2_t = ((1/at1.fs : 1/at1.fs : gap2) + x(51)).'; + % Create t + t = [x(1:51); gap2_t; x(52:end)]; + % Interpolate the missing samples + res = interp(at1, plist('vertices', t)); + % Depending to the tolerance have at1 only one gap + if ~isequal(out1.x, res.x), atest = false; end + if ~isequal(out1.y, res.y), atest = false; end + % Depending to the tolerance have no gaps + if ~isequal(out2.x, at1.x), atest = false; end + if ~isequal(out2.y, at1.y), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_inv.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_inv.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,613 @@ +% UTP_AO_INV a set of UTPs for the ao/inv method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_inv.m,v 1.10 2011/04/17 10:48:31 hewitson Exp $ +% + +% +% +% The inv method of the ao class computes the inverse of the y data. +% +% + +function results = utp_ao_inv(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'inv'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with additional plist with the key 'axis' + results = [results utp_09]; % Test input data shape == output data shape + results = [results utp_10]; % Test output of the data + results = [results utp_11(mthd, at4, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the inv method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the inv method works for a vector of AOs as input. + % + % + + try + % + atvec = [at4, at4, at4]; + out = inv(atvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check each output against the inverse of the input + for kk=1:numel(out) + if ~isequal(inv(atvec(kk).data.getY), out(kk).data.getY) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the inv method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the inv method works for a matrix of AOs as input. + % + % + + try + % + atmat = [at4 at4 at4; at4 at4 at4]; + out = inv(atmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check each output against the inverse of the input + for kk=1:numel(out) + if ~isequal(inv(atmat(kk).data.getY), out(kk).data.getY) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the inv method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the inv method works for a list of AOs as input. + % + % + + try + % + out = inv(at4, at4, at4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the inverse of the input + if ~isequal(inv(at4.data.getY), out(1).data.getY), atest = false; end + if ~isequal(inv(at4.data.getY), out(2).data.getY), atest = false; end + if ~isequal(inv(at4.data.getY), out(3).data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the inv method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the inv method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + atmat = [at4 at4; at4 at4]; + atvec = [at4 at4]; + out = inv(at4,atvec,at4,atmat,at4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(atmat)+numel(atvec)), atest = false; end + % Check the first input + nout = 1; + if ~isequal(inv(at4.data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + % Check the elements of the input vector + for jj=1:numel(atvec) + if ~isequal(inv(atvec(jj).data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + end + % Check the 3rd input + if ~isequal(inv(at4.data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + % Check the elements of the input matrix + for jj=1:numel(atmat) + if ~isequal(inv(atmat(jj).data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + end + % Check the last input + if ~isequal(inv(at4.data.getY), out(nout).data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the inv method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the inv method can be processed back + % to an m-file. + % + % + + try + % + out = inv(at4); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'inv'. + % 2) Check that the re-built object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'inv'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the inv method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the inv method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at4 to work with + ain = ao(at4); + % modify ain + aout = ain.inv(); + ain.inv(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at4' and 'ain' are now different. + % 2) Check that 'ain' is inv(at4). + % + % + + atest = true; + if stest + % + % Check that inv modified the input by comparing to the copy + if eq(ao(at4), ain, ple1), atest = false; end + % Check that inv doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the inv value of the copy + if ~isequal(inv(at4.data.getY), ain.data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the inv method can modify the single axis controlled by the + % plist and the resuld can be processed back to an m-file. + % + % + + try + % + ply = plist('axis', 'Y'); + out = inv(at4, ply); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the inv method applies to the x-axis + % 2) Check that the inv method applies to the y-axis + % 3) Check that the inv method applies to both axes + % 4) Check that the re-built objects are the same as 'out1..3'. + % + % + + atest = true; + if stest + % + % Check each output against the inverse of the input + if ~isequal(inv(at4.data.getY), out.data.getY), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Control the method with a plist. + % + % + function result = utp_09 + + % + % + % Test that the inv method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = inv(at4); + out2 = inv(at4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y) ~= size(inv(at4.data.y)), atest = false; end + if size(out2.data.y) ~= size(inv(at4.data.y)), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the inv method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_10 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + at4_10 = at4+10; + [o1, o2] = inv(at4, at4_10); + o3 = inv(at4, at4_10); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_isprop.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_isprop.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,483 @@ +% UTP_AO_ISPROP a set of UTPs for the ao/isprop method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_isprop.m,v 1.8 2011/03/29 13:13:33 ingo Exp $ +% + +% +% +% The isprop method of the ao class determine whether input is object property. +% +% + +function results = utp_ao_isprop(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'isprop'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test negative case + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the isprop method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the isprop method works for a vector of AOs as input. + % + % + + try + % + out = isprop(atvec, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the isprop method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the isprop method works for a matrix of AOs as input. + % + % + + try + % + out = isprop(atmat, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the isprop method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the isprop method works for a list of AOs as input. + % + % + + try + % + out = isprop(at1,at2,at3, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the isprop method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the isprop method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = isprop(at1,atvec,at2,atmat,at3, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(atmat)+numel(atvec)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the isprop method properly applies history. + % + % + function result = utp_06 + + % + % + % The method isprop doesn't change the object, thus it is not necessary to + % apply history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the isprop method works for each property. + % + % + function result = utp_07 + + % + % + % Test that the isprop method works for the properties: + % 'data', 'mfile', 'mfilename', 'mdlfile', 'mdlfilename', 'procinfo', + % 'plotinfo', 'description', 'hist', 'name' + % + % + + try + % + % copy at1 to work with + out1 = isprop(at1, 'data'); + out3 = isprop(at1, 'hist'); + out4 = isprop(at1, 'procinfo'); + out5 = isprop(at1, 'plotinfo'); + out6 = isprop(at1, 'name'); + out7 = isprop(at1, 'description'); + out8 = isprop(at1, 'mdlfile'); + out9 = isprop(at1, 'UUID'); + out12 = isprop(at1, 'created'); + out13 = isprop(at1, 'creator'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if ~out1, atest = false; end; + if ~out3, atest = false; end; + if ~out4, atest = false; end; + if ~out5, atest = false; end; + if ~out6, atest = false; end; + if ~out7, atest = false; end; + if ~out8, atest = false; end; + if ~out9, atest = false; end; + if out12, atest = false; end; + if out13, atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the negatice case and the not function command. + % + % + function result = utp_08 + + % + % + % Test that the isprop method retrun false for a unknown property and for + % methods of the object. + % + % + + try + % + out1 = isprop(at1, 'foo'); + out2 = at1.isprop('foo'); + out3 = at1.isprop('name'); + out4 = at1.isprop('type'); + out5 = at1.isprop('psd'); + out6 = at1.isprop('created'); + out7 = at1.isprop('creator'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if out1, atest = false; end; + if out2, atest = false; end; + if ~out3, atest = false; end; + if out4, atest = false; end; + if out5, atest = false; end; + if out6, atest = false; end; + if out7, atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_join_fsdata.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_join_fsdata.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,602 @@ +% UTP_AO_JOIN a set of UTPs for the ao/join method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_join_fsdata.m,v 1.7 2010/07/05 08:11:03 mauro Exp $ +% + +% +% +% The join method of the ao class join multiple AOs into a single AO. This +% UTP join only analysis objects with fsdata. The other data objects will +% be tested in an other UTP. +% +% + +function results = utp_ao_join_fsdata(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'join'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + + a1 = ao(1:30, randn(30,1)+2*10, plist('type', 'fsdata')); + a2 = ao(1.1:30.1, randn(30,1)+2*10, plist('type', 'fsdata')); + results = [results utp_11(mthd, [a1 a2], ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 3, atest = false; end + % Check key + if ~io(3).plists.isparam('zerofill'), atest = false; end + if ~io(3).plists.isparam('sameT0'), atest = false; end + if ~io(3).plists.isparam('fstol'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('zerofill'), 'no'), atest = false; end + if ~isequal(io(3).plists.find('samet0'), 'no'), atest = false; end + if ~isequal(io(3).plists.find('fstol'), 1e-6), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('zerofill'), {'yes', 'no'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('samet0'), {'yes', 'no'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('fstol'), {1e-6}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the join method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the join method works for a vector of AOs as input. + % + % + + try + % + a1 = ao(1:30, randn(30,1)+2*10, plist('type', 'fsdata')); + a2 = ao(1.1:30.1, randn(30,1)+2*10, plist('type', 'fsdata')); + a3 = ao(1.2:30.2, randn(30,1)+2*10, plist('type', 'fsdata')); + avec = [a1, a2, a3]; + out = join(avec); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one AO. + % 2) Check that the output have the correct data. + % 3) Check the re-built object + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Compute reference data + x0 = []; + y0 = []; + for oo = 1:numel(avec) + if isempty(x0) + idxBefore = []; + idxAfter = 1:numel(avec(oo).y); + else + idxBefore = find(avec(oo).x < x0(1)); + idxAfter = find(avec(oo).x > x0(end)); + end + x0 = [avec(oo).x(idxBefore); x0; avec(oo).x(idxAfter)]; + y0 = [avec(oo).y(idxBefore); y0; avec(oo).y(idxAfter)]; + end + if ~isequal(out.x, x0), atest = false; end + if ~isequal(out.y, y0), atest = false; end + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the join method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Tests that the join method works with a matrix of AOs as input. + % + % + + try + % + a1 = ao(1.1:30.1, randn(30,1)+2*10, plist('type', 'fsdata')); + a2 = ao(1.2:30.2, randn(30,1)+2*10, plist('type', 'fsdata')); + a3 = ao(1.3:30.3, randn(30,1)+2*10, plist('type', 'fsdata')); + a4 = ao(1.4:30.4, randn(30,1)+2*10, plist('type', 'fsdata')); + a5 = ao(1.5:30.5, randn(30,1)+2*10, plist('type', 'fsdata')); + a6 = ao(1.6:30.6, randn(30,1)+2*10, plist('type', 'fsdata')); + amat = [a1, a2, a3; a4, a5, a6]; + out = join(amat); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one AO. + % 2) Check that the output have the correct data. + % 3) Check the re-built object + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Compute reference data + x0 = []; + y0 = []; + for oo = 1:numel(amat) + if isempty(x0) + idxBefore = []; + idxAfter = 1:numel(amat(oo).y); + else + idxBefore = find(amat(oo).x < x0(1)); + idxAfter = find(amat(oo).x > x0(end)); + end + x0 = [amat(oo).x(idxBefore); x0; amat(oo).x(idxAfter)]; + y0 = [amat(oo).y(idxBefore); y0; amat(oo).y(idxAfter)]; + end + if ~isequal(out.x, x0), atest = false; end + if ~isequal(out.y, y0), atest = false; end + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the join method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Tests that the join method works with a list of AOs as input. + % + % + + try + % + a1 = ao(1:30, randn(30,1)+2*10, plist('type', 'fsdata')); + a2 = ao(1.1:30.1, randn(30,1)+2*10, plist('type', 'fsdata')); + a3 = ao(1.2:30.2, randn(30,1)+2*10, plist('type', 'fsdata')); + out = join(a1, a2, a3); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one AO. + % 2) Check that the output have the correct data. + % 3) Check the re-built object + % + % + + atest = true; + aoin = [a1, a2, a3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Compute reference data + x0 = []; + y0 = []; + for oo = 1:numel(aoin) + if isempty(x0) + idxBefore = []; + idxAfter = 1:numel(aoin(oo).y); + else + idxBefore = find(aoin(oo).x < x0(1)); + idxAfter = find(aoin(oo).x > x0(end)); + end + x0 = [aoin(oo).x(idxBefore); x0; aoin(oo).x(idxAfter)]; + y0 = [aoin(oo).y(idxBefore); y0; aoin(oo).y(idxAfter)]; + end + if ~isequal(out.x, x0), atest = false; end + if ~isequal(out.y, y0), atest = false; end + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the join method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Tests that the join method works with a mix of different shaped AOs + % as input. + % + % + + try + % + a1 = ao(1.1:30.1, randn(30,1)+2*10, plist('type', 'fsdata')); + a2 = ao(1.2:30.2, randn(30,1)+2*10, plist('type', 'fsdata')); + a3 = ao(1.3:30.3, randn(30,1)+2*10, plist('type', 'fsdata')); + a4 = ao(1.4:30.4, randn(30,1)+2*10, plist('type', 'fsdata')); + out = join(a1, a2, [a3 a4]); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one AO. + % 2) Check that the output have the correct data. + % 3) Check the re-built object + % + % + + atest = true; + aoin = [a1, a2, a3, a4]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Compute reference data + x0 = []; + y0 = []; + for oo = 1:numel(aoin) + if isempty(x0) + idxBefore = []; + idxAfter = 1:numel(aoin(oo).y); + else + idxBefore = find(aoin(oo).x < x0(1)); + idxAfter = find(aoin(oo).x > x0(end)); + end + x0 = [aoin(oo).x(idxBefore); x0; aoin(oo).x(idxAfter)]; + y0 = [aoin(oo).y(idxBefore); y0; aoin(oo).y(idxAfter)]; + end + if ~isequal(out.x, x0), atest = false; end + if ~isequal(out.y, y0), atest = false; end + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the join method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the join method can be processed back. + % + % + + try + % + a1 = ao(1.1:30.1, randn(30,1)+2*10, plist('type', 'fsdata')); + a2 = ao(1.2:30.2, randn(30,1)+2*10, plist('type', 'fsdata')); + + out = join(a1, a2); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'join'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'join'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the join method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the join method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at1 to work with + a1 = ao(1.1:30.1, randn(30,1)+2*10, plist('type', 'fsdata')); + a2 = ao(1.2:30.2, randn(30,1)+2*10, plist('type', 'fsdata')); + a1.setT0('2009-02-12 14:00:00'); + a2.setT0('2009-02-12 14:00:25'); + + amodi = ao(a1); + aeq = ao(a1); + out = aeq.join(a2); + amodi.join(a2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'out' and 'aeq' are now different. + % 2) Check that 'aeq' is not changed + % 3) Check that the modified input is joined + % 4) Check that out and amodi are the same + % + % + + atest = true; + if stest + % + % Check that 'out' and 'aeq' are now different. + if eq(out, aeq, ple2), atest = false; end + % Check that 'aeq' is not changed + if ~eq(aeq, ao(a1), ple1), atest = false; end + % Check that the modified input is joined + aoin = [a1 a2]; + x0 = []; + y0 = []; + for oo = 1:numel(aoin) + if isempty(x0) + idxBefore = []; + idxAfter = 1:numel(aoin(oo).y); + else + idxBefore = find(aoin(oo).x < x0(1)); + idxAfter = find(aoin(oo).x > x0(end)); + end + x0 = [aoin(oo).x(idxBefore); x0; aoin(oo).x(idxAfter)]; + y0 = [aoin(oo).y(idxBefore); y0; aoin(oo).y(idxAfter)]; + end + if ~isequal(amodi.x, x0), atest = false; end + if ~isequal(amodi.y, y0), atest = false; end + % Check that out and amodi are the same + if ~eq(out, amodi, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the join method keeps the data shape of the input object. + % The input AO must be an AO with row data and an AO with column data. + % + % + + try + % + a1 = ao(1.1:30.1, randn(30,1)+2*10, plist('type', 'fsdata')); + a2 = ao(1.2:30.2, randn(1,30)+2*10, plist('type', 'fsdata')); + + out1 = join(a1, a2); + out2 = join(a2, a1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,1 ) == 1, atest = false; end + if size(out2.data.y,2 ) == 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_join_tsdata.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_join_tsdata.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,838 @@ +% UTP_AO_JOIN a set of UTPs for the ao/join method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_join_tsdata.m,v 1.12 2011/11/06 06:46:21 mauro Exp $ +% + +% +% +% The join method of the ao class join multiple AOs into a single AO. This +% UTP join only analysis objects with tsdata. The other data objects will +% be tested in an other UTP. +% +% + +function results = utp_ao_join_tsdata(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'join'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with additional plist with the key 'axis' + results = [results utp_09]; % Test input data shape == output data shape + results = [results utp_10]; % Test the x-values + + a1 = ao(0:29, randn(30,1), 1); + a2 = ao(0:29, randn(30,1), 1); + a1.setT0('2009-02-12 14:00:00'); + a2.setT0('2009-02-12 14:00:35'); + + results = [results utp_11(mthd, [a1 a2], ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 3, atest = false; end + % Check key + if ~io(3).plists.isparam('zerofill'), atest = false; end + if ~io(3).plists.isparam('sameT0'), atest = false; end + if ~io(3).plists.isparam('fstol'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('zerofill'), 'no'), atest = false; end + if ~isequal(io(3).plists.find('samet0'), 'no'), atest = false; end + if ~isequal(io(3).plists.find('fstol'), 1e-6), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('zerofill'), {'yes', 'no'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('samet0'), {'yes', 'no'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('fstol'), {1e-6}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the join method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the join method works for a vector of AOs as input. + % + % + + try + % + a1 = ao(0:29, randn(30,1), 1); + a2 = ao(0:29, randn(30,1), 1); + a3 = ao(0:29, randn(30,1), 1); + a1.setT0('2009-02-12 14:00:00'); + a2.setT0('2009-02-12 14:00:35'); + a3.setT0('2009-02-12 14:00:20'); + avec = [a1, a2, a3]; + out = join(avec); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one AO. + % 2) Check that the output have the correct data. + % 3) Check the re-built object + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Compute reference data + % Toff is the smallest t0. Here t0 of a1 -> '2009-02-12 14:00:00' + Toff = time('2009-02-12 14:00:00').double; + + % Vector of input aos is sorted based on the t0 value + t0s = avec.t0.double; + [~, idx] = sort(t0s); + + t0 = avec(idx(1)).t0.double - Toff; + x0 = avec(idx(1)).x + t0; + y0 = avec(idx(1)).data.getY; + for kk = 2:numel(avec) + t0 = avec(idx(kk)).t0.double - Toff; + x = avec(idx(kk)).x + t0; + y = avec(idx(kk)).y; + idxPost = find(x > max(x0)); + idxPre = find(x < min(x0)); + x0 = [x(idxPre); x0; x(idxPost)]; + y0 = [y(idxPre); y0; y(idxPost)]; + end + if ~isequal(out.x, x0), atest = false; end + if ~isequal(out.y, y0), atest = false; end + if ~isequal(out.t0.double, Toff), atest = false; end + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the join method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the join method works for a matrix of AOs as input. + % + % + + try + % + a1 = ao(0:29, randn(30,1), 1); + a2 = ao(0:29, randn(30,1), 1); + a3 = ao(0:29, randn(30,1), 1); + a4 = ao(0:29, randn(30,1), 1); + a5 = ao(0:29, randn(30,1), 1); + a6 = ao(0:29, randn(30,1), 1); + a1.setT0('2009-02-12 14:01:00'); + a2.setT0('2009-02-12 14:00:20'); + a3.setT0('2009-02-12 14:00:00'); + a4.setT0('2009-02-12 14:00:50'); + a5.setT0('2009-02-12 14:01:50'); + a6.setT0('2009-02-12 14:02:00'); + amat = [a1, a2, a3]; + out = join(amat); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one AO. + % 2) Check that the output have the correct data. + % 3) Check the re-built object + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Compute reference data + % Toff is the smallest t0. Here t0 of a1 -> '2009-02-12 14:00:00' + Toff = time('2009-02-12 14:00:00').double; + + % Matrix of input aos is sorted based on the t0 value + t0s = amat.t0.double; + [~, idx] = sort(t0s); + + t0 = amat(idx(1)).t0.double - Toff; + x0 = amat(idx(1)).x + t0; + y0 = amat(idx(1)).data.getY; + for kk = 2:numel(amat) + t0 = amat(idx(kk)).t0.double - Toff; + x = amat(idx(kk)).x + t0; + y = amat(idx(kk)).y; + idxPost = find(x > max(x0)); + idxPre = find(x < min(x0)); + x0 = [x(idxPre); x0; x(idxPost)]; + y0 = [y(idxPre); y0; y(idxPost)]; + end + if ~isequal(out.x, x0), atest = false; end + if ~isequal(out.y, y0), atest = false; end + if ~isequal(out.t0.double, Toff), atest = false; end + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the join method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Tests that the join method works with a list of AOs as input. + % + % + + try + % + a1 = ao(0:29, randn(30,1), 1); + a2 = ao(0:29, randn(30,1), 1); + a3 = ao(0:29, randn(30,1), 1); + a1.setT0('2009-02-12 14:01:00'); + a2.setT0('2009-02-12 14:00:30'); + a3.setT0('2009-02-12 14:00:00'); + out = join(a1, a2, a3); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one AO. + % 2) Check that the output have the correct data. + % 3) Check the re-built object + % + % + + atest = true; + aoin = [a1 a2 a3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Compute reference data + % Toff is the smallest t0. Here t0 of a1 -> '2009-02-12 14:00:00' + Toff = time('2009-02-12 14:00:00').double; + + % List of input aos is sorted based on the t0 value + t0s = aoin.t0.double; + [~, idx] = sort(t0s); + + t0 = aoin(idx(1)).t0.double - Toff; + x0 = aoin(idx(1)).x + t0; + y0 = aoin(idx(1)).data.getY; + for kk = 2:numel(aoin) + t0 = aoin(idx(kk)).t0.double - Toff; + x = aoin(idx(kk)).x + t0; + y = aoin(idx(kk)).y; + idxPost = find(x > max(x0)); + idxPre = find(x < min(x0)); + x0 = [x(idxPre); x0; x(idxPost)]; + y0 = [y(idxPre); y0; y(idxPost)]; + end + if ~isequal(out.x, x0), atest = false; end + if ~isequal(out.y, y0), atest = false; end + if ~isequal(out.t0.double, Toff), atest = false; end + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the join method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Tests that the join method works with a mix of different shaped AOs + % as input. + % + % + + try + % + a1 = ao(0:29, randn(30,1), 1); + a2 = ao(0:29, randn(30,1), 1); + a3 = ao(0:29, randn(30,1), 1); + a4 = ao(0:29, randn(30,1), 1); + a1.setT0('2009-02-12 14:01:00'); + a2.setT0('2009-02-12 14:00:20'); + a3.setT0('2009-02-12 14:00:00'); + a4.setT0('2009-02-12 14:00:50'); + out = join(a1, [a2 a3], a4); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one AO. + % 2) Check that the output have the correct data. + % 3) Check the re-built object + % + % + + atest = true; + aoin = [a1, a2, a3, a4]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Compute reference data + % Toff is the smallest t0. Here t0 of a1 -> '2009-02-12 14:00:00' + Toff = time('2009-02-12 14:00:00').double; + + % Matrix of input aos is sorted based on the t0 value + t0s = aoin.t0.double; + [~, idx] = sort(t0s); + + t0 = aoin(idx(1)).t0.double - Toff; + x0 = aoin(idx(1)).x + t0; + y0 = aoin(idx(1)).data.getY; + for kk = 2:numel(aoin) + t0 = aoin(idx(kk)).t0.double - Toff; + x = aoin(idx(kk)).x + t0; + y = aoin(idx(kk)).y; + idxPost = find(x > max(x0)); + idxPre = find(x < min(x0)); + x0 = [x(idxPre); x0; x(idxPost)]; + y0 = [y(idxPre); y0; y(idxPost)]; + end + if ~isequal(out.x, x0), atest = false; end + if ~isequal(out.y, y0), atest = false; end + if ~isequal(out.t0.double, Toff), atest = false; end + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the join method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the join method can be processed back. + % + % + + try + % + a1 = ao(0:29, randn(30,1), 1); + a2 = ao(0:29, randn(30,1), 1); + a1.setT0('2009-02-12 14:00:00'); + a2.setT0('2009-02-12 14:00:35'); + + out = join(a1, a2); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'join'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'join'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the join method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the join method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at1 to work with + a1 = ao(0:29, randn(30,1), 1); + a2 = ao(0:29, randn(30,1), 1); + a1.setT0('2009-02-12 14:00:00'); + a2.setT0('2009-02-12 14:00:25'); + + amodi = ao(a1); + aeq = ao(a1); + out = aeq.join(a2); + amodi.join(a2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'out' and 'aeq' are now different. + % 2) Check that 'aeq' is not changed + % 3) Check that the modified input is joined + % 4) Check that out and amodi are the same + % + % + + atest = true; + if stest + % + % Check that 'out' and 'aeq' are now different. + if eq(out, aeq, ple2), atest = false; end + % Check that 'aeq' is not changed + if ~eq(aeq, ao(a1), ple1), atest = false; end + % Check that the modified input is joined + Toff = time('2009-02-12 14:00:00').double; + + t0 = amodi.t0.double - Toff; + x0 = amodi.x + t0; + y0 = amodi.data.getY; + t0 = a2.t0.double - Toff; + x = a2.x + t0; + y = a2.y; + idxPost = find(x > max(x0)); + idxPre = find(x < min(x0)); + x0 = [x(idxPre); x0; x(idxPost)]; + y0 = [y(idxPre); y0; y(idxPost)]; + if ~isequal(amodi.x, x0), atest = false; end + if ~isequal(amodi.y, y0), atest = false; end + if ~isequal(amodi.t0.double, Toff), atest = false; end + % Check that out and amodi are the same + if ~eq(out, amodi, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test that the join method fills the gaps with zeros. + % + % + function result = utp_08 + + % + % + % Test that the join method fills the gaps with zeros. + % + % + + try + % + n = 29; + fs = 3; + x = 0:(1/fs):(n/fs)-1/fs; + a1 = ao(x, randn(n,1), fs); + a2 = ao(x, randn(n,1), fs); + a3 = ao(x, randn(n,1), fs); + a1.setT0('2009-02-12 14:00:00'); + a2.setT0('2009-02-12 14:00:35'); + a3.setT0('2009-02-12 14:01:15'); + pl = plist('zerofill', true); + + out1 = join(a1, a2, pl); + out2 = join(a1, a2, a3, pl); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the join method filled the gaps with zero + % 2) Check that the re-built objects are the same as out[1..2] + % + % + + atest = true; + TOL = 1e-13; + if stest + % + % Check 'out1' + Toff = time('2009-02-12 14:00:00').double; + t0 = a1.t0.double - Toff; + x0 = a1.x + t0; + y0 = a1.data.getY; + t0 = a2.t0.double - Toff; + x = a2.x + t0; + y = a2.y; + idxPost = find(x > max(x0)); + idxPre = find(x < min(x0)); + x0 = [x(idxPre); x0; x(idxPost)]; + y0 = [y(idxPre); y0; y(idxPost)]; + % Look for gaps + d = diff(x0); + gap = find(d >= 2*1/a1.fs); + xgap = linspace(x0(gap)+1/a1.fs, x0(gap+1)-1/a1.fs, (x0(gap+1)-x0(gap))*a1.fs-2*1/a1.fs).'; + ygap = zeros(length(xgap),1); + x0 = [x0(1:gap); xgap; x0(gap+1:end)]; + y0 = [y0(1:gap); ygap; y0(gap+1:end)]; + if any(abs(out1.x - x0) > TOL ), atest = false; end + if ~isequal(out1.y, y0), atest = false; end + + % Check 'out2' + Toff = time('2009-02-12 14:00:00').double; + t0 = a1.t0.double - Toff; + x0 = a1.x + t0; + y0 = a1.data.getY; + % Join a2 + t0 = a2.t0.double - Toff; + x = a2.x + t0; + y = a2.y; + idxPost = find(x > max(x0)); + idxPre = find(x < min(x0)); + x0 = [x(idxPre); x0; x(idxPost)]; + y0 = [y(idxPre); y0; y(idxPost)]; + % Look for gaps + d = diff(x0); + gap = find(d >= 2*1/a1.fs); + xgap = linspace(x0(gap)+1/a1.fs, x0(gap+1)-1/a1.fs, (x0(gap+1)-x0(gap))*a1.fs-2*1/a1.fs).'; + ygap = zeros(length(xgap),1); + x0 = [x0(1:gap); xgap; x0(gap+1:end)]; + y0 = [y0(1:gap); ygap; y0(gap+1:end)]; + % Join a3 + t0 = a3.t0.double - Toff; + x = a3.x + t0; + y = a3.y; + idxPost = find(x > max(x0)); + idxPre = find(x < min(x0)); + x0 = [x(idxPre); x0; x(idxPost)]; + y0 = [y(idxPre); y0; y(idxPost)]; + % Look for gaps + d = diff(x0); + gap = find(d >= 2*1/a1.fs); + xgap = linspace(x0(gap)+1/a1.fs, x0(gap+1)-1/a1.fs, (x0(gap+1)-x0(gap))*a1.fs-2*1/a1.fs).'; + ygap = zeros(length(xgap),1); + x0 = [x0(1:gap); xgap; x0(gap+1:end)]; + y0 = [y0(1:gap); ygap; y0(gap+1:end)]; + if any(abs(out2.x - x0) > TOL ), atest = false; end + if ~isequal(out2.y, y0), atest = false; end + + % Check out[1..2] + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test the shape of the output. + % + % + function result = utp_09 + + % + % + % Test that the join method keeps the data shape of the input object. + % The input AO must be an AO with row data and an AO with column data. + % + % + + try + % + a1 = ao([0:29 30:49], randn(50,1), 1); + a2 = ao([20:49 50:69], randn(1,50), 1); + a1.setT0('2009-02-12 14:00:00'); + a2.setT0('2009-02-12 14:00:00'); + + out1 = join(a1, a2); + out2 = join(a2, a1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y, 1) == 1, atest = false; end + if size(out2.data.y, 2) == 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Test the x-values. + % + % + function result = utp_10 + + % + % + % Test the x-values. + % + % + + try + % + a1 = ao(1:20, randn(20,1), plist('type', 'tsdata')); + a2 = ao(11:30, randn(20,1), plist('type', 'tsdata')); + a3 = ao(41:50, randn(10,1), plist('type', 'tsdata')); + + out1 = join(a1, a2, a3, plist('zerofill', 'no')); + out2 = join(a1, a2, a3, plist('zerofill', 'yes')); + out3 = join(a2, a1, a3, plist('zerofill', 'no')); + out4 = join(a2, a1, a3, plist('zerofill', 'yes')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the x-values for the case where we 'zerofill' or not. + % 2) Compare the outputs to see that switching the order did not matter, + % because if the different t0 of the data, that get sorted anyways. + % + % + + atest = true; + if stest + % + % Check the x-getter of the AO + if ~isequal(out1.x, [1:30, 41:50]'), atest = false; end + if ~isequal(out2.x, [1:50]'), atest = false; end + if ~isequal(out3.x, [1:30, 41:50]'), atest = false; end + if ~isequal(out4.x, [1:50]'), atest = false; end + % Check the real stored x values + if ~isequal(out1.data.x, [0:29, 40:49]') || ~isequal(out1.data.toffset, 1000), atest = false; end + if ~isempty(out2.data.x), atest = false; end + if ~isequal(out3.data.x, [0:29, 40:49]') || ~isequal(out3.data.toffset, 1000), atest = false; end + if ~isempty(out4.data.x), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_kstest.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_kstest.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,666 @@ +% UTP_AO_KSTEST a set of UTPs for the ao/kstest method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_kstest.m,v 1.2 2011/07/14 07:11:00 mauro Exp $ +% + +% +% +% The ifft method of the ao class computes the inverse fast fourier +% transform of time-series AOs. +% +% + +function results = utp_ao_kstest(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'kstest'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call does not work + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'empirical')), atest = false; end + if ~any(strcmpi(io(2).sets, 'normal')), atest = false; end + if ~any(strcmpi(io(2).sets, 'chi2')), atest = false; end + if ~any(strcmpi(io(2).sets, 'f')), atest = false; end + if ~any(strcmpi(io(2).sets, 'gamma')), atest = false; end + + %%%%%%%%%% SET 'empirical' + pn = 3; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('TESTDISTRIBUTION'), atest = false; end + if ~io(pn).plists.isparam('ALPHA'), atest = false; end + if ~io(pn).plists.isparam('SHAPEPARAM'), atest = false; end + if ~io(pn).plists.isparam('CRITICALVALUE'), atest = false; end + + % Check default value + if ~isequal(io(pn).plists.find('TESTDISTRIBUTION'), 'EMPIRICAL'), atest = false; end + if ~isequal(io(pn).plists.find('ALPHA'), 0.05), atest = false; end + if ~isequal(io(pn).plists.find('SHAPEPARAM'), 1), atest = false; end + if ~isequal(io(pn).plists.find('CRITICALVALUE'), []), atest = false; end + + + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('TESTDISTRIBUTION'),... + {'EMPIRICAL','NORMAL','CHI2','F','GAMMA'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('ALPHA'), {0.05}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('SHAPEPARAM'), {1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('CRITICALVALUE'), {[]}), atest = false; end + + %%%%%%%%%% SET 'normal' + pn = 4; + if io(pn).plists.nparams ~= 6, atest = false; end + % Check key + if ~io(pn).plists.isparam('TESTDISTRIBUTION'), atest = false; end + if ~io(pn).plists.isparam('ALPHA'), atest = false; end + if ~io(pn).plists.isparam('SHAPEPARAM'), atest = false; end + if ~io(pn).plists.isparam('CRITICALVALUE'), atest = false; end + if ~io(pn).plists.isparam('MEAN'), atest = false; end + if ~io(pn).plists.isparam('STD'), atest = false; end + + % Check default value + if ~isequal(io(pn).plists.find('TESTDISTRIBUTION'), 'EMPIRICAL'), atest = false; end + if ~isequal(io(pn).plists.find('ALPHA'), 0.05), atest = false; end + if ~isequal(io(pn).plists.find('SHAPEPARAM'), 1), atest = false; end + if ~isequal(io(pn).plists.find('CRITICALVALUE'), []), atest = false; end + if ~isequal(io(pn).plists.find('MEAN'), 0), atest = false; end + if ~isequal(io(pn).plists.find('STD'), 1), atest = false; end + + + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('TESTDISTRIBUTION'),... + {'EMPIRICAL','NORMAL','CHI2','F','GAMMA'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('ALPHA'), {0.05}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('SHAPEPARAM'), {1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('CRITICALVALUE'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('MEAN'), {0}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('STD'), {1}), atest = false; end + + %%%%%%%%%% SET 'chi2' + pn = 5; + if io(pn).plists.nparams ~= 5, atest = false; end + % Check key + if ~io(pn).plists.isparam('TESTDISTRIBUTION'), atest = false; end + if ~io(pn).plists.isparam('ALPHA'), atest = false; end + if ~io(pn).plists.isparam('SHAPEPARAM'), atest = false; end + if ~io(pn).plists.isparam('CRITICALVALUE'), atest = false; end + if ~io(pn).plists.isparam('DOF'), atest = false; end + + % Check default value + if ~isequal(io(pn).plists.find('TESTDISTRIBUTION'), 'EMPIRICAL'), atest = false; end + if ~isequal(io(pn).plists.find('ALPHA'), 0.05), atest = false; end + if ~isequal(io(pn).plists.find('SHAPEPARAM'), 1), atest = false; end + if ~isequal(io(pn).plists.find('CRITICALVALUE'), []), atest = false; end + if ~isequal(io(pn).plists.find('DOF'), 2), atest = false; end + + + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('TESTDISTRIBUTION'),... + {'EMPIRICAL','NORMAL','CHI2','F','GAMMA'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('ALPHA'), {0.05}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('SHAPEPARAM'), {1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('CRITICALVALUE'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('DOF'), {2}), atest = false; end + + %%%%%%%%%% SET 'f' + pn = 6; + if io(pn).plists.nparams ~= 6, atest = false; end + % Check key + if ~io(pn).plists.isparam('TESTDISTRIBUTION'), atest = false; end + if ~io(pn).plists.isparam('ALPHA'), atest = false; end + if ~io(pn).plists.isparam('SHAPEPARAM'), atest = false; end + if ~io(pn).plists.isparam('CRITICALVALUE'), atest = false; end + if ~io(pn).plists.isparam('DOF1'), atest = false; end + if ~io(pn).plists.isparam('DOF2'), atest = false; end + + % Check default value + if ~isequal(io(pn).plists.find('TESTDISTRIBUTION'), 'EMPIRICAL'), atest = false; end + if ~isequal(io(pn).plists.find('ALPHA'), 0.05), atest = false; end + if ~isequal(io(pn).plists.find('SHAPEPARAM'), 1), atest = false; end + if ~isequal(io(pn).plists.find('CRITICALVALUE'), []), atest = false; end + if ~isequal(io(pn).plists.find('DOF1'), 2), atest = false; end + if ~isequal(io(pn).plists.find('DOF2'), 2), atest = false; end + + + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('TESTDISTRIBUTION'),... + {'EMPIRICAL','NORMAL','CHI2','F','GAMMA'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('ALPHA'), {0.05}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('SHAPEPARAM'), {1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('CRITICALVALUE'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('DOF1'), {2}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('DOF2'), {2}), atest = false; end + + %%%%%%%%%% SET 'gamma' + pn = 7; + if io(pn).plists.nparams ~= 6, atest = false; end + % Check key + if ~io(pn).plists.isparam('TESTDISTRIBUTION'), atest = false; end + if ~io(pn).plists.isparam('ALPHA'), atest = false; end + if ~io(pn).plists.isparam('SHAPEPARAM'), atest = false; end + if ~io(pn).plists.isparam('CRITICALVALUE'), atest = false; end + if ~io(pn).plists.isparam('SHAPE'), atest = false; end + if ~io(pn).plists.isparam('SCALE'), atest = false; end + + % Check default value + if ~isequal(io(pn).plists.find('TESTDISTRIBUTION'), 'EMPIRICAL'), atest = false; end + if ~isequal(io(pn).plists.find('ALPHA'), 0.05), atest = false; end + if ~isequal(io(pn).plists.find('SHAPEPARAM'), 1), atest = false; end + if ~isequal(io(pn).plists.find('CRITICALVALUE'), []), atest = false; end + if ~isequal(io(pn).plists.find('SHAPE'), 2), atest = false; end + if ~isequal(io(pn).plists.find('SCALE'), 2), atest = false; end + + + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('TESTDISTRIBUTION'),... + {'EMPIRICAL','NORMAL','CHI2','F','GAMMA'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('ALPHA'), {0.05}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('SHAPEPARAM'), {1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('CRITICALVALUE'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('SHAPE'), {2}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('SCALE'), {2}), atest = false; end + + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the kstest method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the kstest method works for a vector of AOs as input. + % + % + + try + % + avec = [at5 at5]; + out1 = kstest(avec); + out2 = kstest(avec, plist('testdistribution', 'normal')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' is one less of the input. + % 2) Check that the number of elements in 'out2' is the same of the + % number in the input. + % 3) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= numel(avec) - 1, atest = false; end + if numel(out2) ~= numel(avec), atest = false; end + % Check each output: class + for kk = 1:numel(out1) + if ~isa(out1(kk).data, 'cdata'), atest = false; end + end + for kk = 1:numel(out2) + if ~isa(out2(kk).data, 'cdata'), atest = false; end + end + % Check each output: content + for kk = 1:numel(out1) + if ~isequal(out1(kk).data.y, false), atest = false; end + end + for kk = 1:numel(out2) + if ~isequal(out2(kk).data.y, false), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the kstest method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the kstest method works for a matrix of AOs as input. + % + % + + try + % + amat = [at5 at5 at5; at5 at5 at5]; + out1 = kstest(amat); + out2 = kstest(amat, plist('testdistribution', 'normal')); + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' is one less of the input. + % 2) Check that the number of elements in 'out2' is the same of the + % number in the input. + % 3) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= numel(amat)-1, atest = false; end + if numel(out2) ~= numel(amat), atest = false; end + % Check each output: class + for kk = 1:numel(out1) + if ~isa(out1(kk).data, 'cdata'), atest = false; end + end + for kk = 1:numel(out2) + if ~isa(out2(kk).data, 'cdata'), atest = false; end + end + % Check each output: content + for kk = 1:numel(out1) + if ~isequal(out1(kk).data.y, false), atest = false; end + end + for kk = 1:numel(out2) + if ~isequal(out2(kk).data.y, false), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the kstest method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the kstest method works for a list of AOs as input. + % + % + + try + % + out1 = kstest(at5, at5, at5); + out2 = kstest(at5, at5, at5, plist('testdistribution', 'normal')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' is one less of the input. + % 2) Check that the number of elements in 'out2' is the same of the + % number in the input. + % 3) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 2, atest = false; end + if numel(out2) ~= 3, atest = false; end + % Check each output: class + for kk = 1:numel(out1) + if ~isa(out1(kk).data, 'cdata'), atest = false; end + end + for kk = 1:numel(out2) + if ~isa(out2(kk).data, 'cdata'), atest = false; end + end + % Check each output: content + for kk = 1:numel(out1) + if ~isequal(out1(kk).data.y, false), atest = false; end + end + for kk = 1:numel(out2) + if ~isequal(out2(kk).data.y, false), atest = false; end + end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the kstest method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the kstest method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out1 = kstest(at5,[at6 at6],at5,[at5 at5; at5 at5],at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; +% aoin = [at1, reshape([at1 at1], 1, []), at1, reshape([at1 at1; at1 at1], 1, []), at1]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 8, atest = false; end + % Check each output + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the kstest method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the kstest method can be processed back + % to an m-file. + % + % + + try + % + out1 = kstest(at5, at6); + mout1 = rebuild(out1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'kstest'. + % 2) % Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'kstest'), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the kstest method cannot modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the kstest method cannot modify the input AO by calling with no + % output. + % + % + + try + % + % copy at2 to work with + ain1 = ao(at5); + ain2 = ao(at6); + ainv = [ain1 ain2]; + % modify ain + out1 = kstest(ainv); + ainv.kstest(); + % + stest = false; + catch err + disp(err.message) + stest = true; + end + + % + % + % + % + + atest = true; + + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + + %% UTP_09 + + % + % + % Check that the kstest method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o11, o12] = kstest(at5, at6, at6); + no1 = kstest(at5, at6, at6); + mout11 = rebuild(o11); + mout12 = rebuild(o12); + moutn1 = rebuild(no1); + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o11) ~=1, atest = false; end + if numel(o12) ~=1, atest = false; end + if numel(no1) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o11, mout11, ple2), atest = false; end + if ~eq(o12, mout12, ple2), atest = false; end + if ~eq(no1, moutn1, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_lcohere.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_lcohere.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,1434 @@ +% UTP_AO_LCOHERE a set of UTPs for the ao/lcohere method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_lcohere.m,v 1.26 2011/07/22 12:29:58 mauro Exp $ +% + +% +% +% The lcohere method of the ao class computes the lcoherence between two +% time-series AOs on a log frequency axis. +% +% + +function results = utp_ao_lcohere(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'lcohere'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Get default window from the preferences + prefs = getappdata(0, 'LTPDApreferences'); + defaultWinType = char(prefs.getMiscPrefs.getDefaultWindow); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input (only with two objects) + results = [results utp_03]; % Matrix input (not possible) + results = [results utp_04]; % List input (only with two objects) + results = [results utp_05]; % Test with mixed input (not possible) + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + + results = [results utp_11(mthd, [at1 at1], ple1)]; % Test plotinfo doesn't disappear + + results = [results utp_12]; % Test basic symmetry properties of lcohere (C) + results = [results utp_13]; % Test basic symmetry properties of lcohere (MS) + results = [results utp_14]; % Test basic symmetry properties of lcohere (C) + results = [results utp_15]; % Test basic symmetry properties of lcohere (MS) + results = [results utp_16]; % Test basic relationship (MS) <-> (C) + results = [results utp_17]; % Test units handling: complex cohere + results = [results utp_18]; % Test units handling: magnitude-squared cohere + results = [results utp_30]; % Special cases: same input + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 10, atest = false; end + % Check key + if ~io(3).plists.isparam('kdes'), atest = false; end + if ~io(3).plists.isparam('jdes'), atest = false; end + if ~io(3).plists.isparam('lmin'), atest = false; end + if ~io(3).plists.isparam('win'), atest = false; end + if ~io(3).plists.isparam('olap'), atest = false; end + if ~io(3).plists.isparam('type'), atest = false; end + if ~io(3).plists.isparam('order'), atest = false; end + if ~io(3).plists.isparam('psll'), atest = false; end + if ~io(3).plists.isparam('times'), atest = false; end + if ~io(3).plists.isparam('split'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('kdes'), 100), atest = false; end + if ~isequal(io(3).plists.find('jdes'), 1000), atest = false; end + if ~isequal(io(3).plists.find('lmin'), 0), atest = false; end + if ~strcmpi(io(3).plists.find('win'), defaultWinType), atest = false; end + if ~isequal(io(3).plists.find('olap'), -1), atest = false; end + if ~isequal(io(3).plists.find('type'), 'C'), atest = false; end + if ~isequal(io(3).plists.find('order'), 0), atest = false; end + if ~isequal(io(3).plists.find('psll'), 200), atest = false; end + if ~isEmptyDouble(io(3).plists.find('times')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('split')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('kdes'), {100}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('jdes'), {1000}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('lmin'), {0}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('win'), specwin.getTypes), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('olap'), {-1}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('type'), {'C', 'MS'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('order'), {-1 0 1 2 3 4 5 6 7 8 9}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('psll'), {200}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('times'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('split'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the lcohere method works with a vector of AOs as input. (only + % with two objects in the vector) + % + % + function result = utp_02 + + % + % + % Test that the lcohere method works for a vector of AOs as input. + % + % + + try + % + avec = [at1 at5]; + out = lcohere(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is equal to 1. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Test that the lcohere method doesn't work for a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the lcohere method doesn't work for a matrix of AOs as input. + % + % + + try + % + amat = [at1 at5; at5 at6]; + out = lcohere(amat); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the lcohere method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the lcohere method works for a list of AOs as input. + % + % + + try + % + out = lcohere(at1,at5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is equal to 1. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the lcohere method doesn't work with a mix of different + % shaped AOs as input. + % + % + function result = utp_05 + + % + % + % Test that the lcohere method doesn't work with an input of matrices + % and vectors and single AOs. + % + % + + try + % + out = lcohere(at1,[at5 at6],at5,[at5 at1; at6 at1],at6); + stest = false; + % + catch err + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the lcohere method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the lcohere method can be processed back + % to an m-file. + % + % + + try + % + out = lcohere(at5,at6); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'lcohere'. + % 2) Check that the re-built object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'lcohere'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the lcohere method can not modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the lcohere method can not modify the input AO. + % The method must throw an error for the modifier call. + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + ain.lcohere(at5); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the lcohere method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = lcohere(at5, at6); + out2 = lcohere(at6, at5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the output data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y, 2) ~= 1, atest = false; end + if size(out2.data.y, 1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the lcohere method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % This test is not longer necessary because the cohere method pass back + % always only one object. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_12 + + % + % + % Tests symmetry properties of complex-coherence: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) complex lcoherence of the white noise series + % 4) compare C(x,y) with conj(C(y,x)) + % 5) compare C(x,x) and C(y,y) with 1 + % + + % + function result = utp_12 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) complex log-scale coherence of the white noise + % + % + + % + try + + % Array of parameters to pick from + fs_list = [0.1;1;10]; + nsecs_list = [100:100:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + mu_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + mu_distr = utils.math.randelement(mu_distr_list, 1); + f = [1:5] / 100 * fs; + A = sigma_distr + sigma_distr*rand(1,1); + phi = 0 + 2*pi*rand(1,1); + + % White noise + type = 'Normal'; + a_n1 = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_n2 = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_const = ao(mu_distr); + a_wave = ao(plist('waveform', 'sine-wave', ... + 'fs', fs, 'nsecs', nsecs, 'f', f, 'A', A, 'phi', phi)); + a_1 = a_n1 + a_const + a_wave; + a_2 = a_n2 + a_wave; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the complex coherence of the time-series data + win_list = specwin.getTypes; + win = utils.math.randelement(win_list,1); + win = win{1}; + if strcmp(win, 'Kaiser') + win = specwin(win, 1, find(ao.getInfo('psd').plists, 'psll')); + else + win = specwin(win, 1); + end + olap = win.rov; + detrend = 0; + scale_type = 'C'; + + C12 = lcohere(a_1, a_2, ... + plist('Win', win.type, 'olap', olap, 'order', detrend, 'type', scale_type)); + C21 = lcohere(a_2, a_1, ... + plist('Win', win.type, 'olap', olap, 'order', detrend, 'type', scale_type)); + C21_cc = conj(C21); + C11 = lcohere(a_1, a_1, ... + plist('Win', win.type, 'olap', olap, 'order', detrend, 'type', scale_type)); + C22 = lcohere(a_2, a_2, ... + plist('Win', win.type, 'olap', olap, 'order', detrend, 'type', scale_type)); + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that C(x,y) equals conj(C(y,x)) + % 2) Check that C(x,x) equals 1 + % 2) Check that C(y,y) equals 1 + + % + + % + atest = true; + tol = 1e-12; + + if stest + if ~eq(C12.data, C21_cc.data, 'dy') || ... + any(abs(C11.y-ones(size(C11.y))) > tol) || ... + any(abs(C22.y-ones(size(C22.y))) > tol) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Tests symmetry properties of complex-coherence: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) magnitude-squared log-scale coherence of the white noise series + % 4) compare C(x,y) with C(y,x) + % 5) compare C(x,x) and C(y,y) with 1 + % + + % + function result = utp_13 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) magnitude-squared log-scale coherence of the white noise + % + % + + % + try + + % Array of parameters to pick from + fs_list = [0.1;1;10]; + nsecs_list = [100:100:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + mu_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + mu_distr = utils.math.randelement(mu_distr_list, 1); + f = [1:5] / 100 * fs; + A = sigma_distr + sigma_distr*rand(1,1); + phi = 0 + 2*pi*rand(1,1); + + % White noise + type = 'Normal'; + a_n1 = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_n2 = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_const = ao(mu_distr); + a_wave = ao(plist('waveform', 'sine-wave', ... + 'fs', fs, 'nsecs', nsecs, 'f', f, 'A', A, 'phi', phi)); + a_1 = a_n1 + a_const + a_wave; + a_2 = a_n2 + a_wave; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the magnitude-squared coherence of the time-series data + win_list = specwin.getTypes; + win_type = utils.math.randelement(win_list(~strcmpi(win_list, 'levelledhanning')), 1); + win_type = win_type{1}; + if strcmp(win_type, 'Kaiser') + win = specwin(win_type, 1, find(ao.getInfo('psd').plists, 'psll')); + else + win = specwin(win_type, 1); + end + olap = win.rov; + detrend = 0; + scale_type = 'MS'; + + C12 = lcohere(a_1, a_2, ... + plist('Win', win.type, 'olap', olap, 'order', detrend, 'type', scale_type)); + C21 = lcohere(a_2, a_1, ... + plist('Win', win.type, 'olap', olap, 'order', detrend, 'type', scale_type)); + C11 = lcohere(a_1, a_1, ... + plist('Win', win.type, 'olap', olap, 'order', detrend, 'type', scale_type)); + C22 = lcohere(a_2, a_2, ... + plist('Win', win.type, 'olap', olap, 'order', detrend, 'type', scale_type)); + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that C(x,y) equals C(y,x) + % 1) Check that C(x,x) equals 1 + % 1) Check that C(y,y) equals 1 + + % + + % + atest = true; + tol = 1e-12; + + if stest + if ~eq(C12.data, C21.data) || ... + any(abs(C11.y - ones(size(C11.y))) > tol) || ... + any(abs(C22.y - ones(size(C22.y))) > tol) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + %% UTP_14 + + % + % + % Tests symmetry properties of complex-coherence: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) complex log-scale coherence of the combination of white noise series + % 4) compare C(x,y) with 1 + % + + % + function result = utp_14 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) complex log-scale coherence of the combination of noise + % + % + + % + try + + % Array of parameters to pick from + fs_list = [0.1;1;10]; + nsecs_list = [100:100:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + mu_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + mu_distr = utils.math.randelement(mu_distr_list, 1); + f = [1:5] / 100 * fs; + A = sigma_distr + sigma_distr*rand(1,1); + phi = 0 + 2*pi*rand(1,1); + + % White noise + type = 'Normal'; + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_const = ao(mu_distr); + % Sinusoidal signal + a_wave = ao(plist('waveform', 'sine-wave', ... + 'fs', fs, 'nsecs', nsecs, 'f', f, 'A', A, 'phi', phi)); + a_1 = a_n + a_wave; + % Linear combination (totally correlated time series) + a_2 = a_1 + a_const; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the complex coherence of the time-series data + win_list = specwin.getTypes; + win_type = utils.math.randelement(win_list(~strcmpi(win_list, 'levelledhanning')), 1); + win_type = win_type{1}; + if strcmp(win_type, 'Kaiser') + win = specwin(win_type, 1, find(ao.getInfo('psd').plists, 'psll')); + else + win = specwin(win_type, 1); + end + olap = win.rov; + detrend = 0; + scale_type = 'C'; + + C = lcohere(a_1, a_2, ... + plist('Win', win.type, 'olap', olap, 'order', detrend, 'type', scale_type)); + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the complex coherence equals 1 + + % + + % + atest = true; + TOL = 1e-12; + + if stest + if any(abs((C.y - 1)) > TOL) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_14 + + %% UTP_15 + + % + % + % Tests symmetry properties of complex-coherence: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) magnitude-squared log-scale coherence of the combination of white noise series + % 4) compare C(x,y) with 1 + % + + % + function result = utp_15 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) magnitude-squared log-scale coherence of the combination of noise + % + % + + % + try + + % Array of parameters to pick from + fs_list = [0.1;1;10]; + nsecs_list = [100:100:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + mu_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + mu_distr = utils.math.randelement(mu_distr_list, 1); + f = [1:5] / 100 * fs; + A = sigma_distr + sigma_distr*rand(1,1); + phi = 0 + 2*pi*rand(1,1); + + % White noise + type = 'Normal'; + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_const = ao(mu_distr); + % Sinusoidal signal + a_wave = ao(plist('waveform', 'sine-wave', ... + 'fs', fs, 'nsecs', nsecs, 'f', f, 'A', A, 'phi', phi)); + a_1 = a_n + a_wave; + % Linear combination (totally correlated time series) + a_2 = a_1 + a_const; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the complex coherence of the time-series data + win_list = specwin.getTypes; + win_type = utils.math.randelement(win_list(~strcmpi(win_list, 'levelledhanning')), 1); + win_type = win_type{1}; + if strcmp(win_type, 'Kaiser') + win = specwin(win_type, 1, find(ao.getInfo('psd').plists, 'psll')); + else + win = specwin(win_type, 1); + end + olap = win.rov; + detrend = 0; + scale_type = 'MS'; + + C = lcohere(a_1, a_2, ... + plist('Win', win.type, 'olap', olap, 'order', detrend, 'type', scale_type)); + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the magnitude-squared coherence equals 1 + + % + + % + atest = true; + + if stest + if ~eq(C.y, ones(size(C.y))) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_15 + + %% UTP_16 + + % + % + % Tests symmetry properties of complex-coherence: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) magnitude-squared log-scale coherence M of the combination of white noise series + % 4) complex log-scale coherence C of the combination of white noise series + % 5) compare abs(C)^2 with M + % + + % + function result = utp_16 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) magnitude-squared log-scale coherence of the combination of noise + % 6) complex log-scale coherence of the combination of noise + % + % + + % + try + + % Array of parameters to pick from + fs_list = [0.1;1;10]; + nsecs_list = [100:100:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + mu_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + mu_distr = utils.math.randelement(mu_distr_list, 1); + f = [1:5] / 100 * fs; + A = sigma_distr + sigma_distr*rand(1,1); + phi = 0 + 2*pi*rand(1,1); + + % White noise + type = 'Normal'; + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_const = ao(mu_distr); + % Sinusoidal signal + a_wave = ao(plist('waveform', 'sine-wave', ... + 'fs', fs, 'nsecs', nsecs, 'f', f, 'A', A, 'phi', phi)); + a_1 = a_n + a_wave; + % Linear combination (totally correlated time series) + a_2 = a_1 + a_const; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the complex coherence of the time-series data + win_list = specwin.getTypes; + win_type = utils.math.randelement(win_list(~strcmpi(win_list, 'levelledhanning')), 1); + win_type = win_type{1}; + if strcmp(win_type, 'Kaiser') + win = specwin(win_type, 1, find(ao.getInfo('psd').plists, 'psll')); + else + win = specwin(win_type, 1); + end + olap = win.rov; + detrend = 0; + + M = lcohere(a_1, a_2, ... + plist('Win', win.type, 'olap', olap, 'order', detrend, 'type', 'MS')); + C = lcohere(a_1, a_2, ... + plist('Win', win.type, 'olap', olap, 'order', detrend, 'type', 'C')); + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the magnitude-squared coherence equals the square + % modulus of the complex coherence + + % + + % + atest = true; + TOL = 1e-15; + + if stest + if any(abs(M.y - abs(C.y).^2) > TOL) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_16 + + %% UTP_17 + + % + % + % Tests handling of units: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) complex log-scale coherence of the white noise series + % 4) compares the units of the input and output + % + + % + function result = utp_17 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) complex cohere of the white noise + % + % + + % + try + + % Build time-series test data + fs = 1; + nsecs = 86400; + sigma_distr_1 = 4.69e-12; + mu_distr_1 = -5.11e-14; + sigma_distr_2 = 6.04e-9; + mu_distr_2 = 1.5e-10; + + % White noise + type = 'Normal'; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_1)); + a_const = ao(mu_distr_1); + a_1 = a_n + a_const; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_2)); + a_const = ao(mu_distr_2); + a_2 = a_n + a_const; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the log-scale coherence of the time-series data + win = specwin('BH92'); + olap = win.rov; + detrend = 0; + scale_type = 'C'; + + C = lcohere(a_1, a_2, plist('Win', win.type, 'olap', olap, 'order', detrend, 'type', scale_type)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (complex coherence yunits) equals [1] + % 2) Check that (complex coherence xunits) equals [Hz] + + % + + % + atest = true; + + if stest + if ne(C.yunits, unit('')) || ne(C.xunits, unit('Hz')) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_17 + + %% UTP_18 + + % + % + % Tests handling of units: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) magnitude-squared log-scale coherence of the white noise series + % 4) compares the units of the input and output + % + + % + function result = utp_18 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) magnitude-squared cohere of the white noise + % + % + + % + try + + % Build time-series test data + fs = 1; + nsecs = 86400; + sigma_distr_1 = 4.69e-12; + mu_distr_1 = -5.11e-14; + sigma_distr_2 = 6.04e-9; + mu_distr_2 = 1.5e-10; + + % White noise + type = 'Normal'; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_1)); + a_const = ao(mu_distr_1); + a_1 = a_n + a_const; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_2)); + a_const = ao(mu_distr_2); + a_2 = a_n + a_const; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the log-scale coherence of the time-series data + win = specwin('BH92'); + olap = win.rov; + detrend = 0; + scale_type = 'MS'; + + C = lcohere(a_1, a_2, plist('Win', win.type, 'olap', olap, 'order', detrend, 'type', scale_type)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (magnitude-squared coherence yunits) equals [1] + % 2) Check that (magnitude-squared coherence xunits) equals [Hz] + + % + + % + atest = true; + + if stest + if ne(C.yunits, unit('')) || ne(C.xunits, unit('Hz')) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_18 + + %% UTP_30 + + % + % + % Tests handling of special cases: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) the same noise series + % 3) lcohere of the white noise series + % 4) compares the output to unity + % + + % + function result = utp_30 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % the same data as 1) and 2) + % 4) lcohere of the series + % + % + + % + try + + % Build time-series test data + fs = 1; + nsecs = 86400; + sigma_distr_1 = 4.69e-12; + mu_distr_1 = -5.11e-14; + + % White noise + type = 'Normal'; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_1)); + a_const = ao(mu_distr_1); + a_1 = a_n + a_const; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Build the second object as a copy of the first + a_2 = a_1; + + % Evaluate the lcohere of the time-series data + win = specwin('BH92'); + olap = win.rov; + detrend = 0; + scale_type = 'C'; + + C = lcohere(a_1, a_2, ... + plist('Win', win.type, 'order', detrend, 'type', scale_type, 'olap', olap)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated lcohere equals 1 + + % + + % + atest = true; + + if stest + if sum(ne(C.y, 1)) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_30 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_lcpsd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_lcpsd.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,842 @@ +% UTP_AO_LCPSD a set of UTPs for the ao/lcpsd method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_lcpsd.m,v 1.29 2011/07/22 11:51:46 mauro Exp $ +% + +% +% +% The lcpsd method of the ao class computes the cross-spectral density between two +% time-series AOs on a log-frequency axis. +% +% + +function results = utp_ao_lcpsd(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'lcpsd'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Get default window from the preferences + prefs = getappdata(0, 'LTPDApreferences'); + defaultWinType = char(prefs.getMiscPrefs.getDefaultWindow); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input (only with two objects) + results = [results utp_03]; % Matrix input (not possible) + results = [results utp_04]; % List input (only with two objects) + results = [results utp_05]; % Test with mixed input (not possible) + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_11(mthd, [at1 at1], ple1)]; % Test plotinfo doesn't disappear + results = [results utp_12]; % Test data lengths + results = [results utp_17]; % Test units handling: LCPSD + results = [results utp_18]; % Comparison with PSD + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 9, atest = false; end + % Check key + if ~io(3).plists.isparam('kdes'), atest = false; end + if ~io(3).plists.isparam('jdes'), atest = false; end + if ~io(3).plists.isparam('lmin'), atest = false; end + if ~io(3).plists.isparam('win'), atest = false; end + if ~io(3).plists.isparam('olap'), atest = false; end + if ~io(3).plists.isparam('order'), atest = false; end + if ~io(3).plists.isparam('psll'), atest = false; end + if ~io(3).plists.isparam('times'), atest = false; end + if ~io(3).plists.isparam('split'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('kdes'), 100), atest = false; end + if ~isequal(io(3).plists.find('jdes'), 1000), atest = false; end + if ~isequal(io(3).plists.find('lmin'), 0), atest = false; end + if ~strcmpi(io(3).plists.find('win'), defaultWinType), atest = false; end + if ~isequal(io(3).plists.find('olap'), -1), atest = false; end + if ~isequal(io(3).plists.find('order'), 0), atest = false; end + if ~isequal(io(3).plists.find('psll'), 200), atest = false; end + if ~isEmptyDouble(io(3).plists.find('times')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('split')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('kdes'), {100}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('jdes'), {1000}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('lmin'), {0}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('win'), specwin.getTypes), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('olap'), {-1}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('order'), {-1 0 1 2 3 4 5 6 7 8 9}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('psll'), {200}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('times'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('split'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the lcpsd method works with a vector of AOs as input. (only + % with two objects in the vector) + % + % + function result = utp_02 + + % + % + % Test that the lcpsd method works for a vector of AOs as input. + % + % + + try + % + avec = [at1 at5]; + out = lcpsd(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is equal to 1 + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the lcpsd method doesn't work with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the lcpsd method doesn't work for a matrix of AOs as input. + % + % + + try + % + amat = [at1 at5; at5 at6]; + out = lcpsd(amat); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the lcpsd method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the lcpsd method works for a list of AOs as input. + % + % + + try + % + out = lcpsd(at1,at5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is equal to 1 + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the lcpsd method doesn't work with a mix of different shaped + % AOs as input. + % + % + function result = utp_05 + + % + % + % Test that the lcpsd method doesn't work with an input of matrices and + % vectors and single AOs. + % + % + + try + % + out = lcpsd(at1,[at5 at6],at5,[at5 at1; at6 at1],at6); + stest = false; + % + catch err + stest = true; + end + + % + % + % 1) Nothing to check + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the lcpsd method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the lcpsd method can be processed back + % to an m-file. + % + % + + try + % + out = lcpsd(at5,at6); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'cpsd'. + % 2) Check that the re-built object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'lcpsd'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the lcpsd method can not modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the lcpsd method can not modify the input AO. + % The method must throw an error for the modifier call. + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + ain.lcpsd(at5); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the lcpsd method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = lcpsd(at5, at6); + out2 = lcpsd(at6, at5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y, 2) ~= 1, atest = false; end + if size(out2.data.y, 1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the lcpsd method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % This test is not longer necessary because the lcpsd method pass back + % always only one object. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_12 + + % + % + % Tests that differently sized data sets are treated properly + % + % + function result = utp_12 + + % + % + % Test that applying lcpsd works on two AOs. + % + % + + try + % + % Construct two test AOs + nsecs = [10000:1:20000]; + fs = 1; + pl = plist('fs', fs, 'tsfcn', 'randn(size(t))'); + a1 = ao(pl.pset('nsecs', utils.math.randelement(nsecs, 1))); + a2 = ao(pl.pset('nsecs', utils.math.randelement(nsecs, 1))); + len_1 = a1.len; + len_2 = a2.len; + % Filter one time-series + f2 = miir(plist('type', 'bandpass', 'fs', fs, 'order', 3, 'fc', [.050 .25])); + a1f = filter(a1, plist('filter', f2)); + % Compute lcpsd + win = 'Hanning'; + pl = plist('Win', win, 'order', -1); + out = lcpsd(a2,a1f,pl); + + stest = true; + % + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that lcpsd used the length of the shortest ao. + % + % + + atest = true; + if stest + % + % Compare the nfft with the length of the input data + + if out.x(1) ~= 1/min(len_1,len_2) + atest = false; + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_17 + + % + % + % Tests handling of units: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) LCPSD of the white noise series + % 4) compares the units of the input and output + % + + % + function result = utp_17 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) LCPSD of the white noise + % + % + + % + try + + noise_type = 'Normal'; + win_type = 'BH92'; + + [a_1, a_2, spec, spec1] = prepare_analyze_noise(win_type, noise_type, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (calculated LCPSD yunits) equals + % input_1 units*input_2 units/Hz + % + % + + % + atest = true; + u = simplifyYunits(a_1.* a_2, plist('prefixes', false, 'exceptions', 'Hz')); + if stest + if ne(spec.Cxy.yunits, u.yunits * unit('Hz^-1')) || ne(spec.Cxy.xunits, unit('Hz')) + atest = false; + end + if ne(spec.Cyx.yunits, u.yunits * unit('Hz^-1')) || ne(spec.Cyx.xunits, unit('Hz')) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_17 + + %% UTP_18 + + % + % + % Tests handling of units: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) LCPSD of the white noise series + % + % Comparison with LPSD: + % 4) compares the off-diagonal terms to check they are complex-conjugated + % 5) compares the diagonal terms with PSD of the individual noise + % + + % + function result = utp_18 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) LCPSD of the white noise + % 6) LPSD of the white noise + % + % + + % + try + + noise_type = 'Uniform'; + win_type = 'BH92'; + + [a_1, a_2, spec, spec2] = prepare_analyze_noise(win_type, noise_type, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that LCPSD(x,y) equals conj(LCPSD(y,x)) + % 2) Check that LCPSD(y,y) equals LPSD(y) + % 3) Check that LCPSD(x,x) equals LPSD(x) + + % + % + + % + atest = true; + TOL = 1e-12; + + if stest + if ne(spec.Cxy.y, conj(spec.Cyx.y)), atest = false; end + if ne(spec.Cxy.x, spec.Cyx.x), atest = false; end + if ne(spec.Cxx.data, spec.S_1.data) + if any(abs(spec.Cxx.y - spec.S_1.y)./abs(spec.Cxx.y) > TOL) + atest = false; + end + end + if ne(spec.Cyy.data, spec.S_2.data) + if any(abs(spec.Cyy.y - spec.S_2.y)./abs(spec.Cyy.y) > TOL) + atest = false; + end + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_18 + + %% Helper function for window call construction + + function [a_1, a_2, spec1, spec2] = prepare_analyze_noise(win_type, noise_type, pli) + % Array of parameters to pick from + fs_list = [0.1;1;2;5;10]; + nsecs_list = [20 100 1000:1000:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + trend_0_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr_1 = utils.math.randelement(sigma_distr_list, 1); + sigma_distr_2 = utils.math.randelement(sigma_distr_list, 1); + trend_0_1 = utils.math.randelement(trend_0_list, 1); + trend_0_2 = utils.math.randelement(trend_0_list, 1); + + % Pick units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + + % White noise + a_n = ao(plist('waveform', 'noise', ... + 'type', noise_type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_1)); + + % Constant signal + a_c = ao(trend_0_1); + + % Total signal + a_1 = a_n + a_c; + + % White noise + a_n = ao(plist('waveform', 'noise', ... + 'type', noise_type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_2)); + % Constant signal + a_c = ao(trend_0_2); + + % Total signal + a_2 = a_n + a_c; + + % Set units + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the lcpsd of the white noise time-series data + olap = 0; + detrend_order = 0; + + switch lower(win_type) + case 'kaiser' + psll = find(pli, 'psll'); + if isempty(psll) + psll = find(ao.getInfo('psd').plists, 'psll'); + end + pl_spec = plist('Win', win_type, 'psll', psll, 'olap', olap, 'order', detrend_order); + + otherwise + pl_spec = plist('Win', win_type, 'olap', olap, 'order', detrend_order); + + end + + if find(pli, 'win_obj') + % Calls the lcpsd applying the detrend and window internally + % (passig window object) + spec2.pl = pl_spec; + spec2.Cxy = lcpsd(a_1, a_2, spec2.pl); + spec2.Cyx = lcpsd(a_2, a_1, spec2.pl); + spec2.Cxx = lcpsd(a_1, a_1, spec2.pl); + spec2.Cyy = lcpsd(a_2, a_2, spec2.pl); + spec2.S_1 = simplifyYunits(lpsd(a_1, spec2.pl), ... + plist('prefixes', false, 'exceptions','Hz')); + spec2.S_2 = simplifyYunits(lpsd(a_2, spec2.pl), ... + plist('prefixes', false, 'exceptions','Hz')); + else + spec2 = struct; + end + % Calls the lcpsd applying the detrend and window internally + % (passig window name) + spec1.pl = pl_spec.pset('Win', win_type); + spec1.Cxy = lcpsd(a_1, a_2, spec1.pl); + spec1.Cyx = lcpsd(a_2, a_1, spec1.pl); + spec1.Cxx = lcpsd(a_1, a_1, spec1.pl); + spec1.Cyy = lcpsd(a_2, a_2, spec1.pl); + spec1.S_1 = simplifyYunits(lpsd(a_1, spec1.pl), ... + plist('prefixes', false, 'exceptions','Hz')); + spec1.S_2 = simplifyYunits(lpsd(a_2, spec1.pl), ... + plist('prefixes', false, 'exceptions','Hz')); + + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_le.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_le.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,255 @@ +% UTP_AO_LE a set of UTPs for the ao/le method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_le.m,v 1.2 2009/07/20 18:01:56 ingo Exp $ +% + +% +% +% The lt() function of the ao class ao1 ≤ ao2 compares the y-axis values of +% ao1 with y-axis values of ao2 and returns an array with elements set to +% logical 1 (true) where the relation is true and elements set to logical 0 +% where it is not. +% +% + +function results = utp_ao_le(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'le'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Compare against scalar + results = [results utp_03]; % Compare against AO + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the le method compare an AO with scalar value + % + % + function result = utp_02 + + % + % + % Test that the le method works with relational operators and the function + % command. Use for this AOs with different data objects. + % + % + + try + % + scalar = 0.2; + out11 = at1 <= scalar; + out12 = le(at1,scalar); + out21 = at2 <= scalar; + out22 = le(at2,scalar); + out31 = at3 <= scalar; + out32 = le(at3,scalar); + out41 = at4 <= scalar; + out42 = le(at4,scalar); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the result of the 'relational operator' and the 'function' + % command are the same. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check the different commands + if ~isequal(out11, out12), atest = false; end + if ~isequal(out21, out22), atest = false; end + if ~isequal(out31, out32), atest = false; end + if ~isequal(out41, out42), atest = false; end + % Check the output data + y1 = at1.y; + y2 = at2.y; + y3 = at3.y; + y4 = at4.y; + if ~isequal(out11, y1<=scalar), atest = false; end + if ~isequal(out21, y2<=scalar), atest = false; end + if ~isequal(out31, y3<=scalar), atest = false; end + if ~isequal(out41, y4<=scalar), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the le method compare an AO with one other AO + % + % + function result = utp_03 + + % + % + % Test that the le method works with relational operators and the function + % command. Use for this AOs with different data objects. + % Remark that both AOs must have the same size. + % + % + + try + % + out11 = at1 <= ao(1:300, zeros(300,1)); + out12 = le(at1,ao(1:300, zeros(300,1))); + out21 = at2 <= ao(1:151, zeros(151,1)); + out22 = le(at2,ao(1:151, zeros(151,1))); + out31 = at3 <= ao(1:100, zeros(100,1)); + out32 = le(at3,ao(1:100, zeros(100,1))); + out41 = at4 <= ao(zeros(3,3)); + out42 = le(at4,ao(zeros(3,3))); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the result of the 'relational operator' and the 'function' + % command are the same. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check the different commands + if ~isequal(out11, out12), atest = false; end + if ~isequal(out21, out22), atest = false; end + if ~isequal(out31, out32), atest = false; end + if ~isequal(out41, out42), atest = false; end + % Check the output data + y1 = at1.y; + y2 = at2.y; + y3 = at3.y; + y4 = at4.y; + if ~isequal(out11, y1<=0), atest = false; end + if ~isequal(out21, y2<=0), atest = false; end + if ~isequal(out31, y3<=0), atest = false; end + if ~isequal(out41, y4<=0), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_len.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_len.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,369 @@ +% UTP_AO_LEN a set of UTPs for the ao/len method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_len.m,v 1.2 2009/07/20 18:01:56 ingo Exp $ +% + +% +% +% The len method of the ao class computes the number of data samples in the data +% object. +% +% + +function results = utp_ao_len(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'len'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the len method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the len method works for a vector of AOs as input. + % + % + + try + % + out = len(atvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check each output against the the length of the data samples of the input + for kk=1:numel(out) + if ~isequal(out(kk), numel(atvec(kk).y)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the len method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the len method works for a matrix of AOs as input. + % + % + + try + % + out = len(atmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check each output + for kk=1:numel(out) + if ~isequal(numel(atmat(kk).y), out(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the len method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the len method works for a list of AOs as input. + % + % + + try + % + out = len(at1,at2,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output + if ~isequal(numel(at1.y), out(1)), atest = false; end + if ~isequal(numel(at2.y), out(2)), atest = false; end + if ~isequal(numel(at3.y), out(3)), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the len method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the len method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = len(at1,atvec,at2,atmat,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1,reshape(atvec,1,[]),at2,reshape(atmat,1,[]),at3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(atmat)+numel(atvec)), atest = false; end + % Check each output + for kk=1:numel(out) + if ~isequal(numel(aoin(kk).y), out(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the len method properly applies history. + % + % + function result = utp_06 + + % + % + % The len method doesn't change the object, thus it is not necessary to test + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_linSubtract.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_linSubtract.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,425 @@ +% UTP_AO_LINSUBTRACT a set of UTPs for the ao/linSubtract method +% +% M Nofrarias 05-07-09 +% +% $Id: utp_ao_linSubtract.m,v 1.3 2009/08/07 10:47:05 hewitson Exp $ +% + +% +% +% LINSUBTRACT subtracts a linear contribution from an input ao +% +% + +function results = utp_ao_linSubtract(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'linSubtract'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test output of the data + + pl = plist('coupling',{{'n(1)'},{'n(2)'}},'fc',[0.1 0.4]); + amat = [at1 at5 at6; at5 at6 at1]; + results = [results utp_11(mthd, amat, ple1, pl)]; % Test plotinfo doesn't disappear + + % + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + % + try + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + % + atest = true; + if stest + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 5, atest = false; end + % Check key + % Check default value + % Check options + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the linSubtract method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the linSubtract method works for a vector of AOs as input. + % + % + + % + try + avec = [at1 at5 at6]; + fs = at1.fs; + pl = plist('coupling',{{'n(1)'},{'n(2)'}},'fc',[0.1 0.4]); + out = linSubtract(avec,pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the linSubtract method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the linSubtract method works for a matrix of AOs as input. + % + % + + % + try + amat = [at1 at5 at6; at5 at6 at1]; + pl = plist('coupling',{{'n(1)'},{'n(2)'}},'fc',[0.1 0.4]); + out = linSubtract(amat,pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the linSubtract method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the linSubtract method works for a list of AOs as input. + % + % + + % + try + pl = plist('coupling',{{'n(1)'},{'n(2)'}},'fc',[0.1 0.4]); + out = linSubtract(at1,at5,at6,pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the linSubtract method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the linSubtract method works with an input of matrices and vectors + % and single AOs. + % + % + + % + try + pl = plist('coupling',{{'n(1)'},{'n(2)'}},'fc',[0.1 0.4]); + out = linSubtract(at1,[at5 at6],at5,[at5 at1; at6 at1],at6,pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + % + % + % Tests that the linSubtract method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the linSubtract method can be processed back + % to an m-file. + % + % + + % + try + pl = plist('coupling',{{'n(1)'},{'n(2)'}},'fc',[0.1 0.4]); + out = linSubtract(at1,at5,at6,pl); + mout = rebuild(out); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'linSubtract'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + % + atest = true; + if stest + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'linSubtract'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the linSubtract method can not modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the tfe method can not modify the input AO. + % The method must throw an error for the modifier call. + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ains[s[s[s[[[[[[s[ + pl = plist('coupling',{{'n(1)'},{'n(2)'}},'fc',[0.1 0.4]); + ain.linSubtract(at1,at5,at6,pl); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + + +end + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_lincom.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_lincom.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,517 @@ +% UTP_AO_LINCOM a set of UTPs for the ao/lincom method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_lincom.m,v 1.17 2011/04/17 15:46:21 ingo Exp $ +% + +% +% +% The lincom method of the ao class computes the combination of the input y +% and/or x data. +% +% + +function results = utp_ao_lincom(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'lincom'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + unit_list = unit.supportedUnits; + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_04]; % List input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_11(mthd, [at1 at1], ple1, plist('COEFFS', [1 2]))]; % Test plotinfo doesn't disappear + results = [results utp_12]; % Vector + pest input + results = [results utp_14]; % List + pest input + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('coeffs'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('coeffs')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('coeffs'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the lincom method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the lincom method works for a vector of AOs as input. + % + % + + try + % + % Coefficients for combination + u_d = unit(cell2mat(utils.math.randelement(unit_list,1))); + u_n = unit(cell2mat(utils.math.randelement(unit_list,1))); + coeffs = ao([0.34 -0.4], plist('yunits', u_n / u_d)); + % we need a vector of AOs that are all the same length + avec = [at5.setYunits(u_d) at6.setYunits(u_d) coeffs]; + out = lincom(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is 1 + % 2) Check that the output AO contains the correct units + % 3) Check that the output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Check we have the correct units + if ~isequal(out.yunits, u_n), atest = false; end + % Check each output against the linear combination of the inputs + com = zeros(size(avec(1).y)); + for kk = 1:(numel(avec)-1) + com = com + avec(numel(avec)).y(kk).*avec(kk).y; + end + if ~isequal(com, out.data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + + %% UTP_04 + + % + % + % Tests that the lincom method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the lincom method works for a list of AOs as input. + % + % + + try + % + % Coefficients for combination + u_d = unit(cell2mat(utils.math.randelement(unit_list,1))); + u_n = unit(cell2mat(utils.math.randelement(unit_list,1))); + coeffs = ao([0.34 -0.4 0.1], plist('yunits', u_n / u_d)); + out = lincom(at5.setYunits(u_d), at6.setYunits(u_d), at5.setYunits(u_d), coeffs); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is 1. + % 2) Check that the output AO contains the correct units + % 3) Check that the output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Check we have the correct units + if ~isequal(out.yunits, u_n), atest = false; end + % Check each output against the linear combination of the inputs + com = coeffs.y(1).*at5.y + coeffs.y(2).*at6.y + coeffs.y(3).*at5.y; + if ~isequal(com, out.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + + %% UTP_06 + + % + % + % Tests that the lincom method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the lincom method can be processed back + % to an m-file. + % + % + + try + % + a = at1.setYunits('Hz'); + out = lincom(a, a, ao([1 -1])); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'lincom'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'lincom'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the lincom method can not modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the lincom method can not modify the input AO. + % The method must throw an error for the modifier call. + % + % + + try + % + % copy at1 to work with + ain = ao(at5); + % modify ain + ain.lincom(at6, plist('Coeffs', [1 -1])); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the plus method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + a = at5.setYunits('Hz'); + b = at6.setYunits('Hz'); + out1 = lincom(a, b, ao([1 -1])); + out2 = lincom(b, a, ao([1 -1])); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the output data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y, 2) ~= 1, atest = false; end + if size(out2.data.y, 1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_12 + + % + % + % Tests that the lincom method works with a vector of AOs as input + a pest object. + % + % + function result = utp_12 + + % + % + % Test that the lincom method works for a vector of AOs as input. + % + % + + try + % + % Coefficients for combination + u_1 = unit(cell2mat(utils.math.randelement(unit_list,1))); + u_2 = unit(cell2mat(utils.math.randelement(unit_list,1))); + u_c1 = unit(cell2mat(utils.math.randelement(unit_list,1))); + coeffs = pest(plist('y', [0.34 -0.4], 'paramnames', {'i','ii'}, 'yunits', {u_c1, u_c1 * u_1 / u_2})); + % we need a vector of AOs that are all the same length + avec = [at5.setYunits(u_1) at6.setYunits(u_2)]; + out = lincom(avec, coeffs); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is 1 + % 2) Check that the output AO contains the correct units + % 3) Check that the output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Check we have the correct units + if ~eq(out.yunits, u_c1 * u_1), atest = false; end + % Check each output against the linear combination of the inputs + com = zeros(size(avec(1).y)); + for kk = 1:numel(avec) + com = com + avec(kk).y.*coeffs.y(kk); + end + if ~isequal(com, out.data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + + %% UTP_14 + + % + % + % Tests that the lincom method works with a list of AOs as input + a pest object. + % + % + function result = utp_14 + + % + % + % Test that the lincom method works for a list of AOs as input. + % + % + + try + % + % Coefficients for combination + u_d = unit(cell2mat(utils.math.randelement(unit_list,1))); + u_n = unit(cell2mat(utils.math.randelement(unit_list,1))); + coeffs = ao([0.34 -0.4 0.1], plist('yunits', u_n / u_d)); % TODO: Use a pest with different units!! + out = lincom(at5.setYunits(u_d), at6.setYunits(u_d), at5.setYunits(u_d), coeffs); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is 1. + % 2) Check that the output AO contains the correct units + % 3) Check that the output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Check we have the correct units + if ~isequal(out.yunits, u_n), atest = false; end + % Check each output against the linear combination of the inputs + com = coeffs.y(1).*at5.y + coeffs.y(2).*at6.y + coeffs.y(3).*at5.y; + if ~isequal(com, out.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_14 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_ln.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_ln.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,127 @@ +% UTP_AO_LN a set of UTPs for the ao/ln method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_ln.m,v 1.13 2011/04/18 16:57:44 ingo Exp $ +% + +% +% +% The ln method of the ao class computes the natural logarithm of the y +% and/or x data. +% +% + +function results = utp_ao_ln(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'ln'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06('log', at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, plist('neval', true), ple1)]; % Test the modify call works + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at5, at6, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + 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 + + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(log(in.data.getY), out.data.getY) + atest = false; + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_loadobj.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_loadobj.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,153 @@ +% UTP_AO_LOADOBJ a set of UTPs for the ao/loadobj method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_loadobj.m,v 1.1 2009/01/12 19:08:19 ingo Exp $ +% + +% +% +% The loadobj method of the ao class will be automatically called by +% MATLAB if an older object is not compatible with the current object structure. +% This happens only for objects which are stored as a MATLAB formatted +% (MAT-file). The load mechanism for XML formated files calls always the +% 'update_struct' method to keep the stored objects up to date. The +% 'update_struct' method convert the read object structure to the object +% structure which is used in the currend LTPDA version. +% This UTP will load old objects which are stored with an older LTPDA version. +% +% REMARK: Since LTPDA version 1.9.2 will be an object which should be saved as a +% MAT file stored as a struct and not as the object. +% +% + +function results = utp_ao_loadobj(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'loadobj'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Run the tests + results = [results utp_01]; % getInfo call + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Get all .MAT and .XML files + path = fullfile(fileparts(which(mfilename)), '..', '..', 'utp_test_files'); + + matfiles = utils.prog.filescan(path, '.mat'); + xmlfiles = utils.prog.filescan(path, '.xml'); + + % Load .MAT files + obj_no = 1; + for ii=1:numel(matfiles) + fn = matfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = ao(fn); + obj_no = obj_no+1; + end + end + + % Load .XML files + for ii=1:numel(xmlfiles) + fn = xmlfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = ao(fn); + obj_no = obj_no+1; + end + end + % + stest = true; + catch err + disp(objs(obj_no).fname) + disp(fn) + disp(err.message) + stest = false; + end + + % + % + % 1) Check the shape of the loaded objects. + % + % + + atest = true; + if stest + % + for ii = 1:numel(objs) + obj = objs(ii).obj; + fname = objs(ii).fname; + + if ~isempty(strfind(fname, '_vec')) + % Loaded object must be a vector + if ~isvector(obj), atest = false; end + elseif ~isempty(strfind(fname, '_mat')) + % Loaded object must be a matrix + % REMARK: Known error in LTPDA version 1.9.2 + % A saved matrix doesn't keep the shape of the matrix. + if isempty(strfind(fname, '_192')) + if ~(size(obj,1) > 1 && size(obj,2) > 1), atest = false; end + end + else + % Loaded object must be a single object + if ~(size(obj,1) == 1 && size(obj,2) == 1), + atest = false; end + end + + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_log.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_log.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,127 @@ +% UTP_AO_LOG a set of UTPs for the ao/log method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_log.m,v 1.13 2011/04/17 10:48:10 hewitson Exp $ +% + +% +% +% The log method of the ao class computes the natural logarithm of the y +% and/or x data. +% +% + +function results = utp_ao_log(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'log'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple1)]; % Test the modify call works + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at5, at6, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(log(in.data.getY), out.data.getY) + atest = false; + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_log10.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_log10.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,127 @@ +% UTP_AO_LOG10 a set of UTPs for the ao/log10 method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_log10.m,v 1.13 2011/04/17 10:48:02 hewitson Exp $ +% + +% +% +% The log10 method of the ao class computes the logarithm base 10 of the y +% and/or x data. +% +% + +function results = utp_ao_log10(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'log10'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple1)]; % Test the modify call works + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at5, at6, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(log10(in.data.getY), out.data.getY) + atest = false; + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_lpsd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_lpsd.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,1608 @@ +% UTP_AO_LPSD a set of UTPs for the ao/lpsd method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_lpsd.m,v 1.30 2011/05/22 21:21:30 mauro Exp $ +% + +% +% +% The lpsd method of the ao class computes the spectral density of +% time-series AOs on a log-frequency axis. +% +% + +function results = utp_ao_lpsd(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'lpsd'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Get default window from the preferences + prefs = getappdata(0, 'LTPDApreferences'); + defaultWinType = char(prefs.getMiscPrefs.getDefaultWindow); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test output of the data + results = [results utp_08]; % Test against MATLAB's fft + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + results = [results utp_17]; % Test units handling: PSD + results = [results utp_18]; % Test units handling: ASD + results = [results utp_19]; % Test units handling: PS + results = [results utp_20]; % Test units handling: AS + results = [results utp_41]; % Test different windows: Rectangular + results = [results utp_42]; % Test different windows: BH92 + results = [results utp_43]; % Test different windows: Hamming + results = [results utp_44]; % Test different windows: Hanning + results = [results utp_45]; % Test different windows: Bartlett + results = [results utp_46]; % Test different windows: Nuttall3 + results = [results utp_47]; % Test different windows: Kaiser psll = [random] + results = [results utp_48]; % Test different windows: Kaiser psll = [default] + results = [results utp_49]; % Test different windows: Nuttall4 + results = [results utp_50]; % Test different windows: SFT3F + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + % + try + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + % + atest = true; + if stest + % check we have minfo objects + if isa(io, 'minfo') + + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 10, atest = false; end + % Check key + if ~io(3).plists.isparam('kdes'), atest = false; end + if ~io(3).plists.isparam('jdes'), atest = false; end + if ~io(3).plists.isparam('lmin'), atest = false; end + if ~io(3).plists.isparam('win'), atest = false; end + if ~io(3).plists.isparam('olap'), atest = false; end + if ~io(3).plists.isparam('scale'), atest = false; end + if ~io(3).plists.isparam('order'), atest = false; end + if ~io(3).plists.isparam('psll'), atest = false; end + if ~io(3).plists.isparam('times'), atest = false; end + if ~io(3).plists.isparam('split'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('kdes'), 100), atest = false; end + if ~isequal(io(3).plists.find('jdes'), 1000), atest = false; end + if ~isequal(io(3).plists.find('lmin'), 0), atest = false; end + if ~strcmpi(io(3).plists.find('win'), defaultWinType), atest = false; end + if ~isequal(io(3).plists.find('olap'), -1), atest = false; end + if ~isequal(io(3).plists.find('scale'), 'PSD'), atest = false; end + if ~isequal(io(3).plists.find('order'), 0), atest = false; end + if ~isequal(io(3).plists.find('psll'), 200), atest = false; end + if ~isEmptyDouble(io(3).plists.find('times')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('split')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('kdes'), {100}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('jdes'), {1000}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('lmin'), {0}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('win'), specwin.getTypes), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('olap'), {-1}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('scale'), {'PSD', 'ASD', 'PS', 'AS'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('order'), {-1 0 1 2 3 4 5 6 7 8 9}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('psll'), {200}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('times'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('split'), {[]}), atest = false; end + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the lpsd method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the lpsd method works for a vector of AOs as input. + % + % + + % + try + avec = [at1 at5 at6]; + % Vector output + out = lpsd(avec); + % List output + [out1, out2, out3] = lpsd(avec); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the same as in the input. + % 2) Check that each output object contains the correct values. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + % Check we have the correct values in the outputs + % Vector output + for kk = 1:numel(out) + if ~eq(out(kk), lpsd(avec(kk)), ple1), atest = false; end + end + % List output + if ~eq(out1, lpsd(avec(1)), ple1), atest = false; end + if ~eq(out2, lpsd(avec(2)), ple1), atest = false; end + if ~eq(out3, lpsd(avec(3)), ple1), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the lpsd method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the lpsd method works for a matrix of AOs as input. + % + % + + % + try + amat = [at1 at5 at6; at5 at6 at1]; + % Vector output + out = lpsd(amat); + % List output + [out1, out2, out3, out4, out5, out6] = lpsd(amat); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the same as in the input. + % 2) Check that each output object contains the correct values. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + % Check we have the correct values in the outputs + % Vector output + for kk = 1:numel(out) + if ~eq(out(kk), lpsd(amat(kk)), ple1), atest = false; end + end + % List output + if ~eq(out1, lpsd(amat(1)), ple1), atest = false; end + if ~eq(out2, lpsd(amat(2)), ple1), atest = false; end + if ~eq(out3, lpsd(amat(3)), ple1), atest = false; end + if ~eq(out4, lpsd(amat(4)), ple1), atest = false; end + if ~eq(out5, lpsd(amat(5)), ple1), atest = false; end + if ~eq(out6, lpsd(amat(6)), ple1), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the lpsd method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the lpsd method works for a list of AOs as input. + % + % + + % + try + % Vector output + out = lpsd(at1,at5,at6); + % List output + [out1, out2, out3] = lpsd(at1,at5,at6); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the same as in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check we have the correct values in the outputs + % Vector output + if ~eq(out(1), lpsd(at1), ple1), atest = false; end + if ~eq(out(2), lpsd(at5), ple1), atest = false; end + if ~eq(out(3), lpsd(at6), ple1), atest = false; end + % List output + if ~eq(out1, lpsd(at1), ple1), atest = false; end + if ~eq(out2, lpsd(at5), ple1), atest = false; end + if ~eq(out3, lpsd(at6), ple1), atest = false; end + + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the lpsd method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the lpsd method works with an input of matrices and vectors + % and single AOs. + % + % + + % + try + % Vector output + out = lpsd(at1,[at5 at6],at5,[at5 at1; at6 at1],at6); + % List output + [out1, out2, out3, out4, out5, out6, out7, out8, out9] = ... + lpsd(at1,[at5 at6],at5,[at5 at1; at6 at1],at6); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + % Check we have the correct values in the outputs + % Vector output + if ~eq(out(1), lpsd(at1), ple1), atest = false; end + if ~eq(out(2), lpsd(at5), ple1), atest = false; end + if ~eq(out(3), lpsd(at6), ple1), atest = false; end + if ~eq(out(4), lpsd(at5), ple1), atest = false; end + if ~eq(out(5), lpsd(at5), ple1), atest = false; end + if ~eq(out(6), lpsd(at6), ple1), atest = false; end + if ~eq(out(7), lpsd(at1), ple1), atest = false; end + if ~eq(out(8), lpsd(at1), ple1), atest = false; end + if ~eq(out(9), lpsd(at6), ple1), atest = false; end + % List output + if ~eq(out1, lpsd(at1), ple1), atest = false; end + if ~eq(out2, lpsd(at5), ple1), atest = false; end + if ~eq(out3, lpsd(at6), ple1), atest = false; end + if ~eq(out4, lpsd(at5), ple1), atest = false; end + if ~eq(out5, lpsd(at5), ple1), atest = false; end + if ~eq(out6, lpsd(at6), ple1), atest = false; end + if ~eq(out7, lpsd(at1), ple1), atest = false; end + if ~eq(out8, lpsd(at1), ple1), atest = false; end + if ~eq(out9, lpsd(at6), ple1), atest = false; end + + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the lpsd method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the lpsd method can be processed back + % to an m-file. + % + % + + % + try + out = lpsd(at5); + mout = rebuild(out); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'lpsd'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + % + atest = true; + if stest + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'lpsd'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the lpsd method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = lpsd(at5, at6); + o3 = lpsd(at5, at6); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + %% UTP_08 + + % + % + % Tests that the lpsd method agrees with MATLAB's pwelch if the frequency + % resolution of the latter is changed to match those used in lpsd + % + % + % % + function result = utp_08 + + % + % + % Test that the applying psd works on a single AO. + % + % + + % + try + % Construct test AO + nsecs = 10; + fs = 1000; + Nfft = 2*fs; + pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'randn(size(t))'); + a1 = ao(pl); + % parameter list for lpsd + win = specwin('Hanning', Nfft); + pl = plist('Kdes', 10, 'Lmin', 2, 'Jdes', 100, 'Win', win.type, 'Olap', 50, 'Order', -1); + % compute lpsd + a2 = lpsd(a1, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the DFT equations (eq. (3) and (4) in [1]) are fulfilled. + % 2) Check that we get the same outputs for each frequency bin when + % computing the psd using matlab's fft with the frequency resolution + % values retrieved by lpsd (and already tested in (1)) + % + % [1] G. Heinzel, lpsd revisited: ltf, S2-AEI-TN-3052 + % + % + atest = true; + if stest + % + % get freq. resolution, bin number and seg. length from procinfo + b = find(a2.procinfo,'m'); + r = find(a2.procinfo,'r'); + L = find(a2.procinfo,'L'); + % test eq.(3): f = r*b up to numerical accuracy + if all(abs(a2.data.x - r.*b) > max(eps(a2.data.x),eps(r.*b))) + atest = false; + end + % test eq.(4): fs = r*L up to numerical accuracy + if all(abs(a2.data.fs - r.*L) > max(eps(a2.data.fs),eps(r.*L))) + atest = false; + end + + % + else + atest = false; + end + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_17 + + % + % + % Tests handling of units: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) LPSD of the white noise + % 3) compares the units of the input and output + % + % + function result = utp_17 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) LPSD of the white noise + % + % + + % + try + + noise_type = 'Normal'; + win_type = 'BH92'; + scale = 'PSD'; + + [a, S, S1] = prepare_analyze_noise(win_type, noise_type, scale, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (calculated LPSD yunits) equals (input units)^2 / Hz + % 2) Check that (calculated LPSD xunits) equals Hz + % + % + + % + atest = true; + + if stest + if ne(S.yunits, (a.yunits).^2 * unit('Hz^-1')) || ne(S.xunits, unit('Hz')) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_17 + + %% UTP_18 + + % + % + % Tests handling of units: + % 1) white noise produced from uniform pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) LASD of the white noise + % 3) compares the units of the input and output + % + + % + function result = utp_18 + + % + % + % 1) Prepare the test tsdata: + % white noise from uniform distribution + offset + % 2) Assign a random unit + % 3) LASD of the white noise + % + % + + % + try + + noise_type = 'Uniform'; + win_type = 'Hamming'; + scale = 'ASD'; + + [a, S, S1] = prepare_analyze_noise(win_type, noise_type, scale, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (calculated LASD yunits) equals (input units) / Hz^(1/2) + % 2) Check that (calculated LASD xunits) equals Hz + % + % + + % + atest = true; + + if stest + if ne(S.yunits, (a.yunits) * unit('Hz^-1/2')) || ne(S.xunits, unit('Hz')) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_18 + + %% UTP_19 + + % + % + % Tests handling of units: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) LPS of the white noise + % 3) compares the units of the input and output + % + + % + function result = utp_19 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) LPS of the white noise + % + % + + % + try + + noise_type = 'Normal'; + win_type = 'Hanning'; + scale = 'PS'; + + [a, S, S1] = prepare_analyze_noise(win_type, noise_type, scale, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (calculated LPS yunits) equals (input units)^2 + % 2) Check that (calculated LPS xunits) equals Hz + % + % + + % + atest = true; + + if stest + if ne(S.yunits, (a.yunits).^2) || ne(S.xunits, unit('Hz')) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_19 + + %% UTP_20 + + % + % + % Tests handling of units: + % 1) white noise produced from uniform distribution, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) LAS of the white noise + % 3) compares the units of the input and output + % + + % + function result = utp_20 + + % + % + % 1) Prepare the test tsdata: + % white noise from uniform distribution + offset + % 2) Assign a random unit + % 3) LAS of the white noise + % + % + + % + try + + noise_type = 'Uniform'; + win_type = 'Rectangular'; + scale = 'AS'; + + [a, S, S1] = prepare_analyze_noise(win_type, noise_type, scale, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (calculated LAS yunits) equals (input units) + % 2) Check that (calculated LAS xunits) equals Hz + % + % + + % + atest = true; + + if stest + if ne(S.yunits, a.yunits) || ne(S.xunits, unit('Hz')) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_20 + + %% UTP_41 + + % + % + % Tests the effect of windowing: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) lpsd passing the window name (Rectangular) + % 3) lpsd passing the window object (Rectangular type) + % 4) compares the two psds + % + + % + function result = utp_41 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd without detrending, Rectangular window (name) + % 4) Estimate the psd without detrending, Rectangular window (object) + % 5) Compare results + % + % + + % + try + + noise_type = 'Normal'; + scale = 'PSD'; + win_type = 'Rectangular'; + + [a, S, S1] = prepare_analyze_noise(win_type, noise_type, scale, ... + plist('win_test', true)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psds are identical + % + % + + % + atest = true; + + if stest + % Compare the psd evaluated with the window name / object + if ~eq(S, S1, ple1) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_41 + + %% UTP_42 + + % + % + % Tests the effect of windowing: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) lpsd passing the window name (BH92) + % 3) lpsd passing the window object (BH92 type) + % 4) compares the two psds + % + + % + function result = utp_42 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd without detrending, BH92 window (name) + % 4) Estimate the psd without detrending, BH92 window (object) + % 5) Compare results + % + % + + % + try + + noise_type = 'Normal'; + scale = 'PSD'; + win_type = 'BH92'; + + [a, S, S1] = prepare_analyze_noise(win_type, noise_type, scale, ... + plist('win_test', true)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psds are identical + % + % + + % + atest = true; + + if stest + % Compare the psd evaluated with the window name / object + if ~eq(S, S1, ple1) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_42 + + + %% UTP_43 + + % + % + % Tests the effect of windowing: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) lpsd passing the window name (Hamming) + % 3) lpsd passing the window object (Hamming type) + % 4) compares the two psds + % + + % + function result = utp_43 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd without detrending, Hamming window (name) + % 4) Estimate the psd without detrending, Hamming window (object) + % 5) Compare results + % + % + + % + try + + noise_type = 'Normal'; + scale = 'PSD'; + win_type = 'Hamming'; + + [a, S, S1] = prepare_analyze_noise(win_type, noise_type, scale, ... + plist('win_test', true)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psds are identical + % + % + + % + atest = true; + + if stest + % Compare the psd evaluated with the window name / object + if ~eq(S, S1, ple1) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_43 + + %% UTP_44 + + % + % + % Tests the effect of windowing: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) lpsd passing the window name (Hanning) + % 3) lpsd passing the window object (Hanning type) + % 4) compares the two psds + % + + % + function result = utp_44 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd without detrending, Hanning window (name) + % 4) Estimate the psd without detrending, Hanning window (object) + % 5) Compare results + % + % + + % + try + + noise_type = 'Normal'; + scale = 'PSD'; + win_type = 'Hanning'; + + [a, S, S1] = prepare_analyze_noise(win_type, noise_type, scale, ... + plist('win_test', true)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psds are identical + % + % + + % + atest = true; + + if stest + % Compare the psd evaluated with the window name / object + if ~eq(S, S1, ple1) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_44 + + %% UTP_43 + + % + % + % Tests the effect of windowing: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) lpsd passing the window name (Bartlett) + % 3) lpsd passing the window object (Bartlett type) + % 4) compares the two psds + % + + % + function result = utp_45 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd without detrending, Bartlett window (name) + % 4) Estimate the psd without detrending, Bartlett window (object) + % 5) Compare results + % + % + + % + try + + noise_type = 'Normal'; + scale = 'PSD'; + win_type = 'Bartlett'; + + [a, S, S1] = prepare_analyze_noise(win_type, noise_type, scale, ... + plist('win_test', true)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psds are identical + % + % + + % + atest = true; + + if stest + % Compare the psd evaluated with the window name / object + if ~eq(S, S1, ple1) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_45 + + %% UTP_46 + + % + % + % Tests the effect of windowing: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) lpsd passing the window name (Nuttall3) + % 3) lpsd passing the window object (Nuttall3 type) + % 4) compares the two psds + % + + % + function result = utp_46 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd without detrending, Nuttall3 window (name) + % 4) Estimate the psd without detrending, Nuttall3 window (object) + % 5) Compare results + % + % + + % + try + + noise_type = 'Normal'; + scale = 'PSD'; + win_type = 'Nuttall3'; + + [a, S, S1] = prepare_analyze_noise(win_type, noise_type, scale, ... + plist('win_test', true)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psds are identical + % + % + + % + atest = true; + + if stest + % Compare the psd evaluated with the window name / object + if ~eq(S, S1, ple1) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_46 + + %% UTP_47 + + % + % + % Tests the effect of windowing: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) lpsd passing the window name (Kaiser, psll = 150) + % 3) lpsd passing the window object (Kaiser type, psll = 150) + % 4) compares the two psds + % + + % + function result = utp_47 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd without detrending, Kaiser window (name) + % 4) Estimate the psd without detrending, Kaiser window (object) + % 5) Compare results + % + % + + % + try + + noise_type = 'Normal'; + scale = 'PSD'; + win_type = 'Kaiser'; + psll = utils.math.randelement([10:10:200],1); + + [a, S, S1] = prepare_analyze_noise(win_type, noise_type, scale, ... + plist('win_test', true)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psds are identical + % + % + + % + atest = true; + + if stest + % Compare the psd evaluated with the window name / object + if ~eq(S, S1, ple1) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_47 + + %% UTP_48 + + % + % + % Tests the effect of windowing: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) lpsd passing the window name (Kaiser, psll = default) + % 3) lpsd passing the window object (Kaiser type, psll = default) + % 4) compares the two psds + % + + % + function result = utp_48 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd without detrending, Kaiser window (name) + % 4) Estimate the psd without detrending, Kaiser window (object) + % 5) Compare results + % + % + + % + try + + noise_type = 'Normal'; + scale = 'PSD'; + win_type = 'Kaiser'; + + [a, S, S1] = prepare_analyze_noise(win_type, noise_type, scale, ... + plist('win_test', true)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psds are identical + % + % + + % + atest = true; + + if stest + % Compare the psd evaluated with the window name / object + if ~eq(S, S1, ple1) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_48 + + + %% UTP_49 + + % + % + % Tests the effect of windowing: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) lpsd passing the window name (Nuttall4) + % 3) lpsd passing the window object (Nuttall4 type) + % 4) compares the two psds + % + + % + function result = utp_49 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd without detrending, Nuttall4 window (name) + % 4) Estimate the psd without detrending, Nuttall4 window (object) + % 5) Compare results + % + % + + % + try + + noise_type = 'Normal'; + scale = 'PSD'; + win_type = 'Nuttall4'; + + [a, S, S1] = prepare_analyze_noise(win_type, noise_type, scale, ... + plist('win_test', true)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psds are identical + % + % + + % + atest = true; + + if stest + % Compare the psd evaluated with the window name / object + if ~eq(S, S1, ple1) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_49 + + %% UTP_50 + + % + % + % Tests the effect of windowing: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) lpsd passing the window name (SFT3F) + % 3) lpsd passing the window object (SFT3F type) + % 4) compares the two psds + % + + % + function result = utp_50 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd without detrending, SFT3F window (name) + % 4) Estimate the psd without detrending, SFT3F window (object) + % 5) Compare results + % + % + + % + try + + noise_type = 'Normal'; + scale = 'PSD'; + win_type = 'SFT3F'; + + [a, S, S1] = prepare_analyze_noise(win_type, noise_type, scale, ... + plist('win_test', true)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psds are identical + % + % + + % + atest = true; + + if stest + % Compare the psd evaluated with the window name / object + if ~eq(S, S1, ple1) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_50 + + + %% Helper function for window call construction + + function [a, S_name, S_obj] = prepare_analyze_noise(win_type, noise_type, scale, pli) + % Array of parameters to pick from + fs_list = [0.1;1;2;5;10]; + nsecs_list = [20 100 1000:1000:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + trend_0_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + trend_0 = utils.math.randelement(trend_0_list, 1); + + % Pick units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + + % White noise + a_n = ao(plist('waveform', 'noise', ... + 'type', noise_type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + + % Constant signal + a_c = ao(trend_0); + + % Total signal + a = a_n + a_c; + + % Set units + a.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the lpsd of the white noise time-series data + olap = find(pli, 'olap'); + if isempty(olap) + olap = 0; %% Should we take the rov instead? + end + detrend_order = 0; + + switch lower(win_type) + case 'kaiser' + psll = find(pli, 'psll'); + if isempty(psll) + psll = find(ao.getInfo('lpsd').plists, 'psll'); + end + pl_spec = plist('Win', win_type, 'psll', psll, 'olap', olap, ... + 'order', detrend_order, 'scale', scale); + otherwise + pl_spec = plist('Win', win_type, 'olap', olap, ... + 'order', detrend_order, 'scale', scale); + end + + if find(pli, 'win_test') + % Calls the lpsd applying the detrend and window internally + % (passig window object) + S_obj = a.lpsd(pl_spec); + else + S_obj = ao; + end + + % Calls the lpsd applying the detrend and window internally + % (passig window name) + pl_spec.pset('Win', win_type); + S_name = a.lpsd(pl_spec); + + end + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_lscov.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_lscov.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,522 @@ +% UTP_AO_LSCOV a set of UTPs for the ao/lscov method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_lscov.m,v 1.14 2009/12/21 13:46:21 mauro Exp $ +% + +% +% +% The lscov method of the ao class solves a set of linear equations by +% performing a linear least-squares fit. +% It solves the problem +% Y = HX +% where X are the parameters, Y the measurements, and H the linear +% equations relating the two. +% +% + +function results = utp_ao_lscov(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'lscov'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + fs = 10; + nsecs = 10; + x1 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs)); + x2 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs)); + x3 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs)); + n = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs)); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test history is working + results = [results utp_06]; % Test the modify call works + results = [results utp_07]; % Test weights usage + + c = [1 -2 3]; + y = c(1)*x1 + c(2)*x2 + c(3)*x3 + n; + avec = [x1, x2, x3]; + results = [results utp_11(mthd, [avec y], ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('weights'), atest = false; end + if ~io(3).plists.isparam('cov'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('weights')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('cov')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('weights'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('cov'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the lscov method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the lscov method works for a vector of AOs as input. + % + % + + try + % + c = [1 -2 3]; + y = c(1)*x1 + c(2)*x2 + c(3)*x3 + n; + avec = [x1, x2, x3]; + out = lscov(avec, y); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the data type of the output + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have exactly one pest with 3 parameters + if numel(out) ~= 1 || numel(out.y) ~= 3, atest = false; end + if ~isa(out, 'pest'), atest = false; end + + % Check each output against MATLAB lscov + C = avec; + H = C(:).y; + [P,STDX,MSE,COV] = lscov(H,y.y); + if ~isequal(out.y, P), atest = false; end + if ~isequal(out.dy, STDX), atest = false; end + if ~isequal(out.procinfo.find('MSE'), MSE), atest = false; end + if ~isequal(out.cov, COV), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the lscov method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Tests that the lscov method works with a matrix of AOs as input. + % + % + + try + % + c = [1 -2 3 -1 2 4]; + y = c(1)*x1 + c(2)*x2 + c(3)*x3 + c(4)*x1 + c(5)*x2 + c(6)*x3 + n; + amat = [x1, x2, x3; x1, x2, x3]; + out = lscov(amat, y); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the data type of the output + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have exactly one pest with 6 parameters + if numel(out) ~= 1 || numel(out.y) ~= 6, atest = false; end + if ~isa(out, 'pest'), atest = false; end + + % Check each output against MATLAB lscov + C = amat; + H = C(:).y; + [P,STDX,MSE,COV] = lscov(H,y.y); + if ~isequal(out.y, P), atest = false; end + if ~isequal(out.dy, STDX), atest = false; end + if ~isequal(out.procinfo.find('MSE'), MSE), atest = false; end + if ~isequal(out.cov, COV), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the lscov method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Tests that the lscov method works with a list of AOs as input. + % + % + + try + % + c = [1 -2 3]; + y = c(1)*x1 + c(2)*x2 + c(3)*x3 + n; + out = lscov(x1, x2, x3, y); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the data type of the output + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have exactly one pest with 3 parameters + if numel(out) ~= 1 || numel(out.y) ~= 3, atest = false; end + if ~isa(out, 'pest'), atest = false; end + + % Check each output against MATLAB lscov + C = [x1, x2, x3]; + H = C(:).y; + [P,STDX,MSE,COV] = lscov(H,y.y); + if ~isequal(out.y, P), atest = false; end + if ~isequal(out.dy, STDX), atest = false; end + if ~isequal(out.procinfo.find('MSE'), MSE), atest = false; end + if ~isequal(out.cov, COV), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the lscov method properly applies history. + % + % + function result = utp_05 + + % + % + % Test that the result of applying the lscov method can be processed back. + % + % + + try + % + c = [1 -2 3]; + y = c(1)*x1 + c(2)*x2 + c(3)*x3 + n; + out = lscov(x1, x2, x3, y); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'lscov'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'lscov'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % The lscov method can not be used as a modifer method. + % + % + function result = utp_06 + + % + % + % The lscov method can not be used as a modifer method. + % + % + + try + % + c = [1 -2 3]; + y = c(1)*x1 + c(2)*x2 + c(3)*x3 + n; + x1.lscov(x1, x2, x3, y); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the lscov method uses weights for the fit. + % + % + function result = utp_07 + + % + % + % Check that the lscov method uses weights for the fit. + % + % + + try + % + c = [1 -2 3]; + x = 1:100; + w2 = (x.^2 - 100.*x + 2500)/2500; + w1(1:100) = 1; + + y = c(1)*x1 + c(2)*x2 + c(3)*x3 + n; + + % Setting units + y.setYunits('V m'); + x1.setYunits('V^-1 Hz'); + x2.setYunits('V^-1 Hz'); + x3.setYunits('V^-1 Hz'); + + pl1 = plist('Weights', w1); + pl2 = plist('Weights', w2); + pl3 = plist('Weights', ao(w2)); + + out1 = lscov(x1, x2, x3, y); + out2 = lscov(x1, x2, x3, y, pl1); + out3 = lscov(x1, x2, x3, y, pl2); + out4 = lscov(x1, x2, x3, y, pl3); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output data + % 2) Check the yunits + % 3) Check that 'out1' and 'out2' have the same data + % 4) Check that 'out3' and 'out4' have the same data + % 5) Check the re-built objects + % + % + + atest = true; + if stest + % + C = [x1, x2, x3]; + H = C(:).y; + + % Check the output data with w1 + [P,STDX,MSE,COV] = lscov(H,y.y,w1); + if ~isequal(out2.y, P), atest = false; end + if ~isequal(out2.dy, STDX), atest = false; end + if ~isequal(out2.procinfo.find('MSE'), MSE), atest = false; end + if ~isequal(out2.cov, COV), atest = false; end + for ii = 1:3 + if ~eq(out2.yunits(ii), unit('V m V Hz^-1')), atest = false; end + end + + % Check the output data with w2 + [P,STDX,MSE,COV] = lscov(H,y.y,w2); + if ~isequal(out3.y, P), atest = false; end + if ~isequal(out3.dy, STDX), atest = false; end + if ~isequal(out3.procinfo.find('MSE'), MSE), atest = false; end + if ~isequal(out3.cov, COV), atest = false; end + for ii = 1:3 + if ~eq(out3.yunits(ii), unit('V m V Hz^-1')), atest = false; end + end + + % Check that 'out1' and 'out2' have the same data + if ne(out1, out2, ple3), atest = false; end + % Check that 'out3' and 'out4' have the same data + if ne(out3, out4, ple3), atest = false; end + + % Run 'test[1..4].m' and check the result + if ne(mout1, out1, ple2), atest = false; end + if ne(mout2, out2, ple2), atest = false; end + if ne(mout3, out3, ple2), atest = false; end + if ne(mout4, out4, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_lt.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_lt.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,258 @@ +% UTP_AO_LT a set of UTPs for the ao/lt method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_lt.m,v 1.2 2009/07/20 18:01:56 ingo Exp $ +% + +% +% +% The lt() function of the ao class ao1 < ao2 compares the y-axis values of +% ao1 with y-axis values of ao2 and returns an array with elements set to +% logical 1 (true) where the relation is true and elements set to logical 0 +% where it is not. +% +% + +function results = utp_ao_lt(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'lt'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Compare against scalar + results = [results utp_03]; % Compare against AO + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the lt method compare an AO with scalar value + % + % + function result = utp_02 + + % + % + % Test that the lt method works with relational operators and the function + % command. Use for this AOs with different data objects. + % + % + + try + % + scalar = 0.2; + out11 = at1 < scalar; + out12 = lt(at1,scalar); + out21 = at2 < scalar; + out22 = lt(at2,scalar); + out31 = at3 < scalar; + out32 = lt(at3,scalar); + out41 = at4 < scalar; + out42 = lt(at4,scalar); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the result of the 'relational operator' and the 'function' + % command are the same. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check the different commands + if ~isequal(out11, out12), atest = false; end + if ~isequal(out21, out22), atest = false; end + if ~isequal(out31, out32), atest = false; end + if ~isequal(out41, out42), atest = false; end + % Check the output data + y1 = at1.y; + y2 = at2.y; + y3 = at3.y; + y4 = at4.y; + if ~isequal(out11, y1 + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the lt method compare an AO with one other AO + % + % + function result = utp_03 + + % + % + % Test that the lt method works with relational operators and the function + % command. Use for this AOs with different data objects. + % Remark that both AOs must have the same size. + % + % + + try + % + out11 = at1 < ao(1:300, zeros(300,1)); + out12 = lt(at1,ao(1:300, zeros(300,1))); + out21 = at2 < ao(1:151, zeros(151,1)); + out22 = lt(at2,ao(1:151, zeros(151,1))); + out31 = at3 < ao(1:100, zeros(100,1)); + out32 = lt(at3,ao(1:100, zeros(100,1))); + out41 = at4 < ao(zeros(3,3)); + out42 = lt(at4,ao(zeros(3,3))); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the result of the 'relational operator' and the 'function' + % command are the same. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check the different commands + if ~isequal(out11, out12), atest = false; end + if ~isequal(out21, out22), atest = false; end + if ~isequal(out31, out32), atest = false; end + if ~isequal(out41, out42), atest = false; end + % Check the output data + y1 = at1.y; + y2 = at2.y; + y3 = at3.y; + y4 = at4.y; + if ~isequal(out11, y1<0), atest = false; end + if ~isequal(out21, y2<0), atest = false; end + if ~isequal(out31, y3<0), atest = false; end + if ~isequal(out41, y4<0), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_ltfe.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_ltfe.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,718 @@ +% UTP_AO_LTFE a set of UTPs for the ao/ltfe method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_ltfe.m,v 1.25 2011/07/22 12:29:58 mauro Exp $ +% + +% +% +% The ltfe method of the ao class computes the transfer function between two +% time-series AOs on a log-frequency axis. +% +% + +function results = utp_ao_ltfe(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'ltfe'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Get default window from the preferences + prefs = getappdata(0, 'LTPDApreferences'); + defaultWinType = char(prefs.getMiscPrefs.getDefaultWindow); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input (only with two objects) + results = [results utp_03]; % Matrix input (not possible) + results = [results utp_04]; % List input (only with two objects) + results = [results utp_05]; % Test with mixed input (not possible) + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_11(mthd, [at1 at1], ple1)]; % Test plotinfo doesn't disappear + results = [results utp_17]; % Test units handling: Ltfe + results = [results utp_30]; % Special cases: same input + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 9, atest = false; end + % Check key + if ~io(3).plists.isparam('kdes'), atest = false; end + if ~io(3).plists.isparam('jdes'), atest = false; end + if ~io(3).plists.isparam('lmin'), atest = false; end + if ~io(3).plists.isparam('win'), atest = false; end + if ~io(3).plists.isparam('olap'), atest = false; end + if ~io(3).plists.isparam('order'), atest = false; end + if ~io(3).plists.isparam('psll'), atest = false; end + if ~io(3).plists.isparam('times'), atest = false; end + if ~io(3).plists.isparam('split'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('kdes'), 100), atest = false; end + if ~isequal(io(3).plists.find('jdes'), 1000), atest = false; end + if ~isequal(io(3).plists.find('lmin'), 0), atest = false; end + if ~strcmpi(io(3).plists.find('win'), defaultWinType), atest = false; end + if ~isequal(io(3).plists.find('olap'), -1), atest = false; end + if ~isequal(io(3).plists.find('order'), 0), atest = false; end + if ~isequal(io(3).plists.find('psll'), 200), atest = false; end + if ~isEmptyDouble(io(3).plists.find('times')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('split')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('kdes'), {100}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('jdes'), {1000}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('lmin'), {0}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('win'), specwin.getTypes), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('olap'), {-1}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('order'), {-1 0 1 2 3 4 5 6 7 8 9}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('psll'), {200}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('times'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('split'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the ltfe method works with a vector of AOs as input. (only + % with two objects in the vector) + % + % + function result = utp_02 + + % + % + % Test that the ltfe method works for a vector of AOs as input. + % + % + + try + % + avec = [at1 at5]; + out = ltfe(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is equal to 1. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Test that the ltfe method doesn't work for a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the ltfe method doesn't work for a matrix of AOs as input. + % + % + + try + % + amat = [at1 at5 at6; at5 at6 at1]; + out = ltfe(amat); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the ltfe method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the ltfe method works for a list of AOs as input. + % + % + + try + % + out = ltfe(at1,at5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is equal to 1. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the ltfe method doesn't work with a mix of different shaped + % AOs as input. + % + % + function result = utp_05 + + % + % + % Test that the ltfe method doesn't work with an input of matrices and + % vectors and single AOs. + % + % + + try + % + out = ltfe(at1,[at5 at6],at5,[at5 at1; at6 at1],at6); + stest = false; + % + catch err + stest = true; + end + + % + % + % 1) Nothing to check + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the ltfe method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the ltfe method can be processed back + % to an m-file. + % + % + + try + % + out = ltfe(at5,at6); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ltfe'. + % 2) Check that the re-built object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'ltfe'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the ltfe method can not modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the ltfe method can not modify the input AO. + % The method must throw an error for the modifier call. + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + ain.ltfe(at5); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the ltfe method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = ltfe(at5, at6); + out2 = ltfe(at6, at5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the output data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y, 2) ~= 1, atest = false; end + if size(out2.data.y, 1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the ltfe method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % This test is not longer necessary because the ltfe method pass back + % always only one object. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_17 + + % + % + % Tests handling of units: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) ltfe of the white noise series + % 4) compares the units of the input and output + % + + % + function result = utp_17 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) ltfe of the white noise + % + % + + % + try + + % Build time-series test data + fs = 1; + nsecs = 86400; + sigma_distr_1 = 4.69e-12; + mu_distr_1 = -5.11e-14; + sigma_distr_2 = 6.04e-9; + mu_distr_2 = 1.5e-10; + + % White noise + type = 'Normal'; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_1)); + a_const = ao(mu_distr_1); + a_1 = a_n + a_const; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_2)); + a_const = ao(mu_distr_2); + a_2 = a_n + a_const; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the ltfe of the time-series data + win = specwin('BH92'); + olap = win.rov; + detrend = 0; + + T = ltfe(a_1,a_2,plist('Win', win.type, 'olap', olap, 'order', detrend)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (calculated ltfe yunits) equals [1/Hz] + + % + + % + atest = true; + + if stest + if ne(T.yunits, a_2.yunits ./ a_1.yunits) || ne(T.xunits, unit('Hz')) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_17 + + %% UTP_30 + + % + % + % Tests handling of special cases: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) the same noise series + % 3) ltfe of the white noise series + % 4) compares the output to unity + % + + % + function result = utp_30 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % the same data as 1) and 2) + % 4) ltfe of the series + % + % + + % + try + + % Build time-series test data + fs = 1; + nsecs = 86400; + sigma_distr_1 = 4.69e-12; + mu_distr_1 = -5.11e-14; + + % White noise + type = 'Normal'; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_1)); + a_const = ao(mu_distr_1); + a_1 = a_n + a_const; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Build the second object as a copy of the first + a_2 = a_1; + + % Evaluate the ltfe of the time-series data + win = specwin('BH92'); + olap = win.rov; + detrend = 0; + + T = ltfe(a_1,a_2,plist('Win', win.type, 'olap', olap, 'order', detrend)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated ltfe equals 1 + + % + + % + atest = true; + + if stest + if sum(ne(T.y, 1)) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_30 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_max.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_max.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,144 @@ +% UTP_AO_MAX a set of UTPs for the ao/max method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_max.m,v 1.13 2010/06/07 16:43:06 ingo Exp $ +% + +% +% +% The max method of the ao class computes the largest element in y- or x- data. +% +% + +function results = utp_ao_max(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'max'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple1)]; % Test the modify call works + results = [results utp_208(mthd, at1, ple2)]; % Test with additional plist with the key 'axis' + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at5, at6, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(max(in.data.getY).', out.data.getY) + atest = false; + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if ~io(3).plists.isparam('axis'), atest = false; end + if ~io(3).plists.isparam('dim'), atest = false; end + if ~io(3).plists.isparam('option'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('axis'), 'y'), atest = false; end + if ~isEmptyDouble(io(3).plists.find('dim')), atest = false; end + if ~isEmptyChar(io(3).plists.find('option')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('axis'), {'x', 'y', 'xy'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('dim'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('option'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_mcmc.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_mcmc.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,401 @@ +% UTP_AO_MCMC a set of UTPs for the ao/mcmc method +% +% M Nofrarias 06-07-09 +% +% $Id: utp_ao_mcmc.m,v 1.8 2011/11/16 15:21:13 nikos Exp $ +% + +% +% +% MCMC samples a probability distribution for a using a +% Metropolis algorithm. +% +% + +function results = utp_ao_mcmc(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'mcmc'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + n1 = ao(plist('waveform','noise','type','normal','sigma',0.1,'nsecs',100,'fs',1,'yunits','m')); + n2 = ao(plist('waveform','noise','type','normal','sigma',0.1,'nsecs',100,'fs',1,'yunits','m')); + noise = [n1 ; n2]; + + in(1) = ao(plist('fs', 1, 'nsecs', 100, 'tsfcn', 'sin(2*pi*1*t)')); + in(2) = ao(plist('fs', 1, 'nsecs', 100, 'tsfcn', 'sin(2*pi*0.1*t)')); + + out(1) = ao(plist('fs', 1, 'nsecs', 100, 'tsfcn', '10 + sin(2*pi*1*t)')); + out(2) = ao(plist('fs', 1, 'nsecs', 100, 'tsfcn', '200 + sin(2*pi*0.1*t)')); + + % Test smodels + st1 = smodel('a + t'); + st1.setXvar('f'); + st1.setParams('a',10); + st1.setXvar('t'); + st1.setXvals(in(1).x); + + st2 = smodel('b + t'); + st2.setXvar('f'); + st2.setParams('b',10); + st2.setXvar('t'); + st2.setXvals(in(1).x); + + model = matrix(st1,st2,st1,st2,plist('shape',[2 2])); + + % define plist + pl = plist('Fitparams',{'a','b'},... + 'cov',[1 0; 0 1],... + 'J',1,... + 'N',2,... + 'range',{[5 15],[180 220]},... + 'x0',[10 200], ... + 'noise',noise, ... + 'Tc',[10 20], ... + 'model',model, ... + 'search', false, ... + 'frequencies',[1e-3 1],... + 'input', [in(1) ; in(2)],... + 'Navs',5,... + 'simplex', false); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % Test history is working + results = [results utp_05]; % Test output of the data + + % + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + % + try + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + % + atest = true; + if stest + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 19, atest = false; end + % Check key + if ~io(3).plists.isparam('N'), atest = false; end + if ~io(3).plists.isparam('cov'), atest = false; end + if ~io(3).plists.isparam('Fitparams'), atest = false; end + if ~io(3).plists.isparam('noise'), atest = false; end + if ~io(3).plists.isparam('model'), atest = false; end + if ~io(3).plists.isparam('search'), atest = false; end + if ~io(3).plists.isparam('simplex'), atest = false; end + if ~io(3).plists.isparam('heat'), atest = false; end + if ~io(3).plists.isparam('Tc'), atest = false; end + if ~io(3).plists.isparam('x0'), atest = false; end + if ~io(3).plists.isparam('jumps'), atest = false; end + if ~io(3).plists.isparam('plot'), atest = false; end + if ~io(3).plists.isparam('debug'), atest = false; end + %if ~io(3).plists.isparam('fpars'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('N'), 1000), atest = false; end + if ~isequal(io(3).plists.find('cov'), 1e-4), atest = false; end + if ~isEmptyDouble(io(3).plists.find('Fitparams')), atest = false; end + if ~isequal(io(3).plists.find('noise'), ''), atest = false; end + if ~isequal(io(3).plists.find('model'), ''), atest = false; end + if ~isequal(io(3).plists.find('search'), true), atest = false; end + if ~isequal(io(3).plists.find('simplex'), true), atest = false; end + if ~isequal(io(3).plists.find('heat'), 1), atest = false; end + if ~isequal(io(3).plists.find('Tc'), []), atest = false; end + if ~isequal(io(3).plists.find('x0'), []), atest = false; end + if ~isequal(io(3).plists.find('jumps'), []), atest = false; end + if ~isequal(io(3).plists.find('plot'), []), atest = false; end + if ~isequal(io(3).plists.find('debug'), false), atest = false; end + %if ~isequal(io(3).plists.find('fpars'), []), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('N'), {[1000]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('cov'), {[1e-4]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('Fitparams'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('noise'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('model'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('search'), {true, false}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('simplex'), {true, false}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('heat'), {[1]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('Tc'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('x0'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('jumps'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('plot'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('debug'), {false, true}), atest = false; end + %if ~isequal(io(3).plists.getOptionsForParam('fpars'), {[]}), atest = false; end + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the metropolis2D method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the metropolis2D method works for a vector of AOs as input. + % + % + + % + try + avec = [out(1) ; out(2)]; + m = mcmc(avec,pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(m.names) ~= numel(in), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the metropolis2D method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the metropolis2D method works for a matrix of AOs as input. + % + % + + % + try + amat = matrix(out(1),out(2),plist('shape',[2 1])); + m = mcmc(amat,pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(m.names) ~= numel(in), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + + %% UTP_04 + % + % + % Tests that the metropolis2D method properly applies history. + % + % + function result = utp_04 + + % + % + % Test that the result of applying the metropolis2D method can be processed back + % to an m-file. + % + % + + % + try + m = mcmc([out(1) ; out(2)],pl); + mm = rebuild(m); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the last entry in the history of 'm' corresponds to + % 'metropolis2D'. + % 2) Check that the re-built object is the same object as 'm'. + % THIS IS NOT TRUE FOR METROPOLIS BECAUSE THE OUTPUT CHAIN IS ONLY + % EQUAL STATISTICALLY + % + % + + % + atest = true; + if stest + % Check the last step in the history of 'out' + if ~strcmp(m(1).hist.methodInfo.mname, 'mcmc'), atest = true; end + % Check the re-built object +% if ~eq(mm(1), m(1), ple2), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the metropolis2D method can not modify the input AO. + % + % + function result = utp_05 + + % + % + % Test that the tfe method can not modify the input AO. + % The method must throw an error for the modifier call. + % + % + + try + % + % copy at1 to work with + ain = ao(in(1)); + % modify ain + ain.mcmc(in,out,pl); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + + +end + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_md5.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_md5.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,452 @@ +% UTP_AO_MD5 a set of UTPs for the ao/md5 method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_md5.m,v 1.4 2010/05/06 07:22:05 ingo Exp $ +% + +% +% +% The md5 method of the ao class computes an MD5 checksum from an analysis +% objects which is first converted into a XML document. +% +% + +function results = utp_ao_md5(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'md5'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Spcial case: one AO retruns a string + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the md5 method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the md5 method works for a vector of AOs as input. + % + % + + try + % + out = md5(atvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' are the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check each output against the md5 of the XML document + for kk=1:numel(out) + % Create XML document + xml = com.mathworks.xml.XMLUtils.createDocument('ltpda_object'); + parent = xml.getDocumentElement; + utils.xml.xmlwrite(atvec(kk), xml, parent, ''); + xml_txt = xmlwrite(xml); + xml_txt = uint8(xml_txt); + xml_txt = xml_txt(:); + + % Compute java md5 + md5_java = java.security.MessageDigest.getInstance('MD5'); + md5_java.update(xml_txt); + + md5_hex = typecast(md5_java.digest, 'uint8'); + md5_hex = dec2hex(md5_hex)'; + + if ~strcmpi(out{kk}, md5_hex(:)'), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the md5 method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Tests that the md5 method works with a matrix of AOs as input. + % + % + + try + % + out = md5(atmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' are the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check each output against the md5 of the XML document + for kk=1:numel(out) + % Create XML document + xml = com.mathworks.xml.XMLUtils.createDocument('ltpda_object'); + parent = xml.getDocumentElement; + utils.xml.xmlwrite(atmat(kk), xml, parent, ''); + xml_txt = xmlwrite(xml); + xml_txt = uint8(xml_txt); + xml_txt = xml_txt(:); + + % Compute java md5 + md5_java = java.security.MessageDigest.getInstance('MD5'); + md5_java.update(xml_txt); + + md5_hex = typecast(md5_java.digest, 'uint8'); + md5_hex = dec2hex(md5_hex)'; + + if ~strcmpi(out{kk}, md5_hex(:)'), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the md5 method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Tests that the md5 method works with a list of AOs as input. + % + % + + try + % + out = md5(at1, at2, at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' are the same as in the input + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, at2, at3]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(aoin)), atest = false; end + % Check each output against the md5 of the XML document + for kk=1:numel(out) + % Create XML document + xml = com.mathworks.xml.XMLUtils.createDocument('ltpda_object'); + parent = xml.getDocumentElement; + utils.xml.xmlwrite(aoin(kk), xml, parent, ''); + xml_txt = xmlwrite(xml); + xml_txt = uint8(xml_txt); + xml_txt = xml_txt(:); + + % Compute java md5 + md5_java = java.security.MessageDigest.getInstance('MD5'); + md5_java.update(xml_txt); + + md5_hex = typecast(md5_java.digest, 'uint8'); + md5_hex = dec2hex(md5_hex)'; + + if ~strcmpi(out{kk}, md5_hex(:)'), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the md5 method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Tests that the md5 method works with a mix of different shaped AOs as + % input. + % + % + + try + % + out = md5(atvec, at2, atmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' are the same as in the input + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [reshape(atvec,1,[]), at2, reshape(atmat,1,[])]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(aoin)), atest = false; end + % Check each output against the md5 of the XML document + for kk=1:numel(out) + % Create XML document + xml = com.mathworks.xml.XMLUtils.createDocument('ltpda_object'); + parent = xml.getDocumentElement; + utils.xml.xmlwrite(aoin(kk), xml, parent, ''); + xml_txt = xmlwrite(xml); + xml_txt = uint8(xml_txt); + xml_txt = xml_txt(:); + + % Compute java md5 + md5_java = java.security.MessageDigest.getInstance('MD5'); + md5_java.update(xml_txt); + + md5_hex = typecast(md5_java.digest, 'uint8'); + md5_hex = dec2hex(md5_hex)'; + + if ~strcmpi(out{kk}, md5_hex(:)'), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the md5 method retruns for one input a string and not a cell + % of a string + % + % + function result = utp_06 + + % + % + % Special case for one input because in this case retruns md5 a string + % and not a cell. + % + % + + try + % + out = md5(at4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a string + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a string + if~ischar(out), atest = false; end + % Check each output against the md5 of the XML document + % Create XML document + xml = com.mathworks.xml.XMLUtils.createDocument('ltpda_object'); + parent = xml.getDocumentElement; + utils.xml.xmlwrite(at4, xml, parent, ''); + xml_txt = xmlwrite(xml); + xml_txt = uint8(xml_txt); + xml_txt = xml_txt(:); + + % Compute java md5 + md5_java = java.security.MessageDigest.getInstance('MD5'); + md5_java.update(xml_txt); + + md5_hex = typecast(md5_java.digest, 'uint8'); + md5_hex = dec2hex(md5_hex)'; + + if ~strcmpi(out, md5_hex(:)'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_mean.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_mean.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,133 @@ +% UTP_AO_MEAN a set of UTPs for the ao/mean method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_mean.m,v 1.17 2011/04/17 10:47:51 hewitson Exp $ +% + +% +% +% The mean method of the ao class computes the mean value of the y +% and/or x data. +% +% + +function results = utp_ao_mean(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'mean'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Overide to include only data2D objects + atmat = [at1 at5 at2; at2 at1 at6]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple1)]; % Test the modify call works + results = [results utp_108(mthd, at1, ple2)]; % Test with additional plist with the key 'axis' + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at5, at6, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(mean(in.data.getY).', out.data.getY) + atest = false; + end + end + + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_median.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_median.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,130 @@ +% UTP_AO_MEDIAN a set of UTPs for the ao/median method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_median.m,v 1.14 2011/04/17 10:47:43 hewitson Exp $ +% + +% +% +% The median method of the ao class computes the median value of the y +% and/or x data. +% +% + +function results = utp_ao_median(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'median'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Overide to include only data2D objects + atmat = [at1 at5 at2; at2 at1 at6]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple1)]; % Test the modify call works + results = [results utp_108(mthd, at1, ple2)]; % Test with additional plist with the key 'axis' + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at5, at6, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(median(in.data.getY).', out.data.getY) + atest = false; + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_min.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_min.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,147 @@ +% UTP_AO_MAX a set of UTPs for the ao/min method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_min.m,v 1.12 2010/06/07 16:43:06 ingo Exp $ +% + +% +% +% The min method of the ao class computes the smalest element in y- or x- data. +% +% + +function results = utp_ao_min(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'min'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Overide to include only data2D objects + atmat = [at1 at5 at2; at2 at1 at6]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple1)]; % Test the modify call works + results = [results utp_208(mthd, at1, ple2)]; % Test with additional plist with the key 'axis' + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at5, at6, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(min(in.data.getY).', out.data.getY) + atest = false; + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if ~io(3).plists.isparam('axis'), atest = false; end + if ~io(3).plists.isparam('dim'), atest = false; end + if ~io(3).plists.isparam('option'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('axis'), 'y'), atest = false; end + if ~isEmptyDouble(io(3).plists.find('dim')), atest = false; end + if ~isEmptyChar(io(3).plists.find('option')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('axis'), {'x', 'y', 'xy'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('dim'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('option'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_minus.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_minus.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,125 @@ +% UTP_AO_MINUS a set of UTPs for the ao/minus method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_minus.m,v 1.13 2010/09/21 17:00:41 ingo Exp $ +% + +% +% +% The minus method of the ao class computes the subtraction of the y data of +% two inputs. +% +% + +function results = utp_ao_minus(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'minus'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_generic_aop_rule1(@minus)]; % Rule 1 + results = [results utp_generic_aop_rule2(@minus)]; % Rule 2 + results = [results utp_generic_aop_rule3(@minus)]; % Rule 3 + results = [results utp_generic_aop_rule4(@minus)]; % Rule 4 + results = [results utp_generic_aop_rule5(@minus)]; % Rule 5 + results = [results utp_generic_aop_rule6(@minus)]; % Rule 6 + results = [results utp_generic_aop_rule7(@minus)]; % Rule 7 + results = [results utp_generic_aop_rule8(@minus)]; % Rule 8 + results = [results utp_generic_aop_rule9(@minus)]; % Rule 9 + results = [results utp_generic_aop_rule10(@minus)]; % Rule 10 + results = [results utp_generic_aop_rule11(@minus)]; % Rule 11 + results = [results utp_generic_aop_negative_tests(@minus)]; % Negative tests + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_mode.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_mode.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,131 @@ +% UTP_AO_MODE a set of UTPs for the ao/mode method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_mode.m,v 1.12 2011/04/17 10:47:34 hewitson Exp $ +% + +% +% +% The mode method of the ao class computes the modal value of the y +% and/or x data. +% +% + +function results = utp_ao_mode(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'mode'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Overide to include only data2D objects + atmat = [at1 at5 at2; at2 at1 at6]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple1)]; % Test the modify call works + results = [results utp_108(mthd, at1, ple2)]; % Test with additional plist with the key 'axis' + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at5, at6, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(mode(in.data.getY).', out.data.getY) + atest = false; + end + end + + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_mpower.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_mpower.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,488 @@ +% UTP_AO_MPOWER a set of UTPs for the ao/mpower method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_mpower.m,v 1.6 2011/02/28 15:55:13 mauro Exp $ +% + +% +% +% The mpower method of the ao class computes the matrix power of the y data +% of the two inputs. +% +% + +function results = utp_ao_mpower(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'mpower'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('exponent'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('exponent')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('exponent'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the mpower method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the mpower method works for a vector of AOs as input. + % + % + + try + % + % We need a vector of AOs all the same size. + % The shape of the data shouldn't have an effect to the algorithm. + avec = [at4 ao(3) ao(1)]; + out = mpower(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is 1 + % 2) Check that each output AO contains the correct data. + % 3) Check the y-units + % + % + + atest = true; + if stest + % + % Check we have the one output + if numel(out) ~= 1, atest = false; end + % Check the output against the matrix power of the inputs + s = avec(1).data.getY; + for jj=2:numel(avec) + s = s ^ avec(jj).data.getY; + end + if ~isequal(s, out.data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the mpower method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the mpower method works for a matrix of AOs as input. + % + % + + try + % + % We need a matrix of AOs all the same size + amat = [at4 ao(1) ao(2); ao(3) ao(4) ao(5)]; + out = mpower(amat); + stest = true; + % + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is 1 + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Check the output against the matrix power of the inputs + s = amat(1).data.getY; + for kk=2:numel(amat) + s = s ^ amat(kk).data.getY; + end + if ~isequal(s, out.data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the mpower method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the mpower method works for a list of AOs as input. + % + % + + try + % + out = mpower(at4,ao(7),ao(4)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is 1. + % 2) Check that each output AO contains the correct data. + % 3) Check the y-units + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Check the output against the matrix power of the inputs + s = at4.data.getY ^ 7 ^ 4; + if ~isequal(s, out.data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the mpower method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the mpower method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + % This UTP doen't make sense. + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the mpower method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the mpower method can be processed back + % to an m-file. + % + % + + try + % + out1 = mpower(at4,5); + out2 = mpower(at4,ao(5)); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' and 'out2' corresponds to + % 'mpower'. + % 2) Check that the re-built objects are the same objectd as 'out1' and 'out2'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' and 'out2' + if ~strcmp(out1.hist.methodInfo.mname, 'mpower'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'mpower'), atest = false; end + % Check the re-built objects + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the mpower method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the mpower method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at4 to work with + ain = ao(at4); + % modify ain + aout = ain.mpower(5); + ain ^ 5; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at4' and 'ain' are now different. + % 2) Check that 'ain' is mpower(at4). + % + % + + atest = true; + if stest + % + % Check that mpower modified the input by comparing to the copy + if eq(ao(at4), ain, ple1), atest = false; end + % Check that mpower doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the mpower value of the copy + if ~isequal(mpower(at4.y, 5), ain.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the mpower method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + % This UTP doesn't make sense because the AO must contain a square matrix + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothinf to check + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_mrdivide.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_mrdivide.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,125 @@ +% UTP_AO_MRDIVIDE a set of UTPs for the ao/mrdivide method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_mrdivide.m,v 1.7 2010/09/21 17:00:41 ingo Exp $ +% + +% +% +% The mrdivide method of the ao class computes the subtraction of the y +% data of two inputs. +% +% + +function results = utp_ao_mrdivide(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'mrdivide'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_generic_aop_rule1(@rdivide)]; % Rule 1 + results = [results utp_generic_aop_rule2(@rdivide)]; % Rule 2 + results = [results utp_generic_aop_rule3(@rdivide)]; % Rule 3 + results = [results utp_generic_aop_rule4(@rdivide)]; % Rule 4 + results = [results utp_generic_aop_rule5(@rdivide)]; % Rule 5 + results = [results utp_generic_aop_rule6(@rdivide)]; % Rule 6 + results = [results utp_generic_aop_rule7(@rdivide)]; % Rule 7 + results = [results utp_generic_aop_rule8(@rdivide)]; % Rule 8 + results = [results utp_generic_aop_rule9(@rdivide)]; % Rule 9 + results = [results utp_generic_aop_rule10(@rdivide)]; % Rule 10 + results = [results utp_generic_aop_rule11(@rdivide)]; % Rule 11 + results = [results utp_generic_aop_negative_tests(@rdivide)]; % Negative tests + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_mtimes.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_mtimes.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,584 @@ +% UTP_AO_MTIMES a set of UTPs for the ao/mtimes method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_mtimes.m,v 1.7 2011/02/17 21:19:03 mauro Exp $ +% + +% +% +% The mtimes method of the ao class computes the matrix product of the y data +% of the two inputs. +% +% + +function results = utp_ao_mtimes(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'mtimes'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call +% results = [results utp_02]; % Vector input +% results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input +% results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test all data types + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the mtimes method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the mtimes method works for a vector of AOs as input. + % + % + + try + % + % We need a vector of AOs all the same size. + % The shape of the data shouldn't have an effect to the algorithm. + avec = [at1 ao(3) ao(1)]; + out = mtimes(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is 1 + % 2) Check that each output AO contains the correct data. + % 3) Check the y-units + % + % + + atest = true; + if stest + % + % Check we have the one output + if numel(out) ~= 1, atest = false; end + % Check the output against the matrix product of the inputs + s = avec(1).data.getY; + for jj=2:numel(avec) + s = s * avec(jj).data.getY; + end + if ~isequal(s, out.data.getY), atest = false; end + % Check the y-units + if ~eq(out.yunits, at1.yunits), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the mtimes method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the mtimes method works for a matrix of AOs as input. + % + % + + try + % + % We need a matrix of AOs all the same size + amat = [at4 ao(1) ao(2); ao(3) ao(4) ao(5)]; + out = mtimes(amat); + stest = true; + % + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is 1 + % 2) Check that each output AO contains the correct data. + % 3) Check that the output have the yunits of the AO which contains a yunits + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Check the output against the matrix product of the inputs + s = amat(1).data.getY; + for kk=2:numel(amat) + s = s * amat(kk).data.getY; + end + if ~isequal(s, out.data.getY), atest = false; end + % Check the units + if ~eq(out.yunits, at4.yunits), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the mtimes method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the mtimes method works for a list of AOs as input. + % + % + + try + % + out = mtimes(at1,ao(7),ao(4)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is 1. + % 2) Check that each output AO contains the correct data. + % 3) Check the y-units + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Check the output against the matrix product of the inputs + s = at1.data.getY * 7 * 4; + if ~isequal(s, out.data.getY), atest = false; end + % Check the units + if ~eq(out.yunits, at1.yunits), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the mtimes method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the mtimes method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + % We need a vector of AOs all the same size + avec = [ao(1) ao(2) ao(3)]; + % We need a matrix of AOs all the same size + amat = [ao(4) ao(5) ao(6); ao(7) ao(8) ao(9)]; + % Compute matrix product + out = mtimes(at5,avec,ao(10),amat,ao(11)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is 1. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Check the matrix product of all the inputs + s = at5.data.getY; + for jj=1:numel(avec) + s = s * avec(jj).data.getY; + end + s = s * 10; + for jj=1:numel(amat) + s = s * amat(jj).data.getY; + end + s = s * 11; + if ~isequal(s, out.data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the mtimes method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the mtimes method can be processed back + % with the rebuild method. + % + % + + try + % + out = mtimes(ao([3;4]),ao([5 8])); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'mtimes'. + % 2) Check that the rebuilt object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'mtimes'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + % delete test file + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the mtimes method can not be used as a modifier method. + % + % + function result = utp_07 + + % + % + % Tests that the mtimes method can not be used as a modifier method. The + % command should fail. + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = ain.mtimes(5); + ain * 5; + stest = false; + % + catch err + disp(err.message) + stest = true; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the mtimes method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = at5 * 5; + out2 = 5 * at5; + out3 = at6 * 5; + out4 = 5 * at6; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y, 1) ~= size(at5.data.y, 1), atest = false; end + if size(out2.data.y, 1) ~= size(at5.data.y, 1), atest = false; end + if size(out3.data.y, 2) ~= size(at6.data.y, 2), atest = false; end + if size(out4.data.y, 2) ~= size(at6.data.y, 2), atest = false; end + % Check y-units + if ~eq(out1.yunits, at5.yunits), atest = false; end + if ~eq(out2.yunits, at5.yunits), atest = false; end + if ~eq(out3.yunits, at6.yunits), atest = false; end + if ~eq(out4.yunits, at6.yunits), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test the method with all data objects. + % + % + function result = utp_09 + + % + % + % Test that the mtimes method works with cdata-, fsdata-, tsdata-, and xydata + % objects + % + % + + try + % + out11 = at1 * 5; + out12 = 5 * at1; + out21 = at2 * 5; + out22 = 5 * at2; + out31 = at3 * 5; + out32 = 5 * at3; + out41 = at4 * 5; + out42 = 5 * at4; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % 2) Check that re-building of output is the same as the output + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if ~isequal(mtimes(at1.y, 5), out11.y), atest = false; end + if ~isequal(mtimes(at1.y, 5), out12.y), atest = false; end + if ~isequal(mtimes(at2.y, 5), out21.y), atest = false; end + if ~isequal(mtimes(at2.y, 5), out22.y), atest = false; end + if ~isequal(mtimes(at3.y, 5), out31.y), atest = false; end + if ~isequal(mtimes(at3.y, 5), out32.y), atest = false; end + if ~isequal(mtimes(at4.y, 5), out41.y), atest = false; end + if ~isequal(mtimes(at4.y, 5), out42.y), atest = false; end + % Check the rebuilding + if ~eq(rebuild(out11), out11, ple2), atest = false; end + if ~eq(rebuild(out12), out12, ple2), atest = false; end + if ~eq(rebuild(out21), out21, ple2), atest = false; end + if ~eq(rebuild(out22), out22, ple2), atest = false; end + if ~eq(rebuild(out31), out31, ple2), atest = false; end + if ~eq(rebuild(out32), out32, ple2), atest = false; end + if ~eq(rebuild(out41), out41, ple2), atest = false; end + if ~eq(rebuild(out42), out42, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_ne.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_ne.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,453 @@ +% UTP_AO_NE a set of UTPs for the ao/ne method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_ne.m,v 1.6 2011/04/19 18:14:00 ingo Exp $ +% + +% +% +% The ne() method of the ao class ao1 ~= ao2 compares each element of an +% analysis object with the corresponding element of an second analysis object +% and returns a logical 1 (true) where ao1 and ao2 are not equal, +% or logical 0 (false) where they are equal. +% +% + +function results = utp_ao_ne(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'ne'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test with the exception list 'name' + results = [results utp_08]; % Test exception list in a plist + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the ne method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the ne method works for a vector of AOs as input. Test the + % positive and the negative case. + % + % + + try + % + aa = at1.setName('my name'); + avec1 = [at4, at3, at2, at1]; + avec2 = [at4, at3, at2, aa]; + out1 = ne(avec1, avec1); + out2 = ne(avec1, avec2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the ne function. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the ne method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the ne method works for a matrix of AOs as input. Test the + % positive and the negative case. + % + % + + try + % + aa = at1.setName('my name'); + amat1 = [at4, at3, at1, at1, at2, at4]; + amat2 = [at4, at3, aa; at1, at2, at4]; + out1 = ne(amat1, amat1); + out2 = ne(amat1, amat2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the ne function. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the ne method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % The ne method doesn't works for a list of AOs as input. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the ne method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % The ne method doesn't works for a list of AOs as input. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the ne method properly applies history. + % + % + function result = utp_06 + + % + % + % The ne method doesn't change the AO, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the ne method with an exception list. + % The function ao/ne use the function ao/eq so it is not necessary to check + % all possibilities of the exception list. + % + % + function result = utp_07 + + % + % + % Test the ne method with the exception 'name'. Use the option 'internal' to + % suppress the history. It is necessary to add 'created' to the exception + % list because aa is created at an other time. + % + % + + try + % + aa = testCallerIsMethod(@setName, at1, 'my name'); + out1 = ne(aa, at1); + out2 = ne(aa, at1, 'name', 'created', 'UUID'); + out3 = ne(aa, at1, 'ao/name', 'created', 'UUID'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + if out3 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the ne method with an exception list which is in a plist. + % + % + function result = utp_08 + + % + % + % Test that the ne method uses the exception list in a plist. + % + % + + try + % + aa = testCallerIsMethod(@setName, at1, 'my name'); + pl = plist('Exceptions', {'name', 'created', 'UUID'}); + out1 = ne(aa, at1); + out2 = ne(aa, at1, pl); + out3 = ne(aa, at1, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + if out3 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_noisegen1D.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_noisegen1D.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,857 @@ +% UTP_AO_noisegen1D a set of UTPs for the ao/noisegen1D method +% +% L Ferraioli 16-02-09 +% +% $Id: utp_ao_noisegen1D.m,v 1.13 2010/05/03 18:07:42 luigi Exp $ +% + +% +% +% The noisegen1D method of the ao class computes the noisegen1Dolute value of the y +% and/or x data. +% +% + +function results = utp_ao_noisegen1D(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'noisegen1D'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs +% [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + [PSD,a1,a2,a3,a4,a5,av,am,plstd,plstd2] = get_test_obj_ao_noisegen1D(); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % add useful params to standard exceptions + ple3 = plist('Exceptions', {'history', 'created', 'UUID', 'param/desc', 'name', 'procinfo'}); + +% % ---- Building fsdata model objects +% pl_mod1 = plist('fsfcn', '0.01./(0.01+f)', 'f1', 1e-6, 'f2', 5, 'nf', 100); +% mod1 = ao(pl_mod1); +% % ---- Building white noise test data +% fs = 10; +% a1 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', 100)); +% a2 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', 100)); +% a3 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', 100)); +% a4 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', 100)); +% a5 = ao(plist('tsfcn', 'randn(size(t)).''', 'fs', fs, 'nsecs', 100)); +% av = [a1 a2 a3]; +% am = [a1 a2; a3 a4]; +% % ---- Building standard plist +% plstd = plist(... +% 'model', mod1, ... +% 'MaxIter', 30, ... +% 'PoleType', 2, ... +% 'MinOrder', 10, ... +% 'MaxOrder', 20, ... +% 'Weights', 2, ... +% 'Plot', false,... +% 'Disp', false,... +% 'RMSEVar', 5,... +% 'FitTolerance', 2); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input, set 'Default' + results = [results utp_03]; % Matrix input, set 'Default' + results = [results utp_04]; % List input, set 'Default' + results = [results utp_05]; % Test with mixed input, set 'Default' + results = [results utp_06]; % Test history is working, set 'Default' + results = [results utp_07]; % Test the modify call works, set 'Default' + results = [results utp_08]; % Test input data shape == output data shape, set 'Default' + results = [results utp_09]; % Test output of the data, set 'Default' + results = [results utp_10]; % Test history is working, set 'filter' + results = [results utp_11]; % Test the modify call works, set 'filter' + results = [results utp_12]; % Test output of the data, set 'Filter' + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 11, atest = false; end + % Check key + if ~io(3).plists.isparam('yunits'), atest = false; end + if ~io(3).plists.isparam('model'), atest = false; end + if ~io(3).plists.isparam('maxiter'), atest = false; end + if ~io(3).plists.isparam('poletype'), atest = false; end + if ~io(3).plists.isparam('minorder'), atest = false; end + if ~io(3).plists.isparam('maxorder'), atest = false; end + if ~io(3).plists.isparam('weights'), atest = false; end + if ~io(3).plists.isparam('plot'), atest = false; end + if ~io(3).plists.isparam('disp'), atest = false; end + if ~io(3).plists.isparam('msevartol'), atest = false; end + if ~io(3).plists.isparam('fittol'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('yunits'), ''), atest = false; end + if ~isEmptyDouble(io(3).plists.find('model')), atest = false; end + if ~isequal(io(3).plists.find('maxiter'), 30), atest = false; end + if ~isequal(io(3).plists.find('poletype'), 3), atest = false; end + if ~isequal(io(3).plists.find('minorder'), 2), atest = false; end + if ~isequal(io(3).plists.find('maxorder'), 25), atest = false; end + if ~isequal(io(3).plists.find('weights'), 3), atest = false; end + if ~isequal(io(3).plists.find('plot'), false), atest = false; end + if ~isequal(io(3).plists.find('disp'), false), atest = false; end + if ~isequal(io(3).plists.find('msevartol'), .01), atest = false; end + if ~isequal(io(3).plists.find('fittol'), .01), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('yunits'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('model'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('maxiter'), {30}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('poletype'), {1 2 3}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('minorder'), {2}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('maxorder'), {25}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('weights'), {3}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('plot'), {false, true}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('disp'), {false, true}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('msevartol'), {.01}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('fittol'), {.01}), atest = false; end + + %%%%%%%%%% SET 'Filter' + if io(4).plists.nparams ~= 12, atest = false; end + % Check key + if ~io(4).plists.isparam('fs'), atest = false; end + if ~io(4).plists.isparam('Iunits'), atest = false; end + if ~io(4).plists.isparam('Ounits'), atest = false; end + if ~io(4).plists.isparam('maxiter'), atest = false; end + if ~io(4).plists.isparam('poletype'), atest = false; end + if ~io(4).plists.isparam('minorder'), atest = false; end + if ~io(4).plists.isparam('maxorder'), atest = false; end + if ~io(4).plists.isparam('weights'), atest = false; end + if ~io(4).plists.isparam('plot'), atest = false; end + if ~io(4).plists.isparam('disp'), atest = false; end + if ~io(4).plists.isparam('msevartol'), atest = false; end + if ~io(4).plists.isparam('fittol'), atest = false; end + % Check default value + if ~isequal(io(4).plists.find('fs'), 1), atest = false; end + if ~isequal(io(4).plists.find('Iunits'), ''), atest = false; end + if ~isequal(io(4).plists.find('Ounits'), ''), atest = false; end + if ~isequal(io(4).plists.find('maxiter'), 30), atest = false; end + if ~isequal(io(4).plists.find('poletype'), 3), atest = false; end + if ~isequal(io(4).plists.find('minorder'), 2), atest = false; end + if ~isequal(io(4).plists.find('maxorder'), 25), atest = false; end + if ~isequal(io(4).plists.find('weights'), 3), atest = false; end + if ~isequal(io(4).plists.find('plot'), false), atest = false; end + if ~isequal(io(4).plists.find('disp'), false), atest = false; end + if ~isequal(io(4).plists.find('msevartol'), .01), atest = false; end + if ~isequal(io(4).plists.find('fittol'), .01), atest = false; end + % Check options + if ~isequal(io(4).plists.getOptionsForParam('fs'), {1}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('Iunits'), {[]}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('Ounits'), {[]}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('maxiter'), {30}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('poletype'), {1 2 3}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('minorder'), {2}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('maxorder'), {25}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('weights'), {3}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('plot'), {false, true}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('disp'), {false, true}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('msevartol'), {.01}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('fittol'), {.01}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the noisegen1D method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the noisegen1D method works for a vector of AOs as input. + % + % + + try + % + out = noisegen1D(av, plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'av' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(av)), atest = false; end + % Check each output against the absolute value of the input + for kk=1:numel(out) + % Check the whiten ao(tsdata) objects + if isa(out(kk).data, 'tsdata') + used_filt = out(kk).procinfo.find('filter'); + obj = av(kk).filter(used_filt); + if ~eq(out(kk), obj, ple3), atest = false; end + else + % Check the other objects (they must be the same) + if ~eq(out(kk), av(kk), ple1), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the noisegen1D method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the noisegen1D method works for a matrix of AOs as input. + % + % + + try + % + out = noisegen1D(am, plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(am)), atest = false; end + % Check each output against the absolute value of the input + for kk=1:numel(out) + % Check the whiten ao(tsdata) objects + if isa(out(kk).data, 'tsdata') + used_filt = out(kk).procinfo.find('filter'); + obj = am(kk).filter(used_filt); + if ~eq(out(kk), obj, ple3), atest = false; end + else + % Check the other objects (they must be the same) + if ~eq(out(kk), am(kk), ple1), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the noisegen1D method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the noisegen1D method works for a list of AOs as input. + % + % + + try + % + out = noisegen1D(a1,a2,a3,plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [a1,a2,a3]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(aoin)), atest = false; end + % Check each output against the absolute value of the input + for kk=1:numel(out) + % Check the whiten ao(tsdata) objects + if isa(out(kk).data, 'tsdata') + used_filt = out(kk).procinfo.find('filter'); + obj = aoin(kk).filter(used_filt); + if ~eq(out(kk), obj, ple3), atest = false; end + else + % Check the other objects (they must be the same) + if ~eq(out(kk), aoin(kk), ple1), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the noisegen1D method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the noisegen1D method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = noisegen1D(a5,[a1 a3],[a1 a2; a3 a4],plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [a5,reshape([a1 a3],1,[]),reshape([a1 a2; a3 a4],1,[])]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(aoin)), atest = false; end + % Check each output against the absolute value of the input + for kk=1:numel(out) + % Check the whiten ao(tsdata) objects + if isa(out(kk).data, 'tsdata') + used_filt = out(kk).procinfo.find('filter'); + obj = aoin(kk).filter(used_filt); + if ~eq(out(kk), obj, ple3), atest = false; end + else + % Check the other objects (they must be the same) + if ~eq(out(kk), aoin(kk), ple1), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the noisegen1D method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the noisegen1D method can be processed back. + % + % + + try + % + out = noisegen1D(a1,plstd); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'noisegen1D'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'noisegen1D'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the noisegen1D method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the noisegen1D method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + amodi = ao(a1); + aeq = ao(a1); + out = aeq.noisegen1D(plstd); + amodi.noisegen1D(plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'out' and 'aeq' are now different. + % 2) Check that 'aeq' is not changed + % 3) Check that the modified input is changed + % + % + + atest = true; + if stest + % + % Check that 'out' and 'aeq' are now different. + if eq(out, aeq, ple2), atest = false; end + % Check that 'aeq' is not changed + if ~eq(aeq, ao(a1), ple1), atest = false; end + % Check that the modified input is changed + used_filt = amodi.procinfo.find('filter'); + ref = a1.filter(used_filt); + if ~eq(ref, amodi, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the noisegen1D method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = noisegen1D(a4,plstd); + out2 = noisegen1D(a5,plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.x) ~= size(a4.data.x), atest = false; end + if size(out1.data.y) ~= size(a4.data.y), atest = false; end + if size(out2.data.x) ~= size(a5.data.x), atest = false; end + if size(out2.data.y) ~= size(a5.data.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the noisegen1D method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = noisegen1D(a1, a2, plstd); + o3 = noisegen1D(a1, a2, plstd); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + o31 = o3.index(1); + o32 = o3.index(2); + mout31 = rebuild(o31); + mout32 = rebuild(o32); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o31, mout31, ple2), atest = false; end + if ~eq(o32, mout32, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +%% UTP_10 + + % + % + % Tests that the noisegen1D method properly applies history for set filter. + % + % + function result = utp_10 + + % + % + % Test that the result of applying the noisegen1D method can be processed back. + % + % + + try + % + out = noisegen1D(PSD,plstd2); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'noisegen1D'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'noisegen1D'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +%% UTP_10 + + % + % + % Tests that the noisegen1D method can modify the input AO for set 'filter'. + % + % + function result = utp_11 + + % + % + % Test that the noisegen1D method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + amodi = ao(PSD); + aeq = ao(PSD); + out = aeq.noisegen1D(plstd2); + amodi.noisegen1D(plstd2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'out' and 'aeq' are now different. + % 2) Check that 'aeq' is not changed + % + % + + atest = true; + if stest + % + % Check that 'out' and 'aeq' are now different. + if eq(out, aeq, ple2), atest = false; end + % Check that 'aeq' is not changed + if ~eq(aeq, ao(PSD), ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_11 + +%% UTP_12 + + % + % + % Check that the noisegen1D method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_12 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = noisegen1D(PSD, PSD, plstd2); + o3 = noisegen1D(PSD, PSD, plstd2); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + o31 = o3.index(1); + o32 = o3.index(2); + mout31 = rebuild(o31); + mout32 = rebuild(o32); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o31, mout31, ple2), atest = false; end + if ~eq(o32, mout32, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_noisegen2D.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_noisegen2D.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,797 @@ +% UTP_AO_noisegen2D a set of UTPs for the ao/noisegen2D method +% +% L Ferraioli 02-02-09 +% +% $Id: utp_ao_noisegen2D.m,v 1.12 2010/06/24 13:28:17 ingo Exp $ +% + +% +% +% The whiten1D method of the ao class computes the whiten1Dolute value of the y +% and/or x data. +% +% + +function results = utp_ao_noisegen2D(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'noisegen2D'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [CSD,TF,a1,a2,a3,a4,a5,a6,av,am,plstd,plstd2] = get_test_obj_ao_noisegen2D(); + csd11 = CSD(1,1); + csd12 = CSD(1,2); + csd22 = CSD(2,2); + % -------------------------------------------------------------------- + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % add useful params to standard exceptions + ple3 = plist('Exceptions', {'history', 'created', 'UUID', 'param/desc', 'name', 'procinfo'}); + + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working, set 'Default' + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test history is working, set 'Filter' + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 15, atest = false; end + % Check key + if ~io(3).plists.isparam('csd11'), atest = false; end + if ~io(3).plists.isparam('csd12'), atest = false; end + if ~io(3).plists.isparam('csd21'), atest = false; end + if ~io(3).plists.isparam('csd22'), atest = false; end + if ~io(3).plists.isparam('yunits'), atest = false; end + if ~io(3).plists.isparam('maxiter'), atest = false; end + if ~io(3).plists.isparam('poletype'), atest = false; end + if ~io(3).plists.isparam('minorder'), atest = false; end + if ~io(3).plists.isparam('maxorder'), atest = false; end + if ~io(3).plists.isparam('weights'), atest = false; end + if ~io(3).plists.isparam('plot'), atest = false; end + if ~io(3).plists.isparam('disp'), atest = false; end + if ~io(3).plists.isparam('msevartol'), atest = false; end + if ~io(3).plists.isparam('fittol'), atest = false; end + if ~io(3).plists.isparam('usesym'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('csd11')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('csd12')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('csd21')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('csd22')), atest = false; end + if ~isequal(io(3).plists.find('yunits'), {'',''}), atest = false; end + if ~isequal(io(3).plists.find('maxiter'), 30), atest = false; end + if ~isequal(io(3).plists.find('poletype'), 3), atest = false; end + if ~isequal(io(3).plists.find('minorder'), 2), atest = false; end + if ~isequal(io(3).plists.find('maxorder'), 25), atest = false; end + if ~isequal(io(3).plists.find('weights'), 3), atest = false; end + if ~isequal(io(3).plists.find('plot'), false), atest = false; end + if ~isequal(io(3).plists.find('disp'), false), atest = false; end + if ~isequal(io(3).plists.find('msevartol'), .01), atest = false; end + if ~isequal(io(3).plists.find('fittol'), .01), atest = false; end + if ~isequal(io(3).plists.find('usesym'), 0), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('csd11'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('csd12'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('csd21'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('csd22'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('yunits'), {{'',''}}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('maxiter'), {30}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('poletype'), {1 2 3}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('minorder'), {2}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('maxorder'), {25}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('weights'), {3}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('plot'), {false, true}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('disp'), {false, true}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('msevartol'), {.01}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('fittol'), {.01}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('usesym'), {0 1 2}), atest = false; end + + %%%%%%%%%% SET 'Default' + if io(4).plists.nparams ~= 13, atest = false; end + % Check key + if ~io(4).plists.isparam('fs'), atest = false; end + if ~io(4).plists.isparam('Iunits'), atest = false; end + if ~io(4).plists.isparam('Ounits'), atest = false; end + if ~io(4).plists.isparam('maxiter'), atest = false; end + if ~io(4).plists.isparam('poletype'), atest = false; end + if ~io(4).plists.isparam('minorder'), atest = false; end + if ~io(4).plists.isparam('maxorder'), atest = false; end + if ~io(4).plists.isparam('weights'), atest = false; end + if ~io(4).plists.isparam('plot'), atest = false; end + if ~io(4).plists.isparam('disp'), atest = false; end + if ~io(4).plists.isparam('msevartol'), atest = false; end + if ~io(4).plists.isparam('fittol'), atest = false; end + if ~io(4).plists.isparam('usesym'), atest = false; end + % Check default value + if ~isequal(io(4).plists.find('fs'), 1), atest = false; end + if ~isequal(io(4).plists.find('Iunits'), ''), atest = false; end + if ~isequal(io(4).plists.find('Ounits'), ''), atest = false; end + if ~isequal(io(4).plists.find('maxiter'), 30), atest = false; end + if ~isequal(io(4).plists.find('poletype'), 3), atest = false; end + if ~isequal(io(4).plists.find('minorder'), 2), atest = false; end + if ~isequal(io(4).plists.find('maxorder'), 25), atest = false; end + if ~isequal(io(4).plists.find('weights'), 3), atest = false; end + if ~isequal(io(4).plists.find('plot'), false), atest = false; end + if ~isequal(io(4).plists.find('disp'), false), atest = false; end + if ~isequal(io(4).plists.find('msevartol'), .01), atest = false; end + if ~isequal(io(4).plists.find('fittol'), .01), atest = false; end + if ~isequal(io(4).plists.find('usesym'), 0), atest = false; end + % Check options + if ~isequal(io(4).plists.getOptionsForParam('fs'), {1}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('Iunits'), {[]}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('Ounits'), {[]}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('maxiter'), {30}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('poletype'), {1 2 3}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('minorder'), {2}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('maxorder'), {25}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('weights'), {3}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('plot'), {false, true}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('disp'), {false, true}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('msevartol'), {.01}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('fittol'), {.01}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('usesym'), {0 1 2}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the noisegen2D method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the noisegen2D method works for a vector of AOs as input. + % + % + + try + % + % Building data vector + + out = noisegen2D(av, plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'acv2' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(av)), atest = false; end + % Check each output against the absolute value of the input + + for kk=1:numel(out) + clear used_filt11 used_filt12 used_filt21 used_filt22 + % Check the noisegen ao(tsdata) objects + if isa(out(kk).data, 'tsdata') + if isa(out(kk).procinfo, 'plist') + used_filt11 = out(kk).procinfo.find('Filt11'); + used_filt12 = out(kk).procinfo.find('Filt12'); + used_filt21 = out(kk).procinfo.find('Filt21'); + used_filt22 = out(kk).procinfo.find('Filt22'); + if isa(used_filt11,'miir') && isa(used_filt12,'miir') + obj = filter(av(kk),used_filt11)+filter(av(kk+1),used_filt12); + if ~eq(out(kk), obj, ple3), atest = false; end + elseif isa(used_filt21,'miir') && isa(used_filt22,'miir') + obj = av(kk-1).filter(used_filt21)+av(kk).filter(used_filt22); + if ~eq(out(kk), obj, ple3), atest = false; end + end + else + % Check the last object if nargin is odd (they must be the same) + if ~eq(out(kk), av(kk), ple1), atest = false; end + end + else + % Check the other objects (they must be the same) + if ~eq(out(kk), av(kk), ple1), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the noisegen2D method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the noisegen2D method works for a matrix of AOs as input. + % + % + + try + % + out = noisegen2D(am,plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(am)), atest = false; end + % Check each output against the absolute value of the input + for kk=1:numel(out) + clear used_filt11 used_filt12 used_filt21 used_filt22 + % Check the whiten ao(tsdata) objects + if isa(out(kk).data, 'tsdata') + if isa(out(kk).procinfo, 'plist') + used_filt11 = out(kk).procinfo.find('Filt11'); + used_filt12 = out(kk).procinfo.find('Filt12'); + used_filt21 = out(kk).procinfo.find('Filt21'); + used_filt22 = out(kk).procinfo.find('Filt22'); + if isa(used_filt11,'miir') && isa(used_filt12,'miir') + obj = filter(am(kk),used_filt11)+filter(am(kk+1),used_filt12); + if ~eq(out(kk), obj, ple3), atest = false; end + elseif isa(used_filt21,'miir') && isa(used_filt22,'miir') + obj = filter(am(kk-1),used_filt21)+filter(am(kk),used_filt22); + if ~eq(out(kk), obj, ple3), atest = false; end + end + else + % Check the last object if nargin is odd (they must be the same) + if ~eq(out(kk), am(kk), ple1), atest = false; end + end + else + % Check the other objects (they must be the same) + if ~eq(out(kk), am(kk), ple1), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the noisegen2D method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the noisegen2D method works for a list of AOs as input. + % + % + + try + % + out = noisegen2D(a1,a2,plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + acv2 = [a1,a2]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(acv2)), atest = false; end + % Check each output against the absolute value of the input + for kk=1:numel(out) + clear used_filt11 used_filt12 used_filt21 used_filt22 + % Check the whiten ao(tsdata) objects + if isa(out(kk).data, 'tsdata') + if isa(out(kk).procinfo, 'plist') + used_filt11 = out(kk).procinfo.find('Filt11'); + used_filt12 = out(kk).procinfo.find('Filt12'); + used_filt21 = out(kk).procinfo.find('Filt21'); + used_filt22 = out(kk).procinfo.find('Filt22'); + if isa(used_filt11,'miir') && isa(used_filt12,'miir') + obj = filter(acv2(kk),used_filt11)+filter(acv2(kk+1),used_filt12); + if ~eq(out(kk), obj, ple3), atest = false; end + elseif isa(used_filt21,'miir') && isa(used_filt22,'miir') + obj = filter(acv2(kk-1),used_filt21)+filter(acv2(kk),used_filt22); + if ~eq(out(kk), obj, ple3), atest = false; end + end + else + % Check the last object if nargin is odd (they must be the same) + if ~eq(out(kk), acv2(kk), ple1), atest = false; end + end + else + % Check the other objects (they must be the same) + if ~eq(out(kk), acv2(kk), ple1), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the noisegen2D method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the whiten1D method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + % [1,reshape([2 3],1,[]),reshape([4 6; 5 7],1,[])]; + out = noisegen2D(a1,[a2 a3],[a4 a2; a1 a3],plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [a1,reshape([a2 a3],1,[]),reshape([a4 a2; a1 a3],1,[])]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(aoin)), atest = false; end + % Check each output against the absolute value of the input + for kk=1:numel(out) + clear used_filt11 used_filt12 used_filt21 used_filt22 + % Check the whiten ao(tsdata) objects + if isa(out(kk).data, 'tsdata') + if isa(out(kk).procinfo, 'plist') + used_filt11 = out(kk).procinfo.find('Filt11'); + used_filt12 = out(kk).procinfo.find('Filt12'); + used_filt21 = out(kk).procinfo.find('Filt21'); + used_filt22 = out(kk).procinfo.find('Filt22'); + if isa(used_filt11,'miir') && isa(used_filt12,'miir') + obj = filter(aoin(kk),used_filt11)+filter(aoin(kk+1),used_filt12); + if ~eq(out(kk), obj, ple3), atest = false; end + elseif isa(used_filt21,'miir') && isa(used_filt22,'miir') + obj = filter(aoin(kk-1),used_filt21)+filter(aoin(kk),used_filt22); + if ~eq(out(kk), obj, ple3), atest = false; end + end + else + % Check the last object if nargin is odd (they must be the same) + if ~eq(out(kk), aoin(kk), ple1), atest = false; end + end + else + % Check the other objects (they must be the same) + if ~eq(out(kk), aoin(kk), ple1), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the noisegen2D method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the noisegen2D method can be processed back. + % + % + + try + % + out = noisegen2D(av,plstd); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'noisegen2D'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the objects which are changed by 'noisegen2D' + for kk = 1:2 + % Check the last step in the history of 'out' + if ~strcmp(out(kk).hist.methodInfo.mname, 'noisegen2D'), atest = false; end + % Check the re-built object + if ~eq(mout(kk), out(kk), ple2), atest = false; end + end + % Check the unchanged object (the last one) + if ~eq(av(3), out(3), ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % The noisegen2D method can not modify the input AO. + % + % + function result = utp_07 + + % + % + % The noisegen2D method can not modify the input AO. + % + % + + try + % + amodi = [ao(a1) ao(a2)]; + aeq = [ao(a1) ao(a2)]; + amodi.noisegen2D(plstd); + out = aeq.noisegen2D(plstd); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to do. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the noisegen2D method keeps the data shape of the input object. The + % input AO must be a couple AO with row data and a couple AO with column data. + % + % + + try + % + out = noisegen2D(a3,a4,a5,a6,plstd); + out1 = out(1); + out2 = out(2); + out3 = out(3); + out4 = out(4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.x) ~= size(a3.data.x), atest = false; end + if size(out1.data.y) ~= size(a3.data.y), atest = false; end + if size(out2.data.x) ~= size(a4.data.x), atest = false; end + if size(out2.data.y) ~= size(a4.data.y), atest = false; end + if size(out3.data.x) ~= size(a5.data.x), atest = false; end + if size(out3.data.y) ~= size(a5.data.y), atest = false; end + if size(out4.data.x) ~= size(a6.data.x), atest = false; end + if size(out4.data.y) ~= size(a6.data.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the noisegen2D method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1,o2] = noisegen2D(a1,a2,plstd); + o3 = noisegen2D(a1,a2,plstd); + o31 = o3.index(1); + o32 = o3.index(2); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout31 = rebuild(o31); + mout32 = rebuild(o32); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o31, mout31, ple2), atest = false; end + if ~eq(o32, mout32, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +%% UTP_10 + + % + % + % Tests that the noisegen2D method properly applies history. + % + % + function result = utp_10 + + % + % + % Test that the result of applying the noisegen2D method can be processed back. + % + % + + try + % + out = noisegen2D(csd11,csd12,csd22,plstd2); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'noisegen2D'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the objects which are changed by 'noisegen2D' + + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'noisegen2D'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_norm.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_norm.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,565 @@ +% UTP_AO_NORM a set of UTPs for the ao/norm method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_norm.m,v 1.8 2011/04/17 10:47:22 hewitson Exp $ +% + +% +% +% The norm method of the ao class computes the norm of the y data. +% +% + +function results = utp_ao_norm(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'norm'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with additional plist with the key 'axis' + results = [results utp_09]; % Test input data shape == output data shape + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the norm method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the norm method works for a vector of AOs as input. + % + % + + try + % + atvec = [at4, at4, at4]; + out = norm(atvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check each output against the norm of the input + for kk=1:numel(out) + if ~isequal(norm(atvec(kk).data.getY), out(kk).data.getY) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the norm method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the norm method works for a matrix of AOs as input. + % + % + + try + % + atmat = [at4 at4 at4; at4 at4 at4]; + out = norm(atmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check each output against the norm of the input + for kk=1:numel(out) + if ~isequal(norm(atmat(kk).data.getY), out(kk).data.getY) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the norm method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the norm method works for a list of AOs as input. + % + % + + try + % + out = norm(at4, at4, at4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the norm of the input + if ~isequal(norm(at4.data.getY), out(1).data.getY), atest = false; end + if ~isequal(norm(at4.data.getY), out(2).data.getY), atest = false; end + if ~isequal(norm(at4.data.getY), out(3).data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the norm method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the norm method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + atmat = [at4 at4; at4 at4]; + atvec = [at4 at4]; + out = norm(at4,atvec,at4,atmat,at4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(atmat)+numel(atvec)), atest = false; end + % Check the first input + nout = 1; + if ~isequal(norm(at4.data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + % Check the elements of the input vector + for jj=1:numel(atvec) + if ~isequal(norm(atvec(jj).data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + end + % Check the 3rd input + if ~isequal(norm(at4.data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + % Check the elements of the input matrix + for jj=1:numel(atmat) + if ~isequal(norm(atmat(jj).data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + end + % Check the last input + if ~isequal(norm(at4.data.getY), out(nout).data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the norm method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the norm method can be processed back + % to an m-file. + % + % + + try + % + out = norm(at4); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'norm'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'norm'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the norm method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the norm method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at4 to work with + ain = ao(at4); + % modify ain + aout = ain.norm(); + ain.norm(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at4' and 'ain' are now different. + % 2) Check that 'ain' is norm(at4). + % + % + + atest = true; + if stest + % + % Check that norm modified the input by comparing to the copy + if eq(ao(at4), ain, ple1), atest = false; end + % Check that norm doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the norm value of the copy + if ~isequal(norm(at4.data.getY), ain.data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the norm method can modify the single axis controlled by the + % plist and the resuld can be processed back to an m-file. + % + % + + try + % + pl2 = plist('option', 2); + pl1 = plist('option', 1); + plinf = plist('option', inf); + plfro = plist('option', 'fro'); + out1 = norm(at4, pl2); + out2 = norm(at4, pl1); + out3 = norm(at4, plinf); + out4 = norm(at4, plfro); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the norm method applies with different options + % 2) Check that the re-built objects are the same object as 'out[1..4]'. + % + % + + atest = true; + if stest + % + % Check each output against the norm of the input + if ~isequal(norm(at4.data.getY, 2), out1.data.getY), atest = false; end + if ~isequal(norm(at4.data.getY, 1), out2.data.getY), atest = false; end + if ~isequal(norm(at4.data.getY, inf), out3.data.getY), atest = false; end + if ~isequal(norm(at4.data.getY, 'fro'), out4.data.getY), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + if ~eq(mout4, out4, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Control the method with a plist. + % + % + function result = utp_09 + + % + % + % Test that the norm method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = norm(at4); + out2 = norm(at4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y) ~= size(norm(at4.data.y)), atest = false; end + if size(out2.data.y) ~= size(norm(at4.data.y)), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_offset.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_offset.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,613 @@ +% UTP_AO_OFFSET a set of UTPs for the ao/offset method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_offset.m,v 1.6 2010/06/07 16:43:06 ingo Exp $ +% + +% +% +% The offset method of the ao class adds an offset to the y-data in the AO. +% +% + +function results = utp_ao_offset(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'offset'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with additional plist(offset) + results = [results utp_09]; % Test input data shape == output data shape + results = [results utp_10]; % Test output of the data + results = [results utp_11(mthd, at1, ple1, plist('offset', 1))]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('offset'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('offset')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('offset'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the offset method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the offset method works for a vector of AOs as input. + % + % + + try + % + off = 5; + out = offset(atvec, off); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check that each output added the offset to the y-values + for kk=1:numel(out) + if ~isequal(atvec(kk).y+off, out(kk).y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the offset method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the offset method works for a matrix of AOs as input. + % + % + + try + % + off = 4.3; + out = offset(atmat, off); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check that each output added the offset to the y-values + for kk=1:numel(out) + if ~isequal(atmat(kk).y+off, out(kk).y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the offset method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the offset method works for a list of AOs as input. + % + % + + try + % + off = 2-3i; + out = offset(at1,at2,at3, off); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1,at2,at3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check that each output added the offset to the y-values + for kk=1:numel(out) + if ~isequal(aoin(kk).y+off, out(kk).y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the offset method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the offset method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + off = 7; + out = offset(at1,atvec,at2,atmat,at3, off); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1,reshape(atvec,1,[]),at2,reshape(atmat,1,[]),at3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(aoin), atest = false; end + % Check that each output added the offset to the y-values + for kk=1:numel(out) + if ~isequal(aoin(kk).y+off, out(kk).y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the offset method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the offset method can be processed back. + % + % + + try + % + off = 1; + out1 = offset(at1, off); + out2 = offset(at1, plist('offset', off)); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'offset'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'offset'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'offset'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the offset method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the offset method can modify the input AO by calling with + % no output and that the method doesn't change the input of the + % function notation (with a equal sign). + % + % + + try + % + off = 3; + amodi = ao(at1); + aeq = ao(at1); + out = aeq.offset(off); + amodi.offset(off); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'out' and 'aeq' are now different. + % 2) Check that 'aeq' is not changed + % 3) Check that the modified have an offset of 3 + % 4) Check that out and amodi are the same + % + % + + atest = true; + if stest + % + % Check that 'out' and 'aeq' are now different. + if eq(out, aeq, ple2), atest = false; end + % Check that 'aeq' is not changed + if ~eq(aeq, ao(at1), ple1), atest = false; end + % Check that the modified have an offset of 3 + if ~isequal(at1.y+off, amodi.y), atest = false; end + % Check that out and amodi are the same + if ~eq(out, amodi, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test that the offset method uses the offset in a plist. + % + % + function result = utp_08 + + % + % + % Test that the offset method uses the offset in a plist. + % + % + + try + % + out = offset(at1, plist('offset', 3.3)); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the offset uses the offset in the plist + % 2) Check that the re-built object is the same as 'out' + % + % + + atest = true; + if stest + % + % Check the output + if ~isequal(at1.y+3.3, out.y), atest = false; end + % Check the re-built objects + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test the shape of the output. + % + % + function result = utp_09 + + % + % + % Test that the offset method keeps the data shape of the input object. + % The input AO must be an AO with row data and an AO with column data. + % + % + + try + % + off = -3; + out1 = abs(at5, off); + out2 = abs(at6, off); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,1) == 1, atest = false; end + if size(out2.data.y,2) == 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the offset method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_10 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + off = -8; + [o1, o2] = offset(at5, at6, off); + o3 = offset(at5, at6, off); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_or.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_or.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,125 @@ +% UTP_AO_OR a set of UTPs for the ao/or method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_or.m,v 1.1 2010/09/23 19:48:49 ingo Exp $ +% + +% +% +% The OR method of the ao class performs a logical OR of the y data of +% the two inputs. +% +% + +function results = utp_ao_or(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'or'; + + results = []; + disp('******************************************************'); + disp('**** Running UTPs for ao/or'); + disp('******************************************************'); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_generic_aop_rule1(@or)]; % Rule 1 + results = [results utp_generic_aop_rule2(@or)]; % Rule 2 + results = [results utp_generic_aop_rule3(@or)]; % Rule 3 + results = [results utp_generic_aop_rule4(@or)]; % Rule 4 + results = [results utp_generic_aop_rule5(@or)]; % Rule 5 + results = [results utp_generic_aop_rule6(@or)]; % Rule 6 + results = [results utp_generic_aop_rule7(@or)]; % Rule 7 + results = [results utp_generic_aop_rule8(@or)]; % Rule 8 + results = [results utp_generic_aop_rule9(@or)]; % Rule 9 + results = [results utp_generic_aop_rule10(@or)]; % Rule 10 + results = [results utp_generic_aop_rule11(@or)]; % Rule 11 + results = [results utp_generic_aop_negative_tests(@or)]; % Negative tests + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_phase.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_phase.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,633 @@ +% UTP_AO_PHASE a set of UTPs for the ao/phase method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_phase.m,v 1.14 2011/04/17 10:47:12 hewitson Exp $ +% + +% +% +% The phase method of the ao class computes the phase of the y +% and/or x data. +% +% + +function results = utp_ao_phase(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'phase'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, plist('neval', true), ple2)]; % Test the modify call works + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at1, at2, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(utils.math.phase(in.data.getY), out.data.getY) + atest = false; + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +% %% UTP_02 +% +% % +% % +% % Tests that the phase method works with a vector of AOs as input. +% % +% % +% function result = utp_02 +% +% % +% % +% % Test that the phase method works for a vector of AOs as input. +% % +% % +% +% try +% % +% out = phase(atvec); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the number of elements in 'out' is the same as in 'atvec' +% % 2) Check that each output AO contains the correct data. +% % +% % +% +% atest = true; +% if stest +% % +% % Check we have the correct number of outputs +% if ~isequal(size(out), size(atvec)), atest = false; end +% % Check each output against the phase of the input +% for kk=1:numel(out) +% if ~isequal(utils.math.phase(atvec(kk).data.getY), out(kk).data.getY) +% atest = false; +% break; +% end +% end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_02 +% +% %% UTP_03 +% +% % +% % +% % Tests that the phase method works with a matrix of AOs as input. +% % +% % +% function result = utp_03 +% +% % +% % +% % Test that the phase method works for a matrix of AOs as input. +% % +% % +% +% try +% % +% out = phase(atmat); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the number of elements in 'out' is the same as in 'atmat' +% % 2) Check that each output AO contains the correct data. +% % +% % +% +% atest = true; +% if stest +% % +% % Check we have the correct number of outputs +% if ~isequal(size(out), size(atmat)), atest = false; end +% % Check each output against the phase of the input +% for kk=1:numel(out) +% if ~isequal(utils.math.phase(atmat(kk).data.getY), out(kk).data.getY) +% atest = false; +% break; +% end +% end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_03 +% +% %% UTP_04 +% +% % +% % +% % Tests that the phase method works with a list of AOs as input. +% % +% % +% function result = utp_04 +% +% % +% % +% % Test that the phase method works for a list of AOs as input. +% % +% % +% +% try +% % +% out = phase(at1,at2,at3); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the number of elements in 'out' is the same as in +% % input. +% % 2) Check that each output AO contains the correct data. +% % +% % +% +% atest = true; +% if stest +% % +% % Check we have the correct number of outputs +% if numel(out) ~= 3, atest = false; end +% % Check each output against the phase of the input +% if ~isequal(utils.math.phase(at1.data.getY), out(1).data.getY), atest = false; end +% if ~isequal(utils.math.phase(at2.data.getY), out(2).data.getY), atest = false; end +% if ~isequal(utils.math.phase(at3.data.getY), out(3).data.getY), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_04 +% +% %% UTP_05 +% +% % +% % +% % Tests that the phase method works with a mix of different shaped AOs as +% % input. +% % +% % +% function result = utp_05 +% +% % +% % +% % Test that the phase method works with an input of matrices and vectors +% % and single AOs. +% % +% % +% +% try +% % +% out = phase(at1,atvec,at2,atmat,at3); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the number of elements in 'out' is the same as in +% % input. +% % 2) Check that each output AO contains the correct data. +% % +% % +% +% atest = true; +% if stest +% % +% % Check we have the correct number of outputs +% if numel(out) ~= (3+numel(atmat)+numel(atvec)), atest = false; end +% % Check the first input +% nout = 1; +% if ~isequal(utils.math.phase(at1.data.getY), out(nout).data.getY), atest = false; end +% nout = nout+1; +% % Check the elements of the input vector +% for jj=1:numel(atvec) +% if ~isequal(utils.math.phase(atvec(jj).data.getY), out(nout).data.getY), atest = false; end +% nout = nout+1; +% end +% % Check the 3rd input +% if ~isequal(utils.math.phase(at2.data.getY), out(nout).data.getY), atest = false; end +% nout = nout+1; +% % Check the elements of the input matrix +% for jj=1:numel(atmat) +% if ~isequal(utils.math.phase(atmat(jj).data.getY), out(nout).data.getY), atest = false; end +% nout = nout+1; +% end +% % Check the last input +% if ~isequal(utils.math.phase(at3.data.getY), out(nout).data.getY), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_05 +% +% %% UTP_06 +% +% % +% % +% % Tests that the phase method properly applies history. +% % +% % +% function result = utp_06 +% +% % +% % +% % Test that the result of applying the phase method can be processed back +% % to an m-file. +% % +% % +% +% try +% % +% out = phase(at1); +% mout = rebuild(out); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the last entry in the history of 'out' corresponds to +% % 'phase'. +% % 2) Check that the re-built object is the same object as 'out'. +% % +% % +% +% atest = true; +% if stest +% % +% % Check the last step in the history of 'out' +% if ~strcmp(out.hist.methodInfo.mname, 'phase'), atest = false; end +% % Check the re-built object +% if ~eq(mout, out, ple2), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_06 +% +% %% UTP_07 +% +% % +% % +% % Tests that the phase method can modify the input AO. +% % +% % +% function result = utp_07 +% +% % +% % +% % Test that the phase method can modify the input AO by calling with no +% % output and that the method doesn't change the input of the function +% % notation (with a equal sign). +% % +% % +% +% try +% % +% % copy at1 to work with +% ain = ao(at1); +% % modify ain +% aout = ain.phase(); +% ain.phase(); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that 'at1' and 'ain' are now different. +% % 2) Check that 'ain' is phase(at1). +% % +% % +% +% atest = true; +% if stest +% % +% % Check that phase modified the input by comparing to the copy +% if eq(ao(at1), ain, ple1), atest = false; end +% % Check that phase doesn't modified the input for the function notation +% if ~eq(aout, ain, ple1), atest = false; end +% % Check that the modified input is the phase value of the copy +% if ~isequal(utils.math.phase(at1.data.getY), ain.data.getY), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_07 +% +% %% UTP_08 +% +% % +% % +% % Control the method with a plist. +% % +% % +% function result = utp_08 +% +% % +% % +% % Test that the phase method can modify the single axis controlled by the +% % plist and the resuld can be processed back to an m-file. +% % +% % +% +% try +% % +% plx = plist('axis', 'X'); +% ply = plist('axis', 'Y'); +% plxy = plist('axis', 'XY'); +% out1 = phase(at1, plx); +% out2 = phase(at1, ply); +% out3 = phase(at1, plxy); +% mout1 = rebuild(out1); +% mout2 = rebuild(out2); +% mout3 = rebuild(out3); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the phase method applies to the x-axis +% % 2) Check that the phase method applies to the y-axis +% % 3) Check that the phase method applies to both axes +% % 4) Check that the re-built objects are the same object as 'out[1..3]'. +% % +% % +% +% atest = true; +% if stest +% % +% % Check each output against the phase of the input +% if ~isequal(utils.math.phase(at1.data.getX), out1.data.getX), atest = false; end +% if ~isequal(at1.data.getY, out1.data.getY), atest = false; end +% if ~isequal(at1.data.getX, out2.data.getX), atest = false; end +% if ~isequal(utils.math.phase(at1.data.getY), out2.data.getY), atest = false; end +% if ~isequal(utils.math.phase(at1.data.getX), out3.data.getX), atest = false; end +% if ~isequal(utils.math.phase(at1.data.getY), out3.data.getY), atest = false; end +% % Check the re-built object +% if ~eq(mout1, out1, ple1), atest = false; end +% if ~eq(mout2, out2, ple1), atest = false; end +% if ~eq(mout3, out3, ple1), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_08 +% +% %% UTP_09 +% +% % +% % +% % Control the method with a plist. +% % +% % +% function result = utp_09 +% +% % +% % +% % Test that the phase method keeps the data shape of the input object. The +% % input AO must be an AO with row data and an AO with column data. +% % +% % +% +% try +% % +% out1 = phase(at5); +% out2 = phase(at6); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the shpe of the data doesn't change. +% % +% % +% +% atest = true; +% if stest +% % +% % Check the shape of the output data +% if size(out1.data.x) ~= size(at5.data.x), atest = false; end +% if size(out1.data.y) ~= size(at5.data.y), atest = false; end +% if size(out2.data.x) ~= size(at6.data.x), atest = false; end +% if size(out2.data.y) ~= size(at6.data.y), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_09 +% +% %% UTP_10 +% +% % +% % +% % Check that the phase method pass back the output objects to a list of +% % output variables or to a single variable. +% % +% % +% function result = utp_10 +% +% % +% % +% % Call the method with a list of output variables and with a single output +% % variable. Additionaly check that the rebuild method works on the output. +% % +% % +% +% try +% % +% [o1, o2] = phase(at5, at6); +% o3 = phase(at5, at6); +% mout1 = rebuild(o1); +% mout2 = rebuild(o2); +% mout3 = rebuild(o3); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the output contains the right number of objects +% % 2) Check that the 'rebuild' method produces the same object as 'out'. +% % +% % +% +% atest = true; +% if stest +% % +% % Check the number of outputs +% if numel(o1) ~=1, atest = false; end +% if numel(o2) ~=1, atest = false; end +% if numel(o3) ~=2, atest = false; end +% % Check the rebuilding of the object +% if ~eq(o1, mout1, ple2), atest = false; end +% if ~eq(o2, mout2, ple2), atest = false; end +% if ~eq(o3, mout3, ple2), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_plus.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_plus.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,125 @@ +% UTP_AO_PLUS a set of UTPs for the ao/plus method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_plus.m,v 1.12 2010/09/21 16:51:05 ingo Exp $ +% + +% +% +% The plus method of the ao class computes the sum of the y data of the two +% inputs. +% +% + +function results = utp_ao_plus(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'plus'; + + results = []; + disp('******************************************************'); + disp('**** Running UTPs for ao/plus'); + disp('******************************************************'); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_generic_aop_rule1(@plus)]; % Rule 1 + results = [results utp_generic_aop_rule2(@plus)]; % Rule 2 + results = [results utp_generic_aop_rule3(@plus)]; % Rule 3 + results = [results utp_generic_aop_rule4(@plus)]; % Rule 4 + results = [results utp_generic_aop_rule5(@plus)]; % Rule 5 + results = [results utp_generic_aop_rule6(@plus)]; % Rule 6 + results = [results utp_generic_aop_rule7(@plus)]; % Rule 7 + results = [results utp_generic_aop_rule8(@plus)]; % Rule 8 + results = [results utp_generic_aop_rule9(@plus)]; % Rule 9 + results = [results utp_generic_aop_rule10(@plus)]; % Rule 10 + results = [results utp_generic_aop_rule11(@plus)]; % Rule 11 + results = [results utp_generic_aop_negative_tests(@plus)]; % Negative tests + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_polyfit.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_polyfit.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,597 @@ +% UTP_AO_POLYFIT a set of UTPs for the ao/polyfit method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_polyfit.m,v 1.20 2010/05/05 04:20:10 mauro Exp $ +% + +% +% +% The polyfit method of the ao class fits a polynomial to the input y +% and/or x data. +% +% + +function results = utp_ao_polyfit(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'polyfit'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test that units are properly handled + results = [results utp_09]; % Test against Matlab polyfit + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('N'), atest = false; end + if ~io(3).plists.isparam('rescale'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('N'), 1), atest = false; end + if ~isequal(io(3).plists.find('rescale'), false), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('N'), {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('rescale'), {false, true}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the polyfit method fails with with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the polyfit method works with a vector of AOs as input. + % + % + + try + % + N = 2; + % Call with single output + out = polyfit(atvec, plist('N', N)); + % Call with multiple output + [out_1, out_2, out_3] = polyfit(atvec, plist('N', N)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check we have the correct number of output objects in the version with + % single output + % 2) Check we have the correct number of elements in the output objects + % + % + + atest = true; + if stest + % + % 1) Check we have the correct number of output objects in the version with + % single output + % 2) Check we have the correct number of elements in the output objects + % + % + % + if ~isequal(size(out), [1 numel(atvec)]), atest = false; end + for jj = 1:numel(out) + if ~isequal(numel(out(jj).y), N+1), atest = false; end + end + if ~isequal(numel(out_1.y), N+1), atest = false; end + if ~isequal(numel(out_2.y), N+1), atest = false; end + if ~isequal(numel(out_3.y), N+1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the polyfit method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the polyfit method works for a matrix of AOs as input. + % + % + + try + % + N = 3; + amat = [at1 at2 at5; at6 at5 at2]; + out = polyfit(amat, plist('N', N)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check we have the correct number of output objects + % + % + + atest = true; + if stest + % + if ~isequal(numel(out), numel(amat)), atest = false; end + for jj = 1:numel(out) + if ~isequal(numel(out(jj).y), N+1), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the polyfit method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the polyfit method works for a list of AOs as input. + % + % + + try + % + N = 1; + % Call with single output + out = polyfit(at5, at6, at5, plist('N', N)); + % Call with multiple output + [out_1, out_2, out_3] = polyfit(at5, at6, at5, plist('N', N)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check we have the correct number of output objects in the version with + % single output + % 2) Check we have the correct number of elements in the output objects + % + % + + atest = true; + if stest + % + % 1) Check we have the correct number of output objects in the version with + % single output + % 2) Check we have the correct number of elements in the output objects + % + % + % + if ~isequal(size(out), [1 3]), atest = false; end + for jj = 1:numel(out) + if ~isequal(numel(out(jj).y), N+1), atest = false; end + end + if ~isequal(numel(out_1.y), N+1), atest = false; end + if ~isequal(numel(out_2.y), N+1), atest = false; end + if ~isequal(numel(out_3.y), N+1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the polyfit method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the polyfit method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + amat = [at1 at2 at5; at6 at5 at2]; + avec = [at1 at2]; + out = polyfit(at5, avec, at6, amat, at5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check we have the correct number of output objects + % + % + + atest = true; + if stest + % + N = find(ao.getInfo('polyfit').plists, 'N'); + if ~isequal(numel(out), numel(amat) + numel(avec) + 3), atest = false; end + for jj = 1:numel(out) + if ~isequal(numel(out(jj).y), N+1), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the polyfit method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the polyfit method can be processed back + % to an m-file. + % + % + + try + % + out1 = polyfit(at1, plist('rescale', 'true')); + out2 = polyfit(at1, plist('vector_out', false)); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'polyfit'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' (matrix object) + if ~strcmp(out1.hist.methodInfo.mname, 'polyfit'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'polyfit'), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the polyfit method cannot modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the polyfit method cannot modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = ain.polyfit(); + ain.polyfit(); + % + stest = true; + catch err + stest = true; + end + + % + % + % 1) Nothing to check + % + % + + atest = true; + if stest + % + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the polyfit method handles units correctly. + % + % + function result = utp_08 + + % + % + % Tests that the polyfit method handles units correctly. + % + % + + try + % + % Input data + nsecs = 100; + fs = 10; + + u = get_random_unit(); + + x1 = ao(plist('tsfcn', 'randn(size(t)) + 0.02*t + 5', ... + 'fs', fs, 'nsecs', nsecs, ... + 'yunits', u)); + x2 = ao(plist('tsfcn', 'randn(size(t)) + 0.02*t + 5', ... + 'fs', fs, 'nsecs', nsecs, ... + 'yunits', '')); + + % Settings for polyfit + N = 2; + out1 = polyfit(x1, plist('N', N)); + out2 = polyfit(x2, plist('N', N)); + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the units in both cases are yunits/(xunits)^(j) + % + % + + atest = true; + if stest + % + % 1) Check that the units in both cases are yunits/(xunits)^(j) + for jj = 1:N+1 + if ~isequal(out1.yunits(jj), x1.yunits./(x1.xunits).^(N+1-jj)), atest = false; end + end + for jj = 1:N+1 + if ~isequal(out2.yunits(jj), x2.yunits./(x2.xunits).^(N+1-jj)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Tests that the ao/polyfit method agrees with MATLAB's polyfit when + % configured to use the same parameters. + % + % + function result = utp_09 + + % + % + % Test that applying polyfit works on a single AO. + % + % + + % + try + + % Make test AO + nsecs = 100; + fs = 10; + + unit_list = unit.supportedUnits; + u = unit(cell2mat(utils.math.randelement(unit_list,1))); + + a1 = ao(plist('nsecs', nsecs, 'fs', fs, ... + 'tsfcn', 'polyval([3 2 1 ], t) + 1000*randn(size(t))', 'xunits', 's', 'yunits', u)); + + N = 4; + pl = plist('N', N); + p1 = a1.polyfit(pl.pset('rescale', true)); + p2 = a1.polyfit(pl.pset('rescale', false)); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that output agrees with the output of MATLAB's polyfit. + % + % + + % + atest = true; + + if stest + % Call Matlab polyfit with rescale + [p,s,mu] = polyfit(a1.x, a1.y, N); + + if ~isequal(p, p1.y') || ~isequal(s, find(p1.procinfo, 's')) || ~isequal(mu, find(p1.procinfo, 'mu')) + atest = false; + end + % Call Matlab polyfit without rescale + [p,s] = polyfit(a1.x, a1.y, N); + if ~isequal(p, p2.y') || ~isequal(s, find(p2.procinfo, 's')) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_power.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_power.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,582 @@ +% UTP_AO_POWER a set of UTPs for the ao/power method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_power.m,v 1.7 2011/02/28 15:55:13 mauro Exp $ +% + +% +% +% The power method of the ao class computes the power of the y data of the two +% inputs. +% +% + +function results = utp_ao_power(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'power'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test all data types + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('exponent'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('exponent')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('exponent'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the power method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the power method works for a vector of AOs as input. + % + % + + try + % + % We need a vector of AOs all the same size. + % The shape of the data shouldn't have an effect to the algorithm. + avec = [at1 at5 at6]; + out = power(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is 1 + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the one output + if numel(out) ~= 1, atest = false; end + % Check the output against the power of the inputs + s = avec(1).data.getY; + for jj=2:numel(avec) + s = s .^ avec(jj).data.getY; + end + if ~isequal(s, out.data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the power method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the power method works for a matrix of AOs as input. + % + % + + try + % + % We need a matrix of AOs all the same size + amat = [at1 at6 at1; at6 at5 at6]; + out = power(amat); + stest = true; + % + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is 1 + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Check the output against the power of the inputs + s = amat(1).data.getY; + for kk=2:numel(amat) + s = s .^ amat(kk).data.getY; + end + if ~isequal(s, out.data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the power method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the power method works for a list of AOs as input. + % + % + + try + % + out = power(at1,at5,at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is 1. + % 2) Check that each output AO contains the correct data. + % 3) Check the y-units + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Check the output against the power of the inputs + s = at1.data.getY .^ at5.data.getY .^ at6.data.getY; + if ~isequal(s, out.data.getY), atest = false; end + % Check the units + if ~eq(out.yunits, at1.yunits), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the power method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the power method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + % We need a vector of AOs all the same size + avec = [at5 at6 at5]; + % We need a matrix of AOs all the same size + amat = [at5 at6 at5; at6 at5 at6]; + % Compute power + out = power(at5,avec,at5,amat,at5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is 1. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Check the power of all the inputs + s = at5.data.getY; + for jj=1:numel(avec) + s = s .^ avec(jj).data.getY; + end + s = s .^ at5.data.getY; + for jj=1:numel(amat) + s = s .^ amat(jj).data.getY; + end + s = s .^ at5.data.getY; + if ~isequal(s, out.data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the power method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the power method can be processed back + % to an m-file. + % + % + + try + % + out = power(at5,at6); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'power'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'power'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the power method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the power method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = ain.power(5); + ain .^ 5; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is power(at1). + % + % + + atest = true; + if stest + % + % Check that power modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that power doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the power value of the copy + if ~isequal(power(at1.y, 5), ain.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the power method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = at5 .^ 5; + out3 = at6 .^ 5; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y, 1) ~= size(at5.data.y, 1), atest = false; end + if size(out3.data.y, 2) ~= size(at6.data.y, 2), atest = false; end + % Check y-units + if ~eq(out1.yunits, at5.yunits.^5), atest = false; end + if ~eq(out3.yunits, at6.yunits.^5), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test the method with all data objects. + % + % + function result = utp_09 + + % + % + % Test that the power method works with cdata-, fsdata-, tsdata-, and xydata + % objects + % + % + + try + % + out11 = at1 .^ 5; + out21 = at2 .^ 5; + out31 = at3 .^ 5; + out41 = at4 .^ 5; + out51 = at1 .^ ao(5); + out61 = at2 .^ ao(5); + out71 = at3 .^ ao(5); + out81 = at4 .^ ao(5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % 2) Check that re-building of output is the same as the output + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if ~isequal(power(at1.y, 5), out11.y), atest = false; end + if ~isequal(power(at2.y, 5), out21.y), atest = false; end + if ~isequal(power(at3.y, 5), out31.y), atest = false; end + if ~isequal(power(at4.y, 5), out41.y), atest = false; end + if ~isequal(power(at1.y, 5), out51.y), atest = false; end + if ~isequal(power(at2.y, 5), out61.y), atest = false; end + if ~isequal(power(at3.y, 5), out71.y), atest = false; end + if ~isequal(power(at4.y, 5), out81.y), atest = false; end + % Check the rebuilding + if ~eq(rebuild(out11), out11, ple2), atest = false; end + if ~eq(rebuild(out21), out21, ple2), atest = false; end + if ~eq(rebuild(out31), out31, ple2), atest = false; end + if ~eq(rebuild(out41), out41, ple2), atest = false; end + if ~eq(rebuild(out51), out51, ple2), atest = false; end + if ~eq(rebuild(out61), out61, ple2), atest = false; end + if ~eq(rebuild(out71), out71, ple2), atest = false; end + if ~eq(rebuild(out81), out81, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_psd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_psd.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,4476 @@ +% UTP_AO_PSD a set of UTPs for the ao/psd method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_psd.m,v 1.48 2011/07/21 06:46:48 mauro Exp $ +% + +% +% +% The psd method of the ao class computes the spectral density of time-series AOs. +% +% + +function results = utp_ao_psd(varargin) + + % Check the inputs + if nargin == 0 + + addpath(fullfile(fileparts(which(mfilename)), 'reference_files')) + + % Some keywords + class = 'ao'; + mthd = 'psd'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Get default window from the preferences + prefs = getappdata(0, 'LTPDApreferences'); + defaultWinType = char(prefs.getMiscPrefs.getDefaultWindow); + + % Very-long white noise reference time-series + a_n_long = ao(plist('filename', 'ref_whitenoise_20000s_10Hz.xml')); + + % Split the reference data into different segments + nsecs = a_n_long.data.nsecs; + Nsegments = 100; + + ap = a_n_long.split(plist('split_type', 'chunks', 'chunks', Nsegments)); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test against MATLAB's pwelch + results = [results utp_08]; % Test output of the data + results = [results utp_09]; % Test against MATLAB's pwelch + results = [results utp_10]; % Test against MATLAB's pwelch + + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + results = [results utp_12]; % Test "conservation of energy": + % - white noise from uniform pdf, random parameters + % - no detrending, Rectangular window + results = [results utp_13]; % Test "conservation of energy": + % - white noise from normal pdf, fixed parameters + % - no detrending, Rectangular window + results = [results utp_14]; % Test "conservation of energy": + % - white noise from uniform pdf, fixed parameters + % - no detrending, Rectangular window + results = [results utp_15]; % Test "conservation of energy": + % - white noise from normal pdf, fixed parameters + % - no detrending, Rectangular window + results = [results utp_16]; % Test "conservation of energy": + % - white noise from uniform pdf, fixed parameters + % - no detrending, Rectangular window + results = [results utp_17]; % Test units handling: PSD + results = [results utp_18]; % Test units handling: ASD + results = [results utp_19]; % Test units handling: PS + results = [results utp_20]; % Test units handling: AS + results = [results utp_21]; % Test "conservation of energy": Welch window + no detrending + results = [results utp_22]; % Test "conservation of energy": Welch window + mean detrending + results = [results utp_23]; % Test "conservation of energy": Welch window + linear detrending + results = [results utp_24]; % Test "conservation of energy": Hanning window + no detrending + results = [results utp_25]; % Test "conservation of energy": Hanning window + mean detrending + results = [results utp_26]; % Test "conservation of energy": Hanning window + linear detrending + results = [results utp_27]; % Test "conservation of energy": Hamming window + no detrending + results = [results utp_28]; % Test "conservation of energy": Hamming window + mean detrending + results = [results utp_29]; % Test "conservation of energy": Hamming window + linear detrending + results = [results utp_30]; % Test "conservation of energy": BH92 window + no detrending + results = [results utp_31]; % Test "conservation of energy": BH92 window + mean detrending + results = [results utp_32]; % Test "conservation of energy": BH92 window + linear detrending + results = [results utp_33]; % Test "conservation of energy": Kaiser200 window + no detrending + results = [results utp_34]; % Test "conservation of energy": Kaiser200 window + mean detrending + results = [results utp_35]; % Test "conservation of energy": Kaiser200 window + linear detrending + results = [results utp_38]; % Test detrending + results = [results utp_39]; % Test detrending + results = [results utp_40]; % Test detrending + results = [results utp_41]; % Test different windows: Rectangular + results = [results utp_42]; % Test different windows: BH92 + results = [results utp_43]; % Test different windows: Hamming + results = [results utp_44]; % Test different windows: Hanning + results = [results utp_45]; % Test different windows: Bartlett + results = [results utp_46]; % Test different windows: Nuttall3 + results = [results utp_47]; % Test different windows: Kaiser psll = [random] + results = [results utp_48]; % Test different windows: Kaiser psll = [default] + results = [results utp_49]; % Test different windows: Nuttall4 + results = [results utp_50]; % Test different windows: SFT3F + results = [results utp_51]; % Test number of averages: requested/obtained + results = [results utp_52]; % Test number of averages: correct number + results = [results utp_53]; % Test number of averages: syntax + results = [results utp_54]; % Test "conservation of energy": + results = [results utp_60]; % Test 'basic' call: PSD + results = [results utp_61]; % Test 'basic' call: ASD + results = [results utp_62]; % Test 'basic' call: PS + results = [results utp_63]; % Test 'basic' call: AS + + + 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 + + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + % + try + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + % + atest = true; + if stest + % check we have minfo objects + if isa(io, 'minfo') + + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 9, atest = false; end + % Check key + if ~io(3).plists.isparam('nfft'), atest = false; end + if ~io(3).plists.isparam('win'), atest = false; end + if ~io(3).plists.isparam('olap'), atest = false; end + if ~io(3).plists.isparam('scale'), atest = false; end + if ~io(3).plists.isparam('order'), atest = false; end + if ~io(3).plists.isparam('navs'), atest = false; end + if ~io(3).plists.isparam('times'), atest = false; end + if ~io(3).plists.isparam('split'), atest = false; end + if ~io(3).plists.isparam('psll'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('nfft'), -1), atest = false; end + if ~strcmpi(io(3).plists.find('win'), defaultWinType), atest = false; end + if ~isequal(io(3).plists.find('olap'), -1), atest = false; end + if ~isequal(io(3).plists.find('scale'), 'PSD'), atest = false; end + if ~isequal(io(3).plists.find('order'), 0), atest = false; end + if ~isequal(io(3).plists.find('navs'), -1), atest = false; end + if ~isEmptyDouble(io(3).plists.find('times')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('split')), atest = false; end + if ~isequal(io(3).plists.find('psll'), 200), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('nfft'), {-1}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('win'), specwin.getTypes), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('olap'), {-1}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('scale'), {'PSD', 'ASD', 'PS', 'AS'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('order'), {-1 0 1 2 3 4 5 6 7 8 9}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('navs'), {-1}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('times'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('split'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('psll'), {200}), atest = false; end + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the psd method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the psd method works for a vector of AOs as input. + % + % + + % + try + avec = [at1 at5 at6]; + % Vector output + out = psd(avec); + % List output + [out1, out2, out3] = psd(avec); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the same as in the input. + % 2) Check that each output object contains the correct values. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + % Check we have the correct values in the outputs + % Vector output + for kk = 1:numel(out) + if ~eq(out(kk), psd(avec(kk)), ple1), atest = false; end + end + % List output + if ~eq(out1, psd(avec(1)), ple1), atest = false; end + if ~eq(out2, psd(avec(2)), ple1), atest = false; end + if ~eq(out3, psd(avec(3)), ple1), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the psd method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the psd method works for a matrix of AOs as input. + % + % + + % + try + amat = [at1 at5 at6; at5 at6 at1]; + % Vector output + out = psd(amat); + % List output + [out1, out2, out3, out4, out5, out6] = psd(amat); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the same as in the input. + % 2) Check that each output object contains the correct values. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + % Check we have the correct values in the outputs + % Vector output + for kk = 1:numel(out) + if ~eq(out(kk), psd(amat(kk)), ple1), atest = false; end + end + % List output + if ~eq(out1, psd(amat(1)), ple1), atest = false; end + if ~eq(out2, psd(amat(2)), ple1), atest = false; end + if ~eq(out3, psd(amat(3)), ple1), atest = false; end + if ~eq(out4, psd(amat(4)), ple1), atest = false; end + if ~eq(out5, psd(amat(5)), ple1), atest = false; end + if ~eq(out6, psd(amat(6)), ple1), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the psd method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the psd method works for a list of AOs as input. + % + % + + % + try + % Vector output + out = psd(at1,at5,at6); + % List output + [out1, out2, out3] = psd(at1,at5,at6); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the same as in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check we have the correct values in the outputs + % Vector output + if ~eq(out(1), psd(at1), ple1), atest = false; end + if ~eq(out(2), psd(at5), ple1), atest = false; end + if ~eq(out(3), psd(at6), ple1), atest = false; end + % List output + if ~eq(out1, psd(at1), ple1), atest = false; end + if ~eq(out2, psd(at5), ple1), atest = false; end + if ~eq(out3, psd(at6), ple1), atest = false; end + + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the psd method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the psd method works with an input of matrices and vectors + % and single AOs. + % + % + + % + try + % Vector output + out = psd(at1,[at5 at6],at5,[at5 at1; at6 at1],at6); + % List output + [out1, out2, out3, out4, out5, out6, out7, out8, out9] = ... + psd(at1,[at5 at6],at5,[at5 at1; at6 at1],at6); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + % Check we have the correct values in the outputs + % Vector output + if ~eq(out(1), psd(at1), ple1), atest = false; end + if ~eq(out(2), psd(at5), ple1), atest = false; end + if ~eq(out(3), psd(at6), ple1), atest = false; end + if ~eq(out(4), psd(at5), ple1), atest = false; end + if ~eq(out(5), psd(at5), ple1), atest = false; end + if ~eq(out(6), psd(at6), ple1), atest = false; end + if ~eq(out(7), psd(at1), ple1), atest = false; end + if ~eq(out(8), psd(at1), ple1), atest = false; end + if ~eq(out(9), psd(at6), ple1), atest = false; end + % List output + if ~eq(out1, psd(at1), ple1), atest = false; end + if ~eq(out2, psd(at5), ple1), atest = false; end + if ~eq(out3, psd(at6), ple1), atest = false; end + if ~eq(out4, psd(at5), ple1), atest = false; end + if ~eq(out5, psd(at5), ple1), atest = false; end + if ~eq(out6, psd(at6), ple1), atest = false; end + if ~eq(out7, psd(at1), ple1), atest = false; end + if ~eq(out8, psd(at1), ple1), atest = false; end + if ~eq(out9, psd(at6), ple1), atest = false; end + + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the psd method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the psd method can be processed back + % to an m-file. + % + % + + % + try + out = psd(at5); + mout = rebuild(out); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'psd'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + % + atest = true; + if stest + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'psd'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the psd method agrees with MATLAB's pwelch, within some tolerance, + % when configured to use the same parameters. + % + % + function result = utp_07 + + % + % + % Test that applying psd works on a single AO. + % + % + + % + try + % Load reference ao + a1 = ao('ref_whitenoise_10s_1000Hz.xml'); + fs = a1.fs; + % Compute PSD + Nfft = 2*fs; + win = specwin('Hanning', Nfft); + pl = plist('Nfft', Nfft, 'Win', win.type, 'order', -1); + S1 = a1.psd(pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that output agrees with the output of MATLAB's pwelch within tolerance. + % + % + + % + atest = true; + TOL = 1.8e-15; + + if stest + % Load reference psd + ref = load('ref_psd_10s_1000Hz.txt'); + if ~isequal(ref(:,1), S1.x) || any((abs(S1.y - ref(:,2)) ./ S1.y) >= TOL) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Check that the psd method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_08 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = psd(at5, at6); + o3 = psd(at5, at6); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Tests that the psd method agrees with MATLAB's pwelch when + % configured to use the same parameters. + % + % + function result = utp_09 + + % + % + % Test that the applying psd works on a single AO. + % + % + + % + try + % Load reference ao + a1 = ao('ref_whitenoise_3600s_1Hz.xml'); + % Compute PSD + Nfft = 1000; + win = specwin('BH92', Nfft); + pl = plist('Nfft', Nfft, 'Win', win.type, 'order', -1); + S1 = a1.psd(pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that output agrees with the output of MATLAB's pwelch. + % + % + + % + atest = true; + TOL = 1e-15; + + if stest + % Load reference psd + ref = load('ref_psd_3600s_1Hz.txt'); + if ~isequal(ref(:,1), S1.x) || any((abs(S1.y - ref(:,2)) ./ S1.y) >= TOL) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Tests that the psd method agrees with MATLAB's pwelch when + % configured to use the same parameters. + % + % + function result = utp_10 + + % + % + % Test that the applying psd works on a single AO. + % + % + + % + try + % Load reference ao + a1 = ao('ref_whitenoise_100000s_100mHz.xml'); + % Compute PSD + Nfft = a1.fs * a1.data.nsecs; + psll = 100; + win = specwin('Kaiser', Nfft, psll); + pl = plist('Nfft', Nfft, 'Win', win.type, 'psll', psll, 'order', -1); + S1 = a1.psd(pl); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that output agrees with the output of MATLAB's pwelch. + % + % + + % + atest = true; + TOL = 1e-13; + + if stest + % Load reference psd + ref = load('ref_psd_100000s_100mHz.txt'); + if ~isequal(ref(:,1), S1.x) || any((abs(S1.y - ref(:,2)) ./ S1.y) >= TOL) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + + + %% UTP_12 + + % + % + % Tests "conservation of energy": + % 1) white noise produced from uniform pdf, with a given mean value and + % sigma (distribution's 1st and 2nd order) + % 2) evaluate the sample mean value m and standard deviation s + % 3) psd of the white noise + % 4) compares the sqrt(sum(S * df)) with the standard deviation s + % + + % + function result = utp_12 + + % + % + % 1) Prepare the test tsdata: + % white noise from uniform distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd + % + % + + % + try + + % White noise + % Parameters are crucial for the estimate to be correct! + + noise_type = 'Uniform'; + win_type = 'Rectangular'; + olap = 0; + detrend_order = 0; + + scale = 'PSD'; + + [sigma_sample, sigma_psd] = prepare_analyze_noise_energy(win_type, noise_type, scale, ... + plist('detrend_order', detrend_order, 'olap', olap)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + + % + + % + % + % 1) Check that calculated psd energy equals the rms content of the tsdata, estimated by the std of the sample + % + % + + % + atest = true; + TOL = 1e-12; + + if stest + if abs(sigma_psd - sigma_sample) / mean([sigma_psd sigma_sample]) >= TOL + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Tests "conservation of energy" with fixed parameters: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd order) + % 2) evaluate the sample mean value m and standard deviation s + % 3) psd of the white noise + % 4) compares the sqrt(sum(S * df)) with the standard deviation s + % + + % + function result = utp_13 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd + % + % + + % + try + + % White noise + % Parameters are crucial for the estimate to be correct! + + noise_type = 'Normal'; + win_type = 'Rectangular'; + olap = 0; + detrend_order = 0; + + scale = 'PSD'; + + % Build with fixed parameters + fs = 10; + nsecs = 3600; + sigma_distr = 1; + mu_distr = 0; + [sigma_sample, sigma_psd] = prepare_analyze_noise_energy(win_type, noise_type, scale, ... + plist('detrend_order', detrend_order, 'olap', olap, ... + 'fs', fs, 'nsecs', nsecs, 'sigma_distr', sigma_distr, 'mu_distr', mu_distr)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psd energy equals the rms content of the tsdata, estimated by the std of the sample + % + % + + % + atest = true; + TOL = 1e-12; + + if stest + if abs(sigma_psd - sigma_sample) / mean([sigma_psd sigma_sample]) >= TOL + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + %% UTP_14 + + % + % + % Tests "conservation of energy" with fixed parameters: + % 1) white noise produced from uniform pdf, with a given mean value and + % sigma (distribution's 1st and 2nd order) + % 2) evaluate the sample mean value m and standard deviation s + % 3) psd of the white noise + % 4) compares the sqrt(sum(S * df)) with the standard deviation s + % + + % + function result = utp_14 + + % + % + % 1) Prepare the test tsdata: + % white noise from uniform distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd + % + % + + % + try + + % White noise + % Parameters are crucial for the estimate to be correct! + + noise_type = 'Uniform'; + win_type = 'Rectangular'; + olap = 0; + detrend_order = 0; + + scale = 'PSD'; + + % Build with fixed parameters + fs = 1; + nsecs = 86400; + sigma_distr = 1e-9; + mu_distr = 3e-7; + [sigma_sample, sigma_psd] = prepare_analyze_noise_energy(win_type, noise_type, scale, ... + plist('detrend_order', detrend_order, 'olap', olap, ... + 'fs', fs, 'nsecs', nsecs, 'sigma_distr', sigma_distr, 'mu_distr', mu_distr)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psd energy equals the rms content of the tsdata, estimated by the std of the sample + % + % + + % + atest = true; + TOL = 1e-12; + + if stest + if abs(sigma_psd - sigma_sample) / mean([sigma_psd sigma_sample]) >= TOL + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_14 + + %% UTP_15 + + % + % + % Tests "conservation of energy" with fixed parameters: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd order) + % 2) evaluate the sample mean value m and standard deviation s + % 3) psd of the white noise + % 4) compares the sqrt(sum(S * df)) with the standard deviation s + % + + % + function result = utp_15 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd + % + % + + % + try + + % White noise + % Parameters are crucial for the estimate to be correct! + + noise_type = 'Normal'; + win_type = 'Rectangular'; + olap = 0; + detrend_order = 0; + + scale = 'PSD'; + + % Build with fixed parameters + fs = 100; + nsecs = 100; + sigma_distr = 1e-12; + mu_distr = -5e-12; + [sigma_sample, sigma_psd] = prepare_analyze_noise_energy(win_type, noise_type, scale, ... + plist('detrend_order', detrend_order, 'olap', olap, ... + 'fs', fs, 'nsecs', nsecs, 'sigma_distr', sigma_distr, 'mu_distr', mu_distr)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psd energy equals the rms content of the tsdata, estimated by the std of the sample + % + % + + % + atest = true; + TOL = 1e-12; + + if stest + if abs(sigma_psd - sigma_sample) / mean([sigma_psd sigma_sample]) >= TOL + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_15 + + %% UTP_16 + + % + % + % Tests "conservation of energy" with fixed parameters: + % 1) white noise produced from uniform pdf, with a given mean value and + % sigma (distribution's 1st and 2nd order) + % 2) evaluate the sample mean value m and standard deviation s + % 3) psd of the white noise + % 4) compares the sqrt(sum(S * df)) with the standard deviation s + % + + % + function result = utp_16 + + % + % + % 1) Prepare the test tsdata: + % white noise from uniform distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd + % + % + + % + try + + % White noise + % Parameters are crucial for the estimate to be correct! + + noise_type = 'Uniform'; + win_type = 'Rectangular'; + olap = 0; + detrend_order = 0; + + scale = 'PSD'; + + % Build with fixed parameters + fs = 0.01; + nsecs = 3*86400; + sigma_distr = 1e-15; + mu_distr = -7.72e-13; + [sigma_sample, sigma_psd] = prepare_analyze_noise_energy(win_type, noise_type, scale, ... + plist('detrend_order', detrend_order, 'olap', olap, ... + 'fs', fs, 'nsecs', nsecs, 'sigma_distr', sigma_distr, 'mu_distr', mu_distr)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psd energy equals the rms content of the tsdata, estimated by the std of the sample + % + % + + % + atest = true; + TOL = 1e-12; + + if stest + if abs(sigma_psd - sigma_sample) / mean([sigma_psd sigma_sample]) >= TOL + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_16 + + %% UTP_17 + + % + % + % Tests handling of units: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) PSD of the white noise + % 3) compares the units of the input and output + % + + % + function result = utp_17 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) PSD of the white noise + % + % + + % + try + + % White noise + noise_type = 'Normal'; + win_type = 'BH92'; + reduce_pts = 10; + scale = 'PSD'; + olap = specwin(win_type).rov; + + [a, S, S1, S2] = prepare_analyze_noise_win(win_type, noise_type, scale, ... + plist('olap', olap, 'reduce_pts', reduce_pts)); + % S1 and S2 are empty in this case + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (calculated PSD yunits) equals (input units)^2 / Hz + % 2) Check that (calculated PSD xunits) equals Hz + % + % + + % + atest = true; + + if stest + if ne(S.yunits, (a.yunits).^2 * unit('Hz^-1')) || ne(S.xunits, unit('Hz')) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_17 + + %% UTP_18 + + % + % + % Tests handling of units: + % 1) white noise produced from uniform pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) ASD of the white noise + % 3) compares the units of the input and output + % + + % + function result = utp_18 + + % + % + % 1) Prepare the test tsdata: + % white noise from uniform distribution + offset + % 2) Assign a random unit + % 3) ASD of the white noise + % + % + + % + try + + % White noise + noise_type = 'Uniform'; + win_type = 'Hamming'; + reduce_pts = 4; + scale = 'ASD'; + olap = specwin(win_type).rov; + + [a, S, S1, S2] = prepare_analyze_noise_win(win_type, noise_type, scale, ... + plist('olap', olap, 'reduce_pts', reduce_pts)); + % S1 and S2 are empty in this case + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (calculated ASD yunits) equals (input units) / Hz^(1/2) + % 2) Check that (calculated ASD xunits) equals Hz + % + % + + % + atest = true; + + if stest + if ne(S.yunits, (a.yunits) * unit('Hz^-1/2')) || ne(S.xunits, unit('Hz')) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_18 + + %% UTP_19 + + % + % + % Tests handling of units: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) PS of the white noise + % 3) compares the units of the input and output + % + + % + function result = utp_19 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) PS of the white noise + % + % + + % + try + + % White noise + noise_type = 'Normal'; + win_type = 'Hanning'; + reduce_pts = 5; + scale = 'PS'; + olap = specwin(win_type).rov; + + [a, S, S1, S2] = prepare_analyze_noise_win(win_type, noise_type, scale, ... + plist('olap', olap, 'reduce_pts', reduce_pts)); + % S1 and S2 are empty in this case + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (calculated PS yunits) equals (input units)^2 + % 2) Check that (calculated PS xunits) equals Hz + % + % + + % + atest = true; + + if stest + if ne(S.yunits, (a.yunits).^2) || ne(S.xunits, unit('Hz')) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_19 + + %% UTP_20 + + % + % + % Tests handling of units: + % 1) white noise produced from uniform distribution, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) AS of the white noise + % 3) compares the units of the input and output + % + + % + function result = utp_20 + + % + % + % 1) Prepare the test tsdata: + % white noise from uniform distribution + offset + % 2) Assign a random unit + % 3) AS of the white noise + % + % + + % + try + + % White noise + noise_type = 'Uniform'; + win_type = 'Rectangular'; + reduce_pts = 10; + scale = 'AS'; + olap = specwin(win_type).rov; + + [a, S, S1, S2] = prepare_analyze_noise_win(win_type, noise_type, scale, ... + plist('olap', olap, 'reduce_pts', reduce_pts)); + % S1 and S2 are empty in this case + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (calculated AS yunits) equals (input units) + % 2) Check that (calculated AS xunits) equals Hz + % + % + + % + atest = true; + + if stest + if ne(S.yunits, a.yunits) || ne(S.xunits, unit('Hz')) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_20 + + %% UTP_21 + + % + % + % Tests "conservation of energy": + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) Calculate the expected level of noise from sample statistics + % 3) Calculates the PSD of the individual parts, with: + % Welch window and no detrend + % 4) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 5) Checks on individual PSDs: mean and standard deviation of the PSD points + % 6) Evaluate the expected value, estimated from the std of the + % individual segments + % 7) Compares with the mean performed on the individual segments + % 8) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 9) Compares the grand-mean with the estimated white noise level + + % + function result = utp_21 + + % + % + % 1) Split the reference data into different segments + % 2) Calculates the PSD of the individual parts + % + % + + % + try + + % Calculate the expected level of noise from sample statistics + + % Evaluate the PSDs on the parts, employing: + % - Welch window + % - no detrend + win_type = 'Welch'; + detrend_order = -1; + + [S_ap, S_sigma_total, S_expected_total] = ... + test_psd_energy_prepare_data(win_type, detrend_order, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 2) Checks on individual PSDs: mean and standard deviation of the PSD points + % 3) Evaluate the expected value, estimated from the std of the + % individual segments + % 4) Compares with the mean performed on the individual segments + % 5) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 6) Compares the grand-mean with the estimated white noise level + + % + + % + + if stest + atest = algo_test_psd_energy(ap, S_ap, S_expected_total, plist); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_21 + + + %% UTP_22 + + % + % + % Tests "conservation of energy": + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) Calculate the expected level of noise from sample statistics + % 3) Calculates the PSD of the individual parts, with: + % Welch window and mean detrend + % 4) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 5) Checks on individual PSDs: mean and standard deviation of the PSD points + % 6) Evaluate the expected value, estimated from the std of the + % individual segments + % 7) Compares with the mean performed on the individual segments + % 8) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 9) Compares the grand-mean with the estimated white noise level + + % + function result = utp_22 + + % + % + % 1) Split the reference data into different segments + % 2) Calculates the PSD of the individual parts + % + % + + % + try + + % Calculate the expected level of noise from sample statistics + + % Evaluate the PSDs on the parts, employing: + % - Welch window + % - mean detrend + win_type = 'Welch'; + detrend_order = 0; + + [S_ap, S_sigma_total, S_expected_total] = ... + test_psd_energy_prepare_data(win_type, detrend_order, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 2) Checks on individual PSDs: mean and standard deviation of the PSD points + % 3) Evaluate the expected value, estimated from the std of the + % individual segments + % 4) Compares with the mean performed on the individual segments + % 5) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 6) Compares the grand-mean with the estimated white noise level + + % + + % + + if stest + atest = algo_test_psd_energy(ap, S_ap, S_expected_total, plist); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_22 + + %% UTP_23 + + % + % + % Tests "conservation of energy": + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) Calculate the expected level of noise from sample statistics + % 3) Calculates the PSD of the individual parts, with: + % Welch window and linear detrend + % 4) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 5) Checks on individual PSDs: mean and standard deviation of the PSD points + % 6) Evaluate the expected value, estimated from the std of the + % individual segments + % 7) Compares with the mean performed on the individual segments + % 8) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 9) Compares the grand-mean with the estimated white noise level + + % + function result = utp_23 + + % + % + % 1) Split the reference data into different segments + % 2) Calculates the PSD of the individual parts + % + % + + % + try + + % Calculate the expected level of noise from sample statistics + + % Evaluate the PSDs on the parts, employing: + % - Welch window + % - linear detrend + win_type = 'Welch'; + detrend_order = 1; + + [S_ap, S_sigma_total, S_expected_total] = ... + test_psd_energy_prepare_data(win_type, detrend_order, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 2) Checks on individual PSDs: mean and standard deviation of the PSD points + % 3) Evaluate the expected value, estimated from the std of the + % individual segments + % 4) Compares with the mean performed on the individual segments + % 5) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 6) Compares the grand-mean with the estimated white noise level + + % + + % + + if stest + atest = algo_test_psd_energy(ap, S_ap, S_expected_total, plist); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_23 + + %% UTP_24 + + % + % + % Tests "conservation of energy": + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) Calculate the expected level of noise from sample statistics + % 3) Calculates the PSD of the individual parts, with: + % Hanning window and no detrend + % 4) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 5) Checks on individual PSDs: mean and standard deviation of the PSD points + % 6) Evaluate the expected value, estimated from the std of the + % individual segments + % 7) Compares with the mean performed on the individual segments + % 8) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 9) Compares the grand-mean with the estimated white noise level + + % + function result = utp_24 + + % + % + % 1) Split the reference data into different segments + % 2) Calculates the PSD of the individual parts + % + % + + % + try + + % Calculate the expected level of noise from sample statistics + + % Evaluate the PSDs on the parts, employing: + % - Hanning window + % - no detrend + win_type = 'Hanning'; + detrend_order = -1; + + [S_ap, S_sigma_total, S_expected_total] = ... + test_psd_energy_prepare_data(win_type, detrend_order, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 2) Checks on individual PSDs: mean and standard deviation of the PSD points + % 3) Evaluate the expected value, estimated from the std of the + % individual segments + % 4) Compares with the mean performed on the individual segments + % 5) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 6) Compares the grand-mean with the estimated white noise level + + % + + % + + if stest + atest = algo_test_psd_energy(ap, S_ap, S_expected_total, plist); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_24 + + + %% UTP_25 + + % + % + % Tests "conservation of energy": + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) Calculate the expected level of noise from sample statistics + % 3) Calculates the PSD of the individual parts, with: + % Hanning window and mean detrend + % 4) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 5) Checks on individual PSDs: mean and standard deviation of the PSD points + % 6) Evaluate the expected value, estimated from the std of the + % individual segments + % 7) Compares with the mean performed on the individual segments + % 8) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 9) Compares the grand-mean with the estimated white noise level + + % + function result = utp_25 + + % + % + % 1) Split the reference data into different segments + % 2) Calculates the PSD of the individual parts + % + % + + % + try + + % Calculate the expected level of noise from sample statistics + + % Evaluate the PSDs on the parts, employing: + % - Hanning window + % - mean detrend + win_type = 'Hanning'; + detrend_order = 0; + + [S_ap, S_sigma_total, S_expected_total] = ... + test_psd_energy_prepare_data(win_type, detrend_order, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 2) Checks on individual PSDs: mean and standard deviation of the PSD points + % 3) Evaluate the expected value, estimated from the std of the + % individual segments + % 4) Compares with the mean performed on the individual segments + % 5) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 6) Compares the grand-mean with the estimated white noise level + + % + + % + + if stest + atest = algo_test_psd_energy(ap, S_ap, S_expected_total, plist); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_25 + + %% UTP_26 + + % + % + % Tests "conservation of energy": + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) Calculate the expected level of noise from sample statistics + % 3) Calculates the PSD of the individual parts, with: + % Hanning window and linear detrend + % 4) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 5) Checks on individual PSDs: mean and standard deviation of the PSD points + % 6) Evaluate the expected value, estimated from the std of the + % individual segments + % 7) Compares with the mean performed on the individual segments + % 8) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 9) Compares the grand-mean with the estimated white noise level + + % + function result = utp_26 + + % + % + % 1) Split the reference data into different segments + % 2) Calculates the PSD of the individual parts + % + % + + % + try + + % Calculate the expected level of noise from sample statistics + + % Evaluate the PSDs on the parts, employing: + % - Hanning window + % - linear detrend + win_type = 'Hanning'; + detrend_order = 1; + + [S_ap, S_sigma_total, S_expected_total] = ... + test_psd_energy_prepare_data(win_type, detrend_order, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 2) Checks on individual PSDs: mean and standard deviation of the PSD points + % 3) Evaluate the expected value, estimated from the std of the + % individual segments + % 4) Compares with the mean performed on the individual segments + % 5) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 6) Compares the grand-mean with the estimated white noise level + + % + + % + + if stest + atest = algo_test_psd_energy(ap, S_ap, S_expected_total, plist); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_26 + + %% UTP_27 + + % + % + % Tests "conservation of energy": + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) Calculate the expected level of noise from sample statistics + % 3) Calculates the PSD of the individual parts, with: + % Hamming window and no detrend + % 4) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 5) Checks on individual PSDs: mean and standard deviation of the PSD points + % 6) Evaluate the expected value, estimated from the std of the + % individual segments + % 7) Compares with the mean performed on the individual segments + % 8) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 9) Compares the grand-mean with the estimated white noise level + + % + function result = utp_27 + + % + % + % 1) Split the reference data into different segments + % 2) Calculates the PSD of the individual parts + % + % + + % + try + + % Calculate the expected level of noise from sample statistics + + % Evaluate the PSDs on the parts, employing: + % - Hamming window + % - no detrend + win_type = 'Hamming'; + detrend_order = -1; + + [S_ap, S_sigma_total, S_expected_total] = ... + test_psd_energy_prepare_data(win_type, detrend_order, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 2) Checks on individual PSDs: mean and standard deviation of the PSD points + % 3) Evaluate the expected value, estimated from the std of the + % individual segments + % 4) Compares with the mean performed on the individual segments + % 5) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 6) Compares the grand-mean with the estimated white noise level + + % + + % + + if stest + atest = algo_test_psd_energy(ap, S_ap, S_expected_total, plist); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_27 + + + %% UTP_28 + + % + % + % Tests "conservation of energy": + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) Calculate the expected level of noise from sample statistics + % 3) Calculates the PSD of the individual parts, with: + % Hamming window and mean detrend + % 4) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 5) Checks on individual PSDs: mean and standard deviation of the PSD points + % 6) Evaluate the expected value, estimated from the std of the + % individual segments + % 7) Compares with the mean performed on the individual segments + % 8) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 9) Compares the grand-mean with the estimated white noise level + + % + function result = utp_28 + + % + % + % 1) Split the reference data into different segments + % 2) Calculates the PSD of the individual parts + % + % + + % + try + + % Calculate the expected level of noise from sample statistics + + % Evaluate the PSDs on the parts, employing: + % - Hamming window + % - mean detrend + win_type = 'Hanning'; + detrend_order = 0; + + [S_ap, S_sigma_total, S_expected_total] = ... + test_psd_energy_prepare_data(win_type, detrend_order, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 2) Checks on individual PSDs: mean and standard deviation of the PSD points + % 3) Evaluate the expected value, estimated from the std of the + % individual segments + % 4) Compares with the mean performed on the individual segments + % 5) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 6) Compares the grand-mean with the estimated white noise level + + % + + % + + if stest + atest = algo_test_psd_energy(ap, S_ap, S_expected_total, plist); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_28 + + %% UTP_29 + + % + % + % Tests "conservation of energy": + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) Calculate the expected level of noise from sample statistics + % 3) Calculates the PSD of the individual parts, with: + % Hamming window and linear detrend + % 4) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 5) Checks on individual PSDs: mean and standard deviation of the PSD points + % 6) Evaluate the expected value, estimated from the std of the + % individual segments + % 7) Compares with the mean performed on the individual segments + % 8) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 9) Compares the grand-mean with the estimated white noise level + + % + function result = utp_29 + + % + % + % 1) Split the reference data into different segments + % 2) Calculates the PSD of the individual parts + % + % + + % + try + + % Calculate the expected level of noise from sample statistics + + % Evaluate the PSDs on the parts, employing: + % - Hamming window + % - linear detrend + win_type = 'Hamming'; + detrend_order = 1; + + [S_ap, S_sigma_total, S_expected_total] = ... + test_psd_energy_prepare_data(win_type, detrend_order, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 2) Checks on individual PSDs: mean and standard deviation of the PSD points + % 3) Evaluate the expected value, estimated from the std of the + % individual segments + % 4) Compares with the mean performed on the individual segments + % 5) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 6) Compares the grand-mean with the estimated white noise level + + % + + % + + if stest + atest = algo_test_psd_energy(ap, S_ap, S_expected_total, plist); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_29 + + + %% UTP_30 + + % + % + % Tests "conservation of energy": + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) Calculate the expected level of noise from sample statistics + % 3) Calculates the PSD of the individual parts, with: + % BH92 window and no detrend + % 4) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 5) Checks on individual PSDs: mean and standard deviation of the PSD points + % 6) Evaluate the expected value, estimated from the std of the + % individual segments + % 7) Compares with the mean performed on the individual segments + % 8) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 9) Compares the grand-mean with the estimated white noise level + + % + function result = utp_30 + + % + % + % 1) Split the reference data into different segments + % 2) Calculates the PSD of the individual parts + % + % + + % + try + + % Calculate the expected level of noise from sample statistics + + % Evaluate the PSDs on the parts, employing: + % - BH92 window + % - no detrend + win_type = 'BH92'; + detrend_order = -1; + + [S_ap, S_sigma_total, S_expected_total] = ... + test_psd_energy_prepare_data(win_type, detrend_order, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 2) Checks on individual PSDs: mean and standard deviation of the PSD points + % 3) Evaluate the expected value, estimated from the std of the + % individual segments + % 4) Compares with the mean performed on the individual segments + % 5) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 6) Compares the grand-mean with the estimated white noise level + + % + + % + + if stest + atest = algo_test_psd_energy(ap, S_ap, S_expected_total, plist); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_30 + + + %% UTP_31 + + % + % + % Tests "conservation of energy": + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) Calculate the expected level of noise from sample statistics + % 3) Calculates the PSD of the individual parts, with: + % BH92 window and mean detrend + % 4) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 5) Checks on individual PSDs: mean and standard deviation of the PSD points + % 6) Evaluate the expected value, estimated from the std of the + % individual segments + % 7) Compares with the mean performed on the individual segments + % 8) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 9) Compares the grand-mean with the estimated white noise level + + % + function result = utp_31 + + % + % + % 1) Split the reference data into different segments + % 2) Calculates the PSD of the individual parts + % + % + + % + try + + % Calculate the expected level of noise from sample statistics + + % Evaluate the PSDs on the parts, employing: + % - BH92 window + % - mean detrend + win_type = 'BH92'; + detrend_order = 0; + + [S_ap, S_sigma_total, S_expected_total] = ... + test_psd_energy_prepare_data(win_type, detrend_order, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 2) Checks on individual PSDs: mean and standard deviation of the PSD points + % 3) Evaluate the expected value, estimated from the std of the + % individual segments + % 4) Compares with the mean performed on the individual segments + % 5) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 6) Compares the grand-mean with the estimated white noise level + + % + + % + + if stest + atest = algo_test_psd_energy(ap, S_ap, S_expected_total, plist); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_31 + + %% UTP_32 + + % + % + % Tests "conservation of energy": + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) Calculate the expected level of noise from sample statistics + % 3) Calculates the PSD of the individual parts, with: + % BH92 window and linear detrend + % 4) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 5) Checks on individual PSDs: mean and standard deviation of the PSD points + % 6) Evaluate the expected value, estimated from the std of the + % individual segments + % 7) Compares with the mean performed on the individual segments + % 8) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 9) Compares the grand-mean with the estimated white noise level + + % + function result = utp_32 + + % + % + % 1) Split the reference data into different segments + % 2) Calculates the PSD of the individual parts + % + % + + % + try + + % Calculate the expected level of noise from sample statistics + + % Evaluate the PSDs on the parts, employing: + % - BH92 window + % - linear detrend + win_type = 'BH92'; + detrend_order = 1; + + [S_ap, S_sigma_total, S_expected_total] = ... + test_psd_energy_prepare_data(win_type, detrend_order, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 2) Checks on individual PSDs: mean and standard deviation of the PSD points + % 3) Evaluate the expected value, estimated from the std of the + % individual segments + % 4) Compares with the mean performed on the individual segments + % 5) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 6) Compares the grand-mean with the estimated white noise level + + % + + % + + if stest + atest = algo_test_psd_energy(ap, S_ap, S_expected_total, plist); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_32 + + %% UTP_33 + + % + % + % Tests "conservation of energy": + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) Calculate the expected level of noise from sample statistics + % 3) Calculates the PSD of the individual parts, with: + % Kaiser200 window and no detrend + % 4) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 5) Checks on individual PSDs: mean and standard deviation of the PSD points + % 6) Evaluate the expected value, estimated from the std of the + % individual segments + % 7) Compares with the mean performed on the individual segments + % 8) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 9) Compares the grand-mean with the estimated white noise level + + % + function result = utp_33 + + % + % + % 1) Split the reference data into different segments + % 2) Calculates the PSD of the individual parts + % + % + + % + try + + % Calculate the expected level of noise from sample statistics + + % Evaluate the PSDs on the parts, employing: + % - Kaiser200 window + % - no detrend + win_type = 'Kaiser'; + psll = 200; + detrend_order = -1; + + [S_ap, S_sigma_total, S_expected_total] = ... + test_psd_energy_prepare_data(win_type, detrend_order, plist('psll', psll)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 2) Checks on individual PSDs: mean and standard deviation of the PSD points + % 3) Evaluate the expected value, estimated from the std of the + % individual segments + % 4) Compares with the mean performed on the individual segments + % 5) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 6) Compares the grand-mean with the estimated white noise level + + % + + % + + if stest + atest = algo_test_psd_energy(ap, S_ap, S_expected_total, plist); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_33 + + + %% UTP_34 + + % + % + % Tests "conservation of energy": + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) Calculate the expected level of noise from sample statistics + % 3) Calculates the PSD of the individual parts, with: + % Kaiser200 window and mean detrend + % 4) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 5) Checks on individual PSDs: mean and standard deviation of the PSD points + % 6) Evaluate the expected value, estimated from the std of the + % individual segments + % 7) Compares with the mean performed on the individual segments + % 8) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 9) Compares the grand-mean with the estimated white noise level + + % + function result = utp_34 + + % + % + % 1) Split the reference data into different segments + % 2) Calculates the PSD of the individual parts + % + % + + % + try + + % Calculate the expected level of noise from sample statistics + + % Evaluate the PSDs on the parts, employing: + % - Kaiser200 window + % - mean detrend + win_type = 'Kaiser'; + psll = 200; + detrend_order = 0; + + [S_ap, S_sigma_total, S_expected_total] = ... + test_psd_energy_prepare_data(win_type, detrend_order, plist('psll', psll)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 2) Checks on individual PSDs: mean and standard deviation of the PSD points + % 3) Evaluate the expected value, estimated from the std of the + % individual segments + % 4) Compares with the mean performed on the individual segments + % 5) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 6) Compares the grand-mean with the estimated white noise level + + % + + % + + if stest + atest = algo_test_psd_energy(ap, S_ap, S_expected_total, plist); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_34 + + %% UTP_35 + + % + % + % Tests "conservation of energy": + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) Calculate the expected level of noise from sample statistics + % 3) Calculates the PSD of the individual parts, with: + % Kaiser200 window and linear detrend + % 4) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 5) Checks on individual PSDs: mean and standard deviation of the PSD points + % 6) Evaluate the expected value, estimated from the std of the + % individual segments + % 7) Compares with the mean performed on the individual segments + % 8) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 9) Compares the grand-mean with the estimated white noise level + + % + function result = utp_35 + + % + % + % 1) Split the reference data into different segments + % 2) Calculates the PSD of the individual parts + % + % + + % + try + + % Calculate the expected level of noise from sample statistics + + % Evaluate the PSDs on the parts, employing: + % - Kaiser200 window + % - linear detrend + win_type = 'Kaiser'; + psll = 200; + detrend_order = 1; + + [S_ap, S_sigma_total, S_expected_total] = ... + test_psd_energy_prepare_data(win_type, detrend_order, plist('psll', psll)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Evaluate the mean and standard deviation of the Checks on individual PSDs: + % 2) Checks on individual PSDs: mean and standard deviation of the PSD points + % 3) Evaluate the expected value, estimated from the std of the + % individual segments + % 4) Compares with the mean performed on the individual segments + % 5) Checks on averaged PSDs: mean and standard deviation of all the PSD points + % 6) Compares the grand-mean with the estimated white noise level + + % + + % + + if stest + atest = algo_test_psd_energy(ap, S_ap, S_expected_total, plist); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_35 + + %% UTP_38 + + % + % + % Tests "conservation of energy": + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) evaluate the sample mean value m and standard deviation s + % 3) add a given trend of order n + % 4) psd of the noise, with proper detrending + % 5) compares the sqrt(sum(S * df)) with the standard deviation s + % + + % + function result = utp_38 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Add a trend + % 4) Estimate the psd + % + % + + % + try + fs = 10; + nsecs = 3600; + sigma_distr = 1; + trend_0 = 0; + trend_1 = 2e-6; + trend_2 = 5e-10; + + % White noise + type = 'Normal'; + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + + % Drift signal + a_d = ao(plist('tsfcn', [num2str(trend_0) '*t.^0 + ' num2str(trend_1) ' *t + ' num2str(trend_2) ' *t.^2'], ... + 'fs', fs, 'nsecs', nsecs)); + + % Total signal + a = a_n + a_d; + + % Estimate the mean value and the sigma of the white noise time-series data + sigma_sample = std(a_n.y, 1); + + % Evaluate the psd of the white noise time-series data + % Parameters are crucial for the estimate to be correct! + win = 'Rectangular'; + olap = 0; + detrend = 0; + n_pts = -1; + scale = 'PSD'; + + S_n = a_n.psd(plist('Win', win, 'olap', olap, ... + 'Nfft', n_pts, 'order', detrend, 'scale', scale)); + + % Evaluate the psd of the "drifting" time-series data + % Parameters are crucial for the estimate to be correct! + win = 'Rectangular'; + olap = 0; + detrend = 2; + n_pts = -1; + scale = 'PSD'; + + S = a.psd(plist('Win', win, 'olap', olap, ... + 'Nfft', n_pts, 'order', detrend, 'scale', scale)); + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psd energy equals the rms content of the tsdata, estimated by the std of the sample + % + % + + % + atest = true; + TOL = 1e-3; + + if stest + % Integrals of the spectra + sigma_psd = sqrt(sum(S.y * S.x(2))); + sigma_psd_n = sqrt(sum(S_n.y * S_n.x(2))); + + if abs(sigma_psd - sigma_sample) / mean([sigma_psd sigma_sample]) >= TOL || ... + abs(sigma_psd_n - sigma_sample) / mean([sigma_psd_n sigma_sample]) >= TOL + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_38 + + + %% UTP_39 + + % + % + % Tests "conservation of energy": + % 1) white noise produced from uniform pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) evaluate the sample mean value m and standard deviation s + % 3) add a given trend of order n + % 4) psd of the noise, with proper detrending + % 5) compares the sqrt(sum(S * df)) with the standard deviation s + % + + % + function result = utp_39 + + % + % + % 1) Prepare the test tsdata: + % white noise from uniform distribution + offset + % 2) Calculate the statistical parameters + % 3) Add a trend + % 4) Estimate the psd + % + % + + % + try + % Build time-series test data + fs = 1; + nsecs = 86400; + sigma_distr = 1e-9; + trend_0 = 3e-7; + trend_1 = 1e-7; + trend_2 = 2e-14; + + % White noise + type = 'Uniform'; + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + + % Drift signal + a_d = ao(plist('tsfcn', [num2str(trend_0) '*t.^0 + ' num2str(trend_1) ' *t + ' num2str(trend_2) ' *t.^2'], ... + 'fs', fs, 'nsecs', nsecs)); + + % Total signal + a = a_n + a_d; + + % Estimate the mean value and the sigma of the white noise time-series data + sigma_sample = std(a_n.y, 1); + + % Evaluate the psd of the white noise time-series data + % Parameters are crucial for the estimate to be correct! + win = 'Rectangular'; + olap = 0; + detrend = 0; + n_pts = -1; + scale = 'PSD'; + + S_n = a_n.psd(plist('Win', win, 'olap', olap, ... + 'Nfft', n_pts, 'order', detrend, 'scale', scale)); + + % Evaluate the psd of the "drifting" time-series data + % Parameters are crucial for the estimate to be correct! + win = 'Rectangular'; + olap = 0; + detrend = 2; + n_pts = -1; + scale = 'PSD'; + + S = a.psd(plist('Win', win, 'olap', olap, ... + 'Nfft', n_pts, 'order', detrend, 'scale', scale)); + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psd energy equals the rms content of the tsdata, estimated by the std of the sample + % + % + + % + atest = true; + TOL = 1e-3; + + if stest + % Integrals of the spectra + sigma_psd = sqrt(sum(S.y * S.x(2))); + sigma_psd_n = sqrt(sum(S_n.y * S_n.x(2))); + + if abs(sigma_psd - sigma_sample) / mean([sigma_psd sigma_sample]) >= TOL || ... + abs(sigma_psd_n - sigma_sample) / mean([sigma_psd_n sigma_sample]) >= TOL + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_39 + + %% UTP_40 + + % + % + % Tests "conservation of energy": + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) evaluate the sample mean value m and standard deviation s + % 3) add a given trend of order n + % 4) psd of the noise, with proper detrending + % 5) compares the sqrt(sum(S * df)) with the standard deviation s + % + + % + function result = utp_40 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Add a trend + % 4) Estimate the psd + % + % + + % + try + % Build time-series test data + + fs = 100; + nsecs = 100; + sigma_distr = 1e-12; + trend_0 = -5e-12; + trend_1 = 4e-13; + trend_2 = 1.17e-14; + + % White noise + type = 'Normal'; + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + + % Drift signal + a_d = ao(plist('tsfcn', [num2str(trend_0) '*t.^0 + ' num2str(trend_1) ' *t + ' num2str(trend_2) ' *t.^2'], ... + 'fs', fs, 'nsecs', nsecs)); + + % Total signal + a = a_n + a_d; + + % Estimate the mean value and the sigma of the white noise time-series data + sigma_sample = std(a_n.y, 1); + + % Evaluate the psd of the white noise time-series data + % Parameters are crucial for the estimate to be correct! + win = 'Rectangular'; + olap = 0; + detrend = 0; + n_pts = -1; + scale = 'PSD'; + + S_n = a_n.psd(plist('Win', win, 'olap', olap, ... + 'Nfft', n_pts, 'order', detrend, 'scale', scale)); + + % Evaluate the psd of the "drifting" time-series data + % Parameters are crucial for the estimate to be correct! + win = 'Rectangular'; + olap = 0; + detrend = 2; + n_pts = -1; + scale = 'PSD'; + + S = a.psd(plist('Win', win, 'olap', olap, ... + 'Nfft', n_pts, 'order', detrend, 'scale', scale)); + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psd energy equals the rms content of the tsdata, estimated by the std of the sample + % + % + + % + atest = true; + TOL = 1e-3; + + if stest + % Integrals of the spectra + sigma_psd = sqrt(sum(S.y * S.x(2))); + sigma_psd_n = sqrt(sum(S_n.y * S_n.x(2))); + + if abs(sigma_psd - sigma_sample) / mean([sigma_psd sigma_sample]) >= TOL || ... + abs(sigma_psd_n - sigma_sample) / mean([sigma_psd_n sigma_sample]) >= TOL + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_40 + + + + %% UTP_41 + + % + % + % Tests the effect of windowing: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) psd of the noise, without detrending, Rectangular window + % 3) Apply the detrending and the window manually + % 4) psd of the noise, without detrending, Rectangular window + % 5) compares the to psds + % + + % + function result = utp_41 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd without detrending, Rectangular window + % 4) Manually apply window to the data + % 5) Estimate the psd without detrending, Rectangular window + % + % + + % + try + + noise_type = 'Normal'; + win_type = 'Rectangular'; + scale = 'PSD'; + + [a, S_name, S_obj, S_man] = prepare_analyze_noise_win(win_type, noise_type, scale, ... + plist('win_test', true)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psds are identical within a part in 10^12 + % + % + + % + + TOL = 1e-12; + + if stest + atest = algo_test_psd_win(S_name, S_obj, S_man, plist('TOL', TOL)); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_41 + + %% UTP_42 + + % + % + % Tests the effect of windowing: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) psd of the noise, without detrending, BH92 window + % 3) Apply the detrending and the window manually + % 4) psd of the noise, without detrending, Rectangular window + % 5) compares the to psds + % + + % + function result = utp_42 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd without detrending, BH92 window + % 4) Manually apply window to the data + % 5) Estimate the psd without detrending, Rectangular window + % + % + + % + try + + noise_type = 'Normal'; + win_type = 'BH92'; + scale = 'PSD'; + + [a, S_name, S_obj, S_man] = prepare_analyze_noise_win(win_type, noise_type, scale, ... + plist('win_test', true)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psds are identical within a part in 10^12 + % + % + + % + + TOL = 1e-12; + + if stest + atest = algo_test_psd_win(S_name, S_obj, S_man, plist('TOL', TOL)); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_42 + + + %% UTP_43 + + % + % + % Tests the effect of windowing: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) psd of the noise, without detrending, Hamming window + % 3) Apply the detrending and the window manually + % 4) psd of the noise, without detrending, Rectangular window + % 5) compares the to psds + % + + % + function result = utp_43 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd without detrending, Hamming window + % 4) Manually apply window to the data + % 5) Estimate the psd without detrending, Rectangular window + % + % + + % + try + + noise_type = 'Normal'; + win_type = 'Hamming'; + scale = 'PSD'; + + [a, S_name, S_obj, S_man] = prepare_analyze_noise_win(win_type, noise_type, scale, ... + plist('win_test', true)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psds are identical within a part in 10^12 + % + % + + % + + TOL = 1e-12; + + if stest + atest = algo_test_psd_win(S_name, S_obj, S_man, plist('TOL', TOL)); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_43 + + %% UTP_44 + + % + % + % Tests the effect of windowing: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) psd of the noise, without detrending, Hanning window + % 3) Apply the detrending and the window manually + % 4) psd of the noise, without detrending, Rectangular window + % 5) compares the to psds + % + + % + function result = utp_44 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd without detrending, Hanning window + % 4) Manually apply window to the data + % 5) Estimate the psd without detrending, Rectangular window + % + % + + % + msg = ''; + try + + noise_type = 'Normal'; + win_type = 'Hanning'; + scale = 'PSD'; + + [a, S_name, S_obj, S_man] = prepare_analyze_noise_win(win_type, noise_type, scale, ... + plist('win_test', true)); + + stest = true; + + catch err + disp(err.message) + msg = err.message; + stest = false; + end + % + + % + % + % 1) Check that calculated psds are identical within a part in 10^12 + % + % + + % + + TOL = 1e-12; + + if stest + [atest, msg] = algo_test_psd_win(S_name, S_obj, S_man, plist('TOL', TOL)); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename, msg); + end % END UTP_44 + + %% UTP_45 + + % + % + % Tests the effect of windowing: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) psd of the noise, without detrending, Bartlett window + % 3) Apply the detrending and the window manually + % 4) psd of the noise, without detrending, Rectangular window + % 5) compares the to psds + % + + % + function result = utp_45 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd without detrending, Bartlett window + % 4) Manually apply window to the data + % 5) Estimate the psd without detrending, Rectangular window + % + % + + % + try + + noise_type = 'Normal'; + win_type = 'Bartlett'; + scale = 'PSD'; + + [a, S_name, S_obj, S_man] = prepare_analyze_noise_win(win_type, noise_type, scale, ... + plist('win_test', true)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psds are identical within a part in 10^12 + % + % + + % + + TOL = 1e-12; + + if stest + atest = algo_test_psd_win(S_name, S_obj, S_man, plist('TOL', TOL)); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_45 + + %% UTP_46 + + % + % + % Tests the effect of windowing: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) psd of the noise, without detrending, Nuttall3 window + % 3) Apply the detrending and the window manually + % 4) psd of the noise, without detrending, Rectangular window + % 5) compares the to psds + % + + % + function result = utp_46 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd without detrending, Nuttall3 window + % 4) Manually apply window to the data + % 5) Estimate the psd without detrending, Rectangular window + % + % + + % + msg = ''; + try + + noise_type = 'Normal'; + win_type = 'Nuttall3'; + scale = 'PSD'; + + [a, S_name, S_obj, S_man] = prepare_analyze_noise_win(win_type, noise_type, scale, ... + plist('win_test', true)); + + stest = true; + + catch err + disp(err.message) + msg = err.message; + stest = false; + end + % + + % + % + % 1) Check that calculated psds are identical within a part in 10^12 + % + % + + % + + TOL = 1e-12; + + if stest + [atest, msg] = algo_test_psd_win(S_name, S_obj, S_man, plist('TOL', TOL)); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename, msg); + end % END UTP_46 + + %% UTP_47 + + % + % + % Tests the effect of windowing: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) psd of the noise, without detrending, Kaiser psll = random window + % 3) Apply the detrending and the window manually + % 4) psd of the noise, without detrending, Rectangular window + % 5) compares the to psds + % + + % + function result = utp_47 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd without detrending, Kaiser psll = random window + % 4) Manually apply window to the data + % 5) Estimate the psd without detrending, Rectangular window + % + % + + % + try + + noise_type = 'Normal'; + win_type = 'Kaiser'; + psll = utils.math.randelement([10:10:200],1); + scale = 'PSD'; + + [a, S_name, S_obj, S_man] = prepare_analyze_noise_win(win_type, noise_type, scale, ... + plist('win_test', true)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psds are identical within a part in 10^12 + % + % + + % + + TOL = 1e-12; + + if stest + atest = algo_test_psd_win(S_name, S_obj, S_man, plist('TOL', TOL)); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_47 + + %% UTP_48 + + % + % + % Tests the effect of windowing: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) psd of the noise, without detrending, Kaiser psll = default window + % 3) Apply the detrending and the window manually + % 4) psd of the noise, without detrending, Rectangular window + % 5) compares the to psds + % + + % + function result = utp_48 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd without detrending, Kaiser psll = default window + % 4) Manually apply window to the data + % 5) Estimate the psd without detrending, Rectangular window + % + % + + % + try + + noise_type = 'Normal'; + win_type = 'Kaiser'; + scale = 'PSD'; + + [a, S_name, S_obj, S_man] = prepare_analyze_noise_win(win_type, noise_type, scale, ... + plist('win_test', true)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psds are identical within a part in 10^12 + % + % + + % + + TOL = 1e-12; + + if stest + atest = algo_test_psd_win(S_name, S_obj, S_man, plist('TOL', TOL)); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_48 + + + %% UTP_49 + + % + % + % Tests the effect of windowing: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) psd of the noise, without detrending, Nuttall4 window + % 3) Apply the detrending and the window manually + % 4) psd of the noise, without detrending, Rectangular window + % 5) compares the to psds + % + + % + function result = utp_49 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd without detrending, Nuttall4 window + % 4) Manually apply window to the data + % 5) Estimate the psd without detrending, Rectangular window + % + % + + % + try + + noise_type = 'Normal'; + win_type = 'Nuttall4'; + scale = 'PSD'; + + [a, S_name, S_obj, S_man] = prepare_analyze_noise_win(win_type, noise_type, scale, ... + plist('win_test', true)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psds are identical within a part in 10^12 + % + % + + % + + TOL = 1e-12; + + if stest + atest = algo_test_psd_win(S_name, S_obj, S_man, plist('TOL', TOL)); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_49 + + %% UTP_50 + + % + % + % Tests the effect of windowing: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) psd of the noise, without detrending, SFT3F window + % 3) Apply the detrending and the window manually + % 4) psd of the noise, without detrending, Rectangular window + % 5) compares the to psds + % + + % + function result = utp_50 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd without detrending, SFT3F window + % 4) Manually apply window to the data + % 5) Estimate the psd without detrending, Rectangular window + % + % + + % + try + + noise_type = 'Normal'; + win_type = 'SFT3F'; + scale = 'PSD'; + + [a, S_name, S_obj, S_man] = prepare_analyze_noise_win(win_type, noise_type, scale, ... + plist('win_test', true)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psds are identical within a part in 10^12 + % + % + + % + + TOL = 1e-12; + + if stest + atest = algo_test_psd_win(S_name, S_obj, S_man, plist('TOL', TOL)); + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_50 + + %% UTP_51 + + % + % + % Tests the possibility to set the number of averages rather than setting the Nfft: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) psd of the noise, without detrending, random window, set number of + % averages + % 3) check the effective number of averages + % + + % + function result = utp_51 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) psd of the noise, without detrending, random window, set number of + % averages + % + % + + % + try + noise_type = 'Normal'; + + % Evaluate the psd of the white noise time-series data + [a, S1, S2, navs] = prepare_analyze_noise_navs(noise_type, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated navs are identical to those requested + % + % + + % + atest = true; + + if stest + % Compare the navs written in the output object with the requested one + if ne(navs, S1.data.navs) + if ne(find(S1.hist.plistUsed, 'navs'), S1.data.navs) + atest = false; + end + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_51 + + %% UTP_52 + + % + % + % Tests the possibility to set the number of averages rather than setting the Nfft: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) psd of the noise, without detrending, random window, random navs + % 3) get the number of averages + % 4) get the nfft used + % 5) run psd again, with the nfft used + % 6) compare the calculated objects + % + + % + function result = utp_52 + + % + % + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) psd of the noise, without detrending, random window, random navs + % 3) get the number of averages + % 4) get the nfft used + % 5) run psd again, with the nfft used + % + % + + % + try + noise_type = 'Normal'; + + % Evaluate the psd of the white noise time-series data + [a, S1, S2, navs] = prepare_analyze_noise_navs(noise_type, plist); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated objects S1 and S2 are identical + % + % + + % + atest = true; + + if stest + % Compare the output objects + if ne(S1, S2, ple3) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_52 + + %% UTP_53 + + % + % + % Tests the possibility to set the number of averages rather than setting the Nfft: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) psd of the noise, without detrending, random window, random navs + % 3) get the number of averages + % 4) get the nfft used + % 5) run psd again, with the nfft used + % 6) compare navs, nfft, psds + % + + % + function result = utp_53 + + % + % + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) psd of the noise, without detrending, random window, random navs + % 3) get the number of averages + % 4) get the nfft used + % 5) run psd again, with the nfft used + % 6) run psd again, with conflicting parameters, and verify it uses + % nfft rather than navs + % + % + + % + try + noise_type = 'Uniform'; + + % Evaluate the psd of the white noise time-series data + [a, S1, S2, navs] = prepare_analyze_noise_navs(noise_type, plist); + + npts_3 = fix(find(S1.hist.plistUsed, 'Nfft')/2); + + % Calculates the psd asking for the number of points AND the window length + pl_spec = S1.hist.plistUsed; + pl_spec.pset('Nfft', npts_3, 'navs', navs); + S3 = a.psd(pl_spec); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated objects S1 and S2 are identical + % 2) Check that S3 used different values + % + % + + % + atest = true; + + if stest + % Compare the navs written in the output object with the requested one + if ne(S1, S2, ple3) || ... + ne(find(S3.hist.plistUsed, 'Nfft'), npts_3) || eq(S3.data.navs, navs) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_53 + + %% UTP_54 + + % + % + % Tests "conservation of energy": + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd order) + % 2) evaluate the sample mean value m and standard deviation s + % 3) psd of the white noise + % 4) compares the sqrt(sum(S * df)) with the standard deviation s + % + + % + function result = utp_54 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd + % + % + + % + try + % Array of parameters to pick from + fs_list = [0.1;1;10]; + nsecs_list = [100:100:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + mu_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + mu_distr = utils.math.randelement(mu_distr_list, 1); + + % White noise + type = 'Normal'; + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_const = ao(mu_distr); + a = a_n + a_const; + + % Estimate the mean value and the sigma of the time-series data + sigma_sample = std(a.y, 1); + mu_sample = mean(a.y); + + % Evaluate the psd of the time-series data + % Parameters are crucial for the estimate to be correct! + win = 'Rectangular'; + olap = 0; + detrend = 0; + n_pts = -1; + scale = 'PSD'; + + S = a.psd(plist('Win', win, 'olap', olap, ... + 'Nfft', n_pts, 'order', detrend, 'scale', scale)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated psd energy equals the rms content of the tsdata, estimated by the std of the sample + % + % + + % + atest = true; + TOL = 1e-12; + + if stest + % Integral of the spectrum + sigma_psd = sqrt(sum(S.y * S.x(2))); + if abs(sigma_psd - sigma_sample) / mean([sigma_psd sigma_sample]) >= TOL + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_54 + + %% UTP_60 + + % + % + % Tests the 'basic' call: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) psd of the noise, defualt detrending, default window, no averaging + % + + % + function result = utp_60 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd with default detrending, default window, no averaging + % + % + + % + try + + noise_type = 'Normal'; + win_type = char(prefs.getMiscPrefs.getDefaultWindow); + scale = 'PSD'; + + [a, S_name, S_obj, S_man] = prepare_analyze_noise_win(win_type, noise_type, scale, ... + plist('win_test', false, 'reduce_pts', false)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Nothing to check + % + % + + % + + if stest + atest = true; + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_60 + + %% UTP_61 + + % + % + % Tests the 'basic' call: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) psd of the noise, defualt detrending, default window, no averaging + % + + % + function result = utp_61 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd with default detrending, default window, no averaging + % + % + + % + try + + noise_type = 'Normal'; + win_type = char(prefs.getMiscPrefs.getDefaultWindow); + scale = 'ASD'; + + [a, S_name, S_obj, S_man] = prepare_analyze_noise_win(win_type, noise_type, scale, ... + plist('win_test', false, 'reduce_pts', false)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Nothing to check + % + % + + % + + if stest + atest = true; + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_61 + + %% UTP_62 + + % + % + % Tests the 'basic' call: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) psd of the noise, defualt detrending, default window, no averaging + % + + % + function result = utp_62 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd with default detrending, default window, no averaging + % + % + + % + try + + noise_type = 'Normal'; + win_type = char(prefs.getMiscPrefs.getDefaultWindow); + scale = 'PS'; + + [a, S_name, S_obj, S_man] = prepare_analyze_noise_win(win_type, noise_type, scale, ... + plist('win_test', false, 'reduce_pts', false)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Nothing to check + % + % + + % + + if stest + atest = true; + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_62 + + %% UTP_63 + + % + % + % Tests the 'basic' call: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) psd of the noise, defualt detrending, default window, no averaging + % + + % + function result = utp_63 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Calculate the statistical parameters + % 3) Estimate the psd with default detrending, default window, no averaging + % + % + + % + try + + noise_type = 'Normal'; + win_type = char(prefs.getMiscPrefs.getDefaultWindow); + scale = 'AS'; + + [a, S_name, S_obj, S_man] = prepare_analyze_noise_win(win_type, noise_type, scale, ... + plist('win_test', false, 'reduce_pts', false)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Nothing to check + % + % + + % + + if stest + atest = true; + else + atest = false; + end + + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_63 + + %% Helper function for window call construction + + function [a, S_name, S_obj, S_w] = prepare_analyze_noise_win(win_type, noise_type, scale, pli) + % Array of parameters to pick from + fs_list = [0.1;1;2;5;10]; + nsecs_list = [20 100 1000:1000:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + trend_0_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + trend_0 = utils.math.randelement(trend_0_list, 1); + + % Pick units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + + % White noise + a_n = ao(plist('waveform', 'noise', ... + 'type', noise_type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + + % Constant signal + a_c = ao(trend_0); + + % Total signal + a = a_n + a_c; + + % Set units + a.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the psd of the white noise time-series data + n_pts_reduction_factor = find(pli, 'reduce_pts'); + if isempty(n_pts_reduction_factor) || ~n_pts_reduction_factor + n_pts_reduction_factor = 1; % Taking single windows, no reduction in number of points + end + n_pts = a.nsecs * a.fs/ n_pts_reduction_factor; + + olap = find(pli, 'olap'); + if isempty(olap) + olap = 0; %% Should we take the rov instead? + end + if n_pts_reduction_factor == 1 + olap = 0; % This does not matter in the case of single window + end + + detrend_order = 0; + + switch lower(win_type) + case 'kaiser' + psll = find(pli, 'psll'); + if isempty(psll) + psll = find(ao.getInfo('psd').plists, 'psll'); + end + win = specwin(win_type, fs*nsecs, psll); + pl_spec = plist('Win', win_type, 'psll', psll, 'olap', olap, ... + 'Nfft', n_pts, 'order', detrend_order, 'scale', scale); + otherwise + win = specwin(win_type, fs*nsecs); + pl_spec = plist('Win', win_type, 'olap', olap, ... + 'Nfft', n_pts, 'order', detrend_order, 'scale', scale); + end + + if find(pli, 'win_test') + % Makes a copy of the data, and apply the window manually + % Apply the detrending + a_w = a.detrend(plist('N', detrend_order)); + % Apply the window, taking into account the correct normalization + a_w.setY(a_w.y .* win.win'./sqrt(win.ws2 / win.len)); + + % Evaluate the psd of the windowed data + S_w = a_w.psd(plist('Win', 'Rectangular', 'olap', olap, ... + 'Nfft', n_pts, 'order', -1, 'scale', scale)); + + % Calls psd applying the detrend and window internally + % (passig window object) + S_obj = a.psd(pl_spec); + + else + S_obj = ao; + S_w = ao; + end + + % Calls psd applying the detrend and window internally + % (passig window name) + pl_spec.pset('Win', win_type); + S_name = a.psd(pl_spec); + + end + + + %% Helper function for window call construction + + function [sigma_sample, sigma_psd] = prepare_analyze_noise_energy(win_type, noise_type, scale, pli) + + % Build time-series test data + if find(pli, 'fs') + fs = find(pli, 'fs'); + nsecs = find(pli, 'nsecs'); + sigma_distr = find(pli, 'sigma_distr'); + mu_distr = find(pli, 'mu_distr'); + else + % Array of parameters to pick from + fs_list = [0.1;1;10]; + nsecs_list = [100:100:10000]; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + mu_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + mu_distr = utils.math.randelement(mu_distr_list, 1); + end + + % Pick units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + + % White noise + a_n = ao(plist('waveform', 'noise', ... + 'type', noise_type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + + % Constant signal + a_c = ao(mu_distr); + + % Total signal + a = a_n + a_c; + + % Set units + a.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the psd of the white noise time-series data + olap = find(pli, 'olap'); + if isempty(olap) + olap = 0; %% Should we take the rov instead? + end + + detrend_order = find(pli, 'detrend_order'); + if isempty(detrend_order) + detrend_order = 0; + end + + n_pts = -1; + + switch lower(win_type) + case 'kaiser' + psll = find(pli, 'psll'); + if isempty(psll) + psll = find(ao.getInfo('psd').plists, 'psll'); + end + win = specwin(win_type, fs*nsecs, psll); + pl_spec = plist('Win', win_type, 'psll', psll, 'olap', olap, ... + 'Nfft', n_pts, 'order', detrend_order, 'scale', scale); + otherwise + win = specwin(win_type, fs*nsecs); + pl_spec = plist('Win', win_type, 'olap', olap, ... + 'Nfft', n_pts, 'order', detrend_order, 'scale', scale); + end + + % Calls psd applying the detrend and window internally + % (passig window name) + pl_spec.pset('Win', win_type); + S = a.psd(pl_spec); + + % Evaluate the statistics of the time-series and spectra + + % Estimate the mean value and the sigma of the time-series data + sigma_sample = std(a.y, 1); + mu_sample = mean(a.y); + + % Integral of the spectrum + sigma_psd = sqrt(sum(S.y * S.x(2))); + + end + + %% Helper function for window call construction, navs option + + function [a, S, S1, navs] = prepare_analyze_noise_navs(noise_type, pli) + % Array of parameters to pick from + fs_list = [0.1;1;2;5;10]; + nsecs_list = [2000:1000:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + trend_0_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + trend_0 = utils.math.randelement(trend_0_list, 1); + + % Pick units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + + % White noise + a_n = ao(plist('waveform', 'noise', ... + 'type', noise_type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + + % Constant signal + a_c = ao(trend_0); + + % Total signals + a = a_n + a_c; + + % Set units + a.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the psd of the white noise time-series data + olap = 0; + detrend_order = 0; + n_pts = -1; + + navs = fix(utils.math.randelement(logspace(0,log10(max(0,a.len/10)),50),1)); + + % Evaluate the psd of the white noise time-series data + % Window + win_list = specwin.getTypes; + win_type = utils.math.randelement(win_list,1); + win_type = win_type{1}; + + switch lower(win_type) + case 'kaiser' + psll = utils.math.randelement([0:10:200],1); + if psll == 0 + psll = find(ao.getInfo('psd').plists, 'psll'); + end + pl_spec = plist('Win', win_type, 'psll', psll, 'olap', olap, 'order', detrend_order); + case 'levelledhanning' + pl_spec = plist('Win', 'BH92', 'olap', olap, 'order', detrend_order); + otherwise + pl_spec = plist('Win', win_type, 'olap', olap, 'order', detrend_order); + end + + % Calls psd asking for the number of averages + pl_spec.pset('Nfft', n_pts, 'navs', navs); + S = a.psd(pl_spec); + + % Calls psd asking for the number of points just evaluated + pl_spec.pset('Nfft', find(S.hist.plistUsed, 'Nfft')); + pl_spec.remove('navs'); + S1 = a.psd(pl_spec); + + end + + %% Helper function for window call construction, navs option + function [S_ap, S_sigma_total, S_expected_total] = test_psd_energy_prepare_data(win_type, detrend_order, pli) + + % Calculate the expected level of noise from sample statistics + fs = a_n_long.fs; + S_sigma_total = std(a_n_long.y, 1); + S_expected_total = S_sigma_total^2 / fs * 2; + + olap = 0; + n_pts = -1; + scale = 'PSD'; + + switch lower(win_type) + case 'kaiser' + psll = find(pli, 'psll'); + if isempty(psll) + psll = find(ao.getInfo('psd').plists, 'psll'); + end + pl_spec = plist('Win', win_type, 'psll', psll, 'olap', olap, ... + 'Nfft', n_pts, 'order', detrend_order, 'scale', scale); + case 'levelledhanning' + pl_spec = plist('Win', 'BH92', 'olap', olap, ... + 'Nfft', n_pts, 'order', detrend_order, 'scale', scale); + otherwise + pl_spec = plist('Win', win_type, 'olap', olap, ... + 'Nfft', n_pts, 'order', detrend_order, 'scale', scale); + end + + % Calls psd applying the detrend and window internally + % (passig window name) + S_ap = ap.psd(pl_spec); + + end + + %% Algorithm test for window comparison + + function varargout = algo_test_psd_win(S_name, S_obj, S_man, pli) + atest = true; + msg = ''; + pl_def = plist('TOL', 1e-12); + TOL = find(parse(pli, pl_def), 'TOL'); + + % Compare the psd evaluated with the window name / object + if ~eq(S_name, S_obj, ple1) + atest = false; + msg = ['Two PSD objects are not equal: ' lastwarn]; + end + % Compare the psd evaluated with the two methods + res = abs(S_obj - S_man) ./ S_obj; + if any(res.y >= TOL) + atest = false; + msg = 'Two PSDs are not equal'; + end + + if nargout == 1 + varargout{1} = atest; + elseif nargout == 2 + varargout{1} = atest; + varargout{2} = msg; + else + error('Incorrect outputs'); + end + + end + + + %% Algorithm test for energy conservation tests + + function atest = algo_test_psd_energy(ap, S_ap, S_expected_total, pli) + + % Checks on individual PSDs: mean and standard deviation of the + % PSD points + fs = ap.fs; + Npoints = length(S_ap(1).y); + S_mean = mean(S_ap.y); + S_err = std(S_ap.y, 1) / sqrt(Npoints); + + % Expected value, estimated from the std of the individual segments + S_sigma = std(ap.y, 1); + S_expected = S_sigma.^2 / fs * 2; + + % Comparison with the mean performed on the individual segments + test_level = abs(S_mean - S_expected) < S_err; + sum(test_level) / Nsegments; % TODO: implement hypothesis test here + + % Checks on averaged PSDs: mean and standard deviation of all the + % PSD points + S_mean_total = mean(S_mean); + S_err_total = std(S_mean) / sqrt(Nsegments); + + % Compares the grand-mean with the estimated white noise level + if sum(abs(S_mean_total - S_expected_total) < S_err_total) + atest = true; + else + atest = false; + end + + end + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_rdivide.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_rdivide.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,125 @@ +% UTP_AO_RDIVIDE a set of UTPs for the ao/rdivide method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_rdivide.m,v 1.8 2010/09/21 17:00:41 ingo Exp $ +% + +% +% +% The rdivide method of the ao class computes the subtraction of the y +% data of two inputs. +% +% + +function results = utp_ao_rdivide(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'rdivide'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_generic_aop_rule1(@rdivide)]; % Rule 1 + results = [results utp_generic_aop_rule2(@rdivide)]; % Rule 2 + results = [results utp_generic_aop_rule3(@rdivide)]; % Rule 3 + results = [results utp_generic_aop_rule4(@rdivide)]; % Rule 4 + results = [results utp_generic_aop_rule5(@rdivide)]; % Rule 5 + results = [results utp_generic_aop_rule6(@rdivide)]; % Rule 6 + results = [results utp_generic_aop_rule7(@rdivide)]; % Rule 7 + results = [results utp_generic_aop_rule8(@rdivide)]; % Rule 8 + results = [results utp_generic_aop_rule9(@rdivide)]; % Rule 9 + results = [results utp_generic_aop_rule10(@rdivide)]; % Rule 10 + results = [results utp_generic_aop_rule11(@rdivide)]; % Rule 11 + results = [results utp_generic_aop_negative_tests(@rdivide)]; % Negative tests + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_real.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_real.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,624 @@ +% UTP_AO_REAL a set of UTPs for the ao/real method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_real.m,v 1.12 2011/04/17 10:47:02 hewitson Exp $ +% + +% +% +% The real method of the ao class computes the real part of the y +% and/or x data. +% +% + +function results = utp_ao_real(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'real'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with additional plist with the key 'axis' + results = [results utp_09]; % Test input data shape == output data shape + results = [results utp_10]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the real method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the real method works for a vector of AOs as input. + % + % + + try + % + out = real(atvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check each output against the real part of the input + for kk=1:numel(out) + if ~isequal(real(atvec(kk).data.getY), out(kk).data.getY) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the real method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the real method works for a matrix of AOs as input. + % + % + + try + % + out = real(atmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check each output against the real part of the input + for kk=1:numel(out) + if ~isequal(real(atmat(kk).data.getY), out(kk).data.getY) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the real method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the real method works for a list of AOs as input. + % + % + + try + % + out = real(at1,at2,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the real part of the input + if ~isequal(real(at1.data.getY), out(1).data.getY), atest = false; end + if ~isequal(real(at2.data.getY), out(2).data.getY), atest = false; end + if ~isequal(real(at3.data.getY), out(3).data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the real method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the real method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = real(at1,atvec,at2,atmat,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(atmat)+numel(atvec)), atest = false; end + % Check the first input + nout = 1; + if ~isequal(real(at1.data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + % Check the elements of the input vector + for jj=1:numel(atvec) + if ~isequal(real(atvec(jj).data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + end + % Check the 3rd input + if ~isequal(real(at2.data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + % Check the elements of the input matrix + for jj=1:numel(atmat) + if ~isequal(real(atmat(jj).data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + end + % Check the last input + if ~isequal(real(at3.data.getY), out(nout).data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the real method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the real method can be processed back + % to an m-file. + % + % + + try + % + out = real(at1); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'real'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'real'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the real method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the real method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = ain.real(); + ain.real(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is real(at1). + % + % + + atest = true; + if stest + % + % Check that real modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that real doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the real value of the copy + if ~isequal(real(at1.data.getY), ain.data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the real method can modify the single axis controlled by the + % plist and the resuld can be processed back to an m-file. + % + % + + try + % + plx = plist('axis', 'X'); + ply = plist('axis', 'Y'); + plxy = plist('axis', 'XY'); + out1 = real(at1, plx); + out2 = real(at1, ply); + out3 = real(at1, plxy); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the real method applies to the x-axis + % 2) Check that the real method applies to the y-axis + % 3) Check that the real method applies to both axes + % 4) Check that the re-built objects are the same object as 'out[1..3]'. + % + % + + atest = true; + if stest + % + % Check each output against the real part of the input + if ~isequal(real(at1.data.getX), out1.data.getX), atest = false; end + if ~isequal(at1.data.getY, out1.data.getY), atest = false; end + if ~isequal(at1.data.getX, out2.data.getX), atest = false; end + if ~isequal(real(at1.data.getY), out2.data.getY), atest = false; end + if ~isequal(real(at1.data.getX), out3.data.getX), atest = false; end + if ~isequal(real(at1.data.getY), out3.data.getY), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Control the method with a plist. + % + % + function result = utp_09 + + % + % + % Test that the real method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = real(at5); + out2 = real(at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.x) ~= size(at5.data.x), atest = false; end + if size(out1.data.y) ~= size(at5.data.y), atest = false; end + if size(out2.data.x) ~= size(at6.data.x), atest = false; end + if size(out2.data.y) ~= size(at6.data.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the real method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_10 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = real(at5, at6); + o3 = real(at5, at6); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_rebuild.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_rebuild.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,415 @@ +% UTP_AO_REBUILD a set of UTPs for the ao/rebuild method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_rebuild.m,v 1.3 2009/08/07 11:27:08 hewitson Exp $ +% + +% +% +% The rebuild method of the ao class rebuilds the input objects using the +% history. This method is also intensively tested in the most other UTPs. +% +% + +function results = utp_ao_rebuild(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'rebuild'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AO objects + [at1, at2, at3, at4, at5, at6, atv, atm] = get_test_objects_ao; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the output + + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the rebuild method works with a vector of AO objects as input. + % + % + function result = utp_02 + + % + % + % Test that the rebuild method works for a vector of AO objects as input. + % + % + + try + % + out = rebuild(atv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + % Check the output + if ~isa(out, 'ao'), atest = false; end; + for kk = 1:numel(atv) + if eq(out(kk), atv(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the rebuild method works with a matrix of AO objects as input. + % + % + function result = utp_03 + + % + % + % Test that the rebuild method works for a matrix of AO objects as input. + % + % + + try + % + out = rebuild(atm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + if ~isa(out, 'ao'), atest = false; end; + for kk = 1:numel(atm) + if eq(out(kk), atm(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the rebuild method works with a list of AO objects as input. + % + % + function result = utp_04 + + % + % + % Test that the rebuild method works for a list of AO objects as input. + % + % + + try + % + out = rebuild(at5,at4,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + atin = [at5,at4,at3]; + if stest + % + if ~isa(out, 'ao'), atest = false; end; + for kk = 1:numel(atin) + if eq(out(kk), atin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the rebuild method works with a mix of different shaped AO objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the rebuild method works with an input of matrices and vectors + % and single AO objects. + % + % + + try + % + out = rebuild(at4,atv,at2,atm,at1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + atin = [at4,reshape(atv,1,[]),at2,reshape(atm,1,[]),at1]; + if stest + % + if ~isa(out, 'ao'), atest = false; end; + for kk = 1:numel(atin) + if eq(out(kk), atin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the rebuild method properly applies history. + % + % + function result = utp_06 + + % + % + % The method rebuild doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the rebuild method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = rebuild(at1, at2); + o3 = rebuild(at1, at2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, at1, ple2), atest = false; end + if ~eq(o2, at2, ple2), atest = false; end + if ~eq(o3, [at1 at2], ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_resample.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_resample.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,537 @@ +% UTP_AO_RESAMPLE a set of UTPs for the ao/resample method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_resample.m,v 1.11 2009/08/07 11:27:09 hewitson Exp $ +% + +% +% +% The resample method of the ao class resamples time-series AOs. +% +% + +function results = utp_ao_resample(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'resample'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_11(mthd, at1, ple1, plist('fsout', at1.fs*2))]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('fsout'), atest = false; end + if ~io(3).plists.isparam('filter'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('fsout')), atest = false; end + if ~isEmptyChar(io(3).plists.find('filter')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('fsout'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('filter'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the resample method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the resample method works for a vector of AOs as input. + % + % + + try + % + avec = [at1 at5 at6]; + out = resample(avec, plist('FSOUT', 5)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the resample method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the resample method works for a matrix of AOs as input. + % + % + + try + % + amat = [at1 at5 at6; at5 at6 at1]; + out = resample(amat, plist('FSOUT', 5)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the resample method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the resample method works for a list of AOs as input. + % + % + + try + % + out = resample(at1,at5,at6, plist('FSOUT', 5)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the resample method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the resample method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = resample(at1,[at5 at6],at5,[at5 at1; at6 at1],at6, plist('FSOUT', 5)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the resample method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the resample method can be processed back + % to an m-file. + % + % + + try + % + out = resample(at5, plist('FSOUT', 5)); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'resample'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'resample'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the resample method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the resample method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + pl = plist('fsout', 3); + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = ain.resample(pl); + ain.resample(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is resample(at1). + % + % + + atest = true; + if stest + % + % Check that resample modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that resample doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the resample method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + pl = plist('fsout', 3); + % + out1 = resample(at5, pl); + out2 = resample(at6, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y) ~= size(at5.data.y), atest = false; end + if size(out2.data.y) ~= size(at6.data.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the resample method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + pl = plist('fsout', 3); + [o1, o2] = resample(at5, at6, pl); + o3 = resample(at5, at6, pl); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_rms.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_rms.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,531 @@ +% UTP_AO_RMS a set of UTPs for the ao/rms method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_rms.m,v 1.9 2009/08/07 11:27:08 hewitson Exp $ +% + +% +% +% The rms method of the ao class computes the integrated RMS of +% frequency-series AOs. +% +% + +function results = utp_ao_rms(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'rms'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_11(mthd, at2, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the rms method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the rms method works for a vector of AOs as input. + % + % + + try + % + avec = [at2 at2 at2]; + out = rms(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the rms method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the rms method works for a matrix of AOs as input. + % + % + + try + % + amat = [at2 at2 at2; at2 at2 at2]; + out = rms(amat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the rms method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the rms method works for a list of AOs as input. + % + % + + try + % + out = rms(at2,at2,at2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the rms method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the rms method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = rms(at2,[at2 at2],at2,[at2 at2; at2 at2],at2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the rms method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the rms method can be processed back + % to an m-file. + % + % + + try + % + out = rms(at2); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'rms'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'rms'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the rms method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the rms method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at1 to work with + ain = ao(at2); + % modify ain + aout = ain.rms(); + ain.rms(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is rms(at1). + % 3) Check the algorithm + % + % + + atest = true; + if stest + % + % Check that rms modified the input by comparing to the copy + if eq(ao(at2), ain, ple1), atest = false; end + % Check that rms doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the rms method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = rms(ao(at2)); + out2 = rms(ao(at2)'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y, 2) ~= 1, atest = false; end + if size(out2.data.y, 1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the rms method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = rms(at2, at2); + o3 = rms(at2, at2); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_round.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_round.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,127 @@ +% UTP_AO_ROUND a set of UTPs for the ao/round method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_round.m,v 1.1 2011/04/17 10:46:44 hewitson Exp $ +% + +% +% +% The round method of the ao class rounds the values of the y +% and/or x data. +% +% + +function results = utp_ao_round(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'round'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple2)]; % Test the modify call works + results = [results utp_08(mthd, at1, ple2)]; % Test with additional plist with the key 'axis' + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at1, at2, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(round(in.data.getY), out.data.getY) + atest = false; + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_sDomainFit.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_sDomainFit.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,768 @@ +% UTP_AO_SDOMAINFIT a set of UTPs for the ao/sDomainFit method +% +% L Ferraioli 16-02-09 +% +% $Id: utp_ao_sDomainFit.m,v 1.11 2011/04/14 12:59:36 luigi Exp $ +% + +% +% +% The sDomainFit method of the ao class fit a model (parfrac object) to +% fsdata. +% +% + +function results = utp_ao_sDomainFit(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'sDomainFit'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs +% [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % ---- Building fsdata test objects + + pl_data1 = plist('fsfcn', '0.01./(0.01+f)', 'f1', 1e-6, 'f2', 5, 'nf', 100); + a1 = ao(pl_data1); + + pl_data2 = plist('fsfcn', '0.001./(0.1+f)', 'f1', 1e-6, 'f2', 5, 'nf', 100); + a2 = ao(pl_data2); + + pl_data3 = plist('fsfcn', '(1e-3./(f).^2 + 1e3./(0.001+f)).*1e-9', 'f1', 1e-6, 'f2', 5, 'nf', 100); + a3 = ao(pl_data3); + + pl_data4 = plist('fsfcn', '(1e-4./(f).^2 + 1e3./(0.01+f)).*1e-10', 'f1', 1e-6, 'f2', 5, 'nf', 100); + a4 = ao(pl_data4); + + pl_data5 = plist('fsfcn', '(1e5.*f.^2 + 1e3./(0.01+f)).*1e-8', 'f1', 1e-6, 'f2', 5, 'nf', 100); + a5 = ao(pl_data5); + + a1.setName; + a2.setName; + a3.setName; + a4.setName; + a5.setName; + + av = [a1 a2 a3]; + am = [a1 a2; a3 a4]; + + % ----- Building a simple test model + f = logspace(-6,log10(5),30); + res = [0.7 0.2+0.01i 0.2-0.01i]; + poles = [0.5 0.1+0.07i 0.1-0.07i]; + tmod = parfrac(plist('res',res,'poles',poles,'dir',0,'name','test model')); + rtmod = resp(tmod,plist('f',f.')); + + % ----- Buildin a standard plist + tol = 0.5; + plstd = plist('AutoSearch','on',... + 'StartPoles',[],... + 'StartPolesOpt','clog',... + 'maxiter',60,... + 'minorder',3,... + 'maxorder',45,... + 'weights',[],... + 'weightparam','abs',... + 'CONDTYPE','MSE',... + 'FITTOL',1e-3,... + 'MSEVARTOL',1e-2,... + 'Plot','off',... + 'ForceStability','off',... + 'CheckProgress','off',... + 'direct term','off'); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call does not work + +% results = [results utp_08]; % Test input data shape == output data +% shape - this does not work because of the output properties of the +% function + + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test the fit give the correct coefficients + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 16, atest = false; end + % Check key + if ~io(3).plists.isparam('autosearch'), atest = false; end + if ~io(3).plists.isparam('startpoles'), atest = false; end + if ~io(3).plists.isparam('startpolesopt'), atest = false; end + if ~io(3).plists.isparam('maxiter'), atest = false; end + if ~io(3).plists.isparam('minorder'), atest = false; end + if ~io(3).plists.isparam('maxorder'), atest = false; end + if ~io(3).plists.isparam('weights'), atest = false; end + if ~io(3).plists.isparam('weightparam'), atest = false; end + if ~io(3).plists.isparam('condtype'), atest = false; end + if ~io(3).plists.isparam('fittol'), atest = false; end + if ~io(3).plists.isparam('msevartol'), atest = false; end + if ~io(3).plists.isparam('plot'), atest = false; end + if ~io(3).plists.isparam('forcestability'), atest = false; end + if ~io(3).plists.isparam('direct term'), atest = false; end + if ~io(3).plists.isparam('checkprogress'), atest = false; end + if ~io(3).plists.isparam('delay'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('autosearch'), 'on'), atest = false; end + if ~isEmptyDouble(io(3).plists.find('startpoles')), atest = false; end + if ~isequal(io(3).plists.find('startpolesopt'), 'clog'), atest = false; end + if ~isequal(io(3).plists.find('maxiter'), 50), atest = false; end + if ~isequal(io(3).plists.find('minorder'), 2), atest = false; end + if ~isequal(io(3).plists.find('maxorder'), 20), atest = false; end + if ~isEmptyDouble(io(3).plists.find('weights')), atest = false; end + if ~isequal(io(3).plists.find('weightparam'), 'abs'), atest = false; end + if ~isequal(io(3).plists.find('condtype'), 'MSE'), atest = false; end + if ~isequal(io(3).plists.find('fittol'), .001), atest = false; end + if ~isequal(io(3).plists.find('msevartol'), .01), atest = false; end + if ~isequal(io(3).plists.find('plot'), 'off'), atest = false; end + if ~isequal(io(3).plists.find('forcestability'), 'off'), atest = false; end + if ~isequal(io(3).plists.find('direct term'), 'off'), atest = false; end + if ~isequal(io(3).plists.find('checkprogress'), 'off'), atest = false; end + if ~isEmptyDouble(io(3).plists.find('delay')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('autosearch'), {'on', 'off'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('startpoles'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('startpolesopt'), {'real', 'clog', 'clin'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('maxiter'), {50}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('minorder'), {2}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('maxorder'), {20}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('weights'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('weightparam'), {'ones', 'abs', 'sqrt'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('condtype'), {'MSE', 'RLD', 'RSF'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('fittol'), {.001}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('msevartol'), {.01}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('plot'), {'on', 'off'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('forcestability'), {'on', 'off'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('direct term'), {'on', 'off'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('checkprogress'), {'on', 'off'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('delay'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the sDomainFit method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the sDomainFit method works for a vector of AOs as input. + % + % + + try + % + + out = sDomainFit(av, plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'av' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(numel(out.objs), numel(av)), atest = false; end + % Check each output against the absolute value of the input + for kk=1:numel(out.objs) + % Check the fitted ao(fsdata) objects + if isa(av(kk).data, 'fsdata') + % check that the output data responses are accurate to the + % prescribed accuracy + mse = out.objs(kk).procinfo.find('FIT_MSE'); + if mse(end)>tol, atest = false; end + else + % Check the other objects (they must be empty) + if ~isempty([out.objs(kk).filters.a]), atest = false; end + if ~isempty([out.objs(kk).filters.b]), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the sDomainFit method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the sDomainFit method works for a matrix of AOs as input. + % + % + + try + % + out = sDomainFit(am, plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'am' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(numel(out.objs), numel(am)), atest = false; end + % Check each output against the absolute value of the input + for kk=1:numel(out.objs) + % Check the fitted ao(fsdata) objects + if isa(am(kk).data, 'fsdata') + % check that the output data responses are accurate to the + % prescribed accuracy + mse = out.objs(kk).procinfo.find('FIT_MSE'); + if mse(end)>tol, atest = false; end + else + % Check the other objects (they must be empty) + if ~isempty([out.objs(kk).filters.a]), atest = false; end + if ~isempty([out.objs(kk).filters.b]), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the sDomainFit method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the sDomainFit method works for a list of AOs as input. + % + % + + try + % + out = sDomainFit(a1,a2,a3, plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [a1,a2,a3]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(numel(out.objs), numel(aoin)), atest = false; end + % Check each output against the absolute value of the input + for kk=1:numel(out.objs) + % Check the fitted ao(fsdata) objects + if isa(aoin(kk).data, 'fsdata') + % check that the output data responses are accurate to the + % prescribed accuracy + mse = out.objs(kk).procinfo.find('FIT_MSE'); + if mse(end)>tol, atest = false; end + else + % Check the other objects (they must be empty) + if ~isempty([out.objs(kk).filters.a]), atest = false; end + if ~isempty([out.objs(kk).filters.b]), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the sDomainFit method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the sDomainFit method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = sDomainFit(a5,[a1 a2;a3 a4],plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [a5,reshape([a1 a2;a3 a4],1,[])]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(numel(out.objs), numel(aoin)), atest = false; end + % Check each output against the absolute value of the input + for kk=1:numel(out.objs) + % Check the fitted ao(fsdata) objects + if isa(aoin(kk).data, 'fsdata') + % check that the output data responses are accurate to the + % prescribed accuracy + mse = out.objs(kk).procinfo.find('FIT_MSE'); + if mse(end)>tol, atest = false; end + else + % Check the other objects (they must be empty) + if ~isempty([out.objs(kk).filters.a]), atest = false; end + if ~isempty([out.objs(kk).filters.b]), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the sDomainFit method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the sDomainFit method can be processed back. + % + % + + try + % + out = sDomainFit(a1,plstd); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'sDomainFit'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out(1).hist.methodInfo.mname, 'sDomainFit'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % sDomainFit cannot modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the sDomainFit method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy a3 to work with + amodi = ao(a3); + aeq = ao(a3); + amodi.sDomainFit(plstd); + out = aeq.sDomainFit(plstd); + % + stest = false; + catch err + disp(err.message) + stest = true; + end + + % + % + % 1) Nothing to do. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +% %% UTP_08 +% +% % +% % +% % Test the shape of the output. - Does not make sense for sDomainFit +% % becauses the output are miir filters +% % +% % +% function result = utp_08 +% +% % +% % +% % Test that the sDomainFit method keeps the data shape of the input object. The +% % input AO must be an AO with row data and an AO with column data. +% % +% % +% +% try +% % +% out1 = sDomainFit(a2,plstd); +% out2 = sDomainFit(a1,plstd); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the shape of the data doesn't change. +% % +% % +% +% atest = true; +% if stest +% % +% % Check the shape of the output data +% if size(out1.data.x) ~= size(at5.data.x), atest = false; end +% if size(out1.data.y) ~= size(at5.data.y), atest = false; end +% if size(out2.data.x) ~= size(at6.data.x), atest = false; end +% if size(out2.data.y) ~= size(at6.data.y), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the sDomainFit method pass back the output objects to a + % single variable correctly. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % +% [o1, o2] = sDomainFit(a1, a2, plstd); + o3 = sDomainFit(a1, a2, plstd); +% mout1 = rebuild(o1); +% mout2 = rebuild(o2); + mout3 = rebuild(o3); +% o31 = o3.index(1); +% o32 = o3.index(2); +% mout31 = rebuild(o31); +% mout32 = rebuild(o32); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs +% if numel(o1) ~=1, atest = false; end +% if numel(o2) ~=1, atest = false; end +% if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object +% if ~eq(o1, mout1, ple2), atest = false; end +% if ~eq(o2, mout2, ple2), atest = false; end +% if ~eq(o3(1), mout3(1), ple2), atest = false; end +% if ~eq(o3(2), mout3(2), ple2), atest = false; end +% if ~eq(o31, mout31, ple2), atest = false; end +% if ~eq(o32, mout32, ple2), atest = false; end + if ~eq(o3, mout3, ple4), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Tests that the sDomainFit method return the correct coefficients + % + % + function result = utp_10 + + % + % + % Test that the sDomainFit method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + tol = 0.5; + plstd2 = plist('AutoSearch','off',... + 'StartPoles',[],... + 'StartPolesOpt','clog',... + 'maxiter',60,... + 'minorder',3,... + 'maxorder',3,... + 'weights',[],... + 'weightparam','abs',... + 'CONDTYPE','MSE',... + 'FITTOL',1e-3,... + 'MSEVARTOL',1e-2,... + 'Plot','off',... + 'ForceStability','off',... + 'CheckProgress','off',... + 'direct term','off'); + out = sDomainFit(rtmod,plstd2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that output contains the correct coefficients. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(numel(out), numel(rtmod)), atest = false; end + % Check the fitted ao(fsdata) objects + if isa(rtmod.data, 'fsdata') + % check that fit coefficients corresponds to real coefficients + % within a tolerance + if any(abs(tmod.res - out.res)>1e-4), atest = false; end + if any(abs(tmod.poles - out.poles)>1e-4), atest = false; end + else + % Check the other objects (they must be empty) + if ~isempty(out.res), atest = false; end + if ~isempty(out.poles), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_save.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_save.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,744 @@ +% UTP_AO_SAVE a set of UTPs for the ao/save method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_save.m,v 1.10 2010/08/31 09:36:46 hewitson Exp $ +% + +% +% +% The save method of the ao class saves an analysis object to disk. Save stores +% the variables in a MATLAB formatted file (MAT-file) named filename.mat or in a +% XML fromat named filename.xml +% +% + +function results = utp_ao_save(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'save'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test plist contains the filename + results = [results utp_09]; % Test object with complex data + results = [results utp_10]; % Test AO which is build from a pzmodel + results = [results utp_11]; % Test AO which is build from complex plist + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(3).plists.isparam('filename'), atest = false; end + if ~io(3).plists.isparam('prefix'), atest = false; end + if ~io(3).plists.isparam('postfix'), atest = false; end + if ~io(3).plists.isparam('individual files'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('filename'), ''), atest = false; end + if ~isequal(io(3).plists.find('prefix'), ''), atest = false; end + if ~isequal(io(3).plists.find('postfix'), ''), atest = false; end + if ~isequal(io(3).plists.find('individual files'), false), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('filename'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the save method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the save method works for a vector of AOs as input. Test both + % formats 'xml' and 'mat'. + % + % + + try + % + save(atvec, 'test.xml'); + save(atvec, 'test.mat'); + out1 = ao('test.xml'); + out2 = ao('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the same + % as in 'atvec' + % 2) Check that the loaded objects are the same as the saved objects except + % the the history because the load-constructor adds one history step. + % 3) The outputs 'out1' and 'out2' must be the same except the history + % properties 'methodInfo', 'plistUsed' and 'proctime'. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(atvec)), atest = false; end + if ~isequal(size(out2), size(atvec)), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(atvec(kk), out1(kk), ple1), atest = false; end + if ~eq(atvec(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the save method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the save method works for a matrix of AOs as input. Test both + % formats 'xml' and 'mat'. + % + % + + try + % + save(atmat, 'test.xml'); + save(atmat, 'test.mat'); + out1 = ao('test.xml'); + out2 = ao('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the same + % as in 'atmat' + % 2) Check that the loaded objects are the same as the saved objects except + % the the history because the load-constructor adds one history step. + % 3) The outputs 'out1' and 'out2' must be the same except the history + % properties 'methodInfo', 'plistUsed' and 'proctime'. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(atmat)), atest = false; end + if ~isequal(size(out2), size(atmat)), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(atmat(kk), out1(kk), ple1), atest = false; end + if ~eq(atmat(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the save method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the save method works for a list of AOs as input. Test both + % formats 'xml' and 'mat'. + % + % + + try + % + save(at1, at2, at3, 'test.xml'); + save(at1, at2, at3, 'test.mat'); + out1 = ao('test.xml'); + out2 = ao('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the same + % as in the list + % 2) Check that the loaded objects are the same as the saved objects except + % the the history because the load-constructor adds one history step. + % 3) The outputs 'out1' and 'out2' must be the same except the history + % properties 'methodInfo', 'plistUsed' and 'proctime'. + % + % + + atest = true; + aoin = [at1, at2, at3]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 3, atest = false; end + if numel(out2) ~= 3, atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(aoin(kk), out1(kk), ple1), atest = false; end + if ~eq(aoin(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the save method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the save method works with an input of matrices and vectors + % and single AOs. Test both formats 'xml' and 'mat'. + % + % + + try + % + save(at1,atvec,at2, 'test.xml'); + save(at1,atvec,at2, 'test.mat'); + out1 = ao('test.xml'); + out2 = ao('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1, reshape(atvec, 1, []), at2]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 2+numel(atvec), atest = false; end + if numel(out2) ~= 2+numel(atvec), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(aoin(kk), out1(kk), ple1), atest = false; end + if ~eq(aoin(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the save method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the save method can be processed back + % to an m-file. Do this for both extensions 'mat' and 'xml' + % + % + + try + % + out1 = save(at4, 'test.xml'); + out2 = save(at2, 'test.mat'); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that save doesn't add a history step. + % 2) Check that the read object is the same as the stored object. + % save + load doesn't add history. + % 3) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % The last history step is the save method + if strcmp(out1.hist.methodInfo.mname, 'save'), atest = false; end + if strcmp(out2.hist.methodInfo.mname, 'save'), atest = false; end + % check the history steps of the read object (load + save) + outr1 = ao('test.xml'); + outr2 = ao('test.mat'); + if strcmp(outr1.hist.methodInfo.mname, 'ao'), atest = false; end + if strcmp(outr2.hist.methodInfo.mname, 'ao'), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + % delete test file + delete('test.xml') + delete('test.mat') + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the save method works with the modify command. + % + % + function result = utp_07 + + % + % + % Test that the modify command. + % + % + + try + % + % copy at1 to work with + aa_mat = ao(at1); + aa_mat.save('test.mat'); + aa_xml = ao(at1); + aa_xml.save('test.xml'); + out1 = ao('test.mat'); + out2 = ao('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the save method applies the history. + % 2) Check the output against the input except the history. + % 3) Check the history of the output against the input. + % + % + + atest = true; + if stest + % + % Check that the modified object have the 'save' method as the last + % history step + if strcmp(aa_xml.hist.methodInfo.mname, 'save'), atest = false; end + if strcmp(aa_mat.hist.methodInfo.mname, 'save'), atest = false; end + % Check the output without the history + if ~eq(aa_mat, out1, ple1), atest = false; end + if ~eq(aa_xml, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the save method uses the filename which is stored in a plist. + % + % + + try + % + pl1 = plist('filename', 'test.mat'); + pl2 = plist('filename', 'test.xml'); + save(at5, pl1); + save(at5, pl2); + out1 = ao('test.mat'); + out2 = ao('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + % Check the output + if ~eq(at5, out1, ple1), atest = false; end + if ~eq(at5, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test the save method with an AO with complex data. + % + % + function result = utp_09 + + % + % + % Save an AO with complex fsdata object. + % + % + + try + % + % Create an AO with complex fsdata + aa = ao(1:123, randn(123,1)+randn(123,1)*i, 1); + aa.setT0(12345); + save(aa, 'test.mat'); + save(aa, 'test.xml'); + out1 = ao('test.mat'); + out2 = ao('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + % Check the output + if ~eq(aa, out1, ple1), atest = false; end + if ~eq(aa, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Test the save method with an AO which is created from a pole/zero model + % + % + function result = utp_10 + + % + % + % Save an AO which is created from a pzmodel. + % + % + + try + % + % Create an AO with complex fsdata + aa = ao(plist('pzmodel', pzmodel(1,{[1 4], 2}, 3), 'Nsecs', 10, 'fs', 37)); + save(aa, 'test.mat'); + save(aa, 'test.xml'); + out1 = ao('test.mat'); + out2 = ao('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + % Check the output + if ~eq(aa, out1, ple1), atest = false; end + if ~eq(aa, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_11 + + % + % + % Test the save method with a complex plist which builds the AO + % + % + function result = utp_11 + + % + % + % Save an AO which is created from a complex plist. + % + % + + try + % + % Create an AO with complex fsdata + win = specwin('Hanning'); + pl = plist('A', {'1', 2, sym('t')}, 'B', sym([1 2; 3 4])); + pli = plist('vals', randn(123)+randn(123)*i, 'pl', pl, 'win', win); + aa = ao(pli); + save(aa, 'test.mat'); + save(aa, 'test.xml'); + out1 = ao('test.mat'); + out2 = ao('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + % Check the output + if ~eq(aa, out1, ple1), atest = false; end + if ~eq(aa, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_11 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_scale.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_scale.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,631 @@ +% UTP_AO_SCALE a set of UTPs for the ao/scale method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_scale.m,v 1.7 2010/06/07 16:43:06 ingo Exp $ +% + +% +% +% The scale method of the ao class scales the y-data in the AO by the +% specified factor. +% +% + +function results = utp_ao_scale(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'scale'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + pli = plist('FACTOR', 2, 'neval', true); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, pli, ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, pli, ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, pli, ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, pli, ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, pli, ple2)]; % Test history is working + results = [results utp_07(mthd, at1, pli, ple1)]; % Test the modify call works + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at5, at6, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1, pli)]; % Test plotinfo doesn't disappear + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + sc = pli.find('FACTOR'); + if ~isequal(in.y .* sc, out.y), atest = false; end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('factor'), atest = false; end + if ~io(3).plists.isparam('yunits'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('factor'), 1), atest = false; end + if ~isEmptyChar(io(3).plists.find('yunits')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('factor'), {1}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('yunits'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +% %% UTP_02 +% +% % +% % +% % Tests that the scale method works with a vector of AOs as input. +% % +% % +% function result = utp_02 +% +% % +% % +% % Test that the scale method works for a vector of AOs as input. +% % +% % +% +% try +% % +% sc = 2.2; +% out = scale(atvec, sc); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the number of elements in 'out' is the same as in 'atvec' +% % 2) Check that each output AO contains the correct data. +% % +% % +% +% atest = true; +% if stest +% % +% % Check we have the correct number of outputs +% if ~isequal(size(out), size(atvec)), atest = false; end +% % Check each output against the scaled input +% for kk=1:numel(out) +% if ~isequal(atvec(kk).y .* sc, out(kk).y), atest = false; end +% end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_02 +% +% %% UTP_03 +% +% % +% % +% % Tests that the scale method works with a matrix of AOs as input. +% % +% % +% function result = utp_03 +% +% % +% % +% % Test that the scale method works for a matrix of AOs as input. +% % +% % +% +% try +% % +% sc = 1-2i; +% out = scale(atmat, sc); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the number of elements in 'out' is the same as in 'atmat' +% % 2) Check that each output AO contains the correct data. +% % +% % +% +% atest = true; +% if stest +% % +% % Check we have the correct number of outputs +% if ~isequal(size(out), size(atmat)), atest = false; end +% % Check each output against the scaled input +% for kk=1:numel(out) +% if ~isequal(atmat(kk).y .* sc, out(kk).y), atest = false; end +% end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_03 +% +% %% UTP_04 +% +% % +% % +% % Tests that the scale method works with a list of AOs as input. +% % +% % +% function result = utp_04 +% +% % +% % +% % Test that the scale method works for a list of AOs as input. +% % +% % +% +% try +% % +% sc = -5; +% out = scale(at1,at2,at3,sc); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the number of elements in 'out' is the same as in +% % input. +% % 2) Check that each output AO contains the correct data. +% % +% % +% +% atest = true; +% aoin = [at1,at2,at3]; +% if stest +% % +% % Check we have the correct number of outputs +% if numel(out) ~= 3, atest = false; end +% % Check each output against the scaled input +% for kk=1:numel(out) +% if ~isequal(aoin(kk).y .* sc, out(kk).y), atest = false; end +% end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_04 +% +% %% UTP_05 +% +% % +% % +% % Tests that the scale method works with a mix of different shaped AOs as +% % input. +% % +% % +% function result = utp_05 +% +% % +% % +% % Test that the scale method works with an input of matrices and +% % vectors and single AOs. +% % +% % +% +% try +% % +% sc = 1/3; +% out = scale(at1,atvec,at2,atmat,at3,sc); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the number of elements in 'out' is the same as in +% % input. +% % 2) Check that each output AO contains the correct data. +% % +% % +% +% atest = true; +% aoin = [at1,reshape(atvec,1,[]),at2,reshape(atmat,1,[]),at3]; +% if stest +% % +% % Check we have the correct number of outputs +% if numel(out) ~= numel(aoin), atest = false; end +% % Check each output against the scaled input +% for kk=1:numel(out) +% if ~isequal(aoin(kk).y .* sc, out(kk).y), atest = false; end +% end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_05 +% +% %% UTP_06 +% +% % +% % +% % Tests that the scale method properly applies history. +% % +% % +% function result = utp_06 +% +% % +% % +% % Test that the result of applying the scale method can be processed back. +% % +% % +% +% try +% % +% out = scale(at1, 1.1); +% mout = rebuild(out); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the last entry in the history of 'out' corresponds to +% % 'scale'. +% % 2) Check that the re-built object is the same object as the input. +% % +% % +% +% atest = true; +% if stest +% % +% % Check the last step in the history of 'out' +% if ~strcmp(out.hist.methodInfo.mname, 'scale'), atest = false; end +% % The rebuilt object must be the same as 'out' +% if ~eq(mout, out, ple2), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_06 +% +% %% UTP_07 +% +% % +% % +% % Tests that the scale method can modify the input AO. +% % +% % +% function result = utp_07 +% +% % +% % +% % Test that the scale method can modify the input AO by calling with no +% % output and that the method doesn't change the input of the function +% % notation (with a equal sign). +% % +% % +% +% try +% % +% % copy at1 to work with +% amodi = ao(at1); +% aeq = ao(at1); +% out = aeq.scale(1.1); +% amodi.scale(1.1); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that 'out' and 'aeq' are now different. +% % 2) Check that 'aeq' is not changed +% % 3) Check that the modified input is the scaled value of the copy +% % 4) Check that out and amodi are the same +% % +% % +% +% atest = true; +% if stest +% % +% % Check that 'out' and 'aeq' are now different. +% if eq(out, aeq, ple2), atest = false; end +% % Check that 'aeq' is not changed +% if ~eq(aeq, ao(at1), ple1), atest = false; end +% % Check that the modified input is the scaled value of the copy +% if ~isequal(at1.y .* 1.1, amodi.y), atest = false; end +% % Check that out and amodi are the same +% if ~eq(out, amodi, ple1), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_07 +% +% %% UTP_08 +% +% % +% % +% % Test that the scale method uses the plist to get the factor. +% % +% % +% function result = utp_08 +% +% % +% % +% % Test that the scale method uses the plist to get the factor. +% % +% % +% +% try +% % +% sc = 1+1.1i; +% pl1 = plist('factor', sc); +% pl2 = plist('factor', ao(sc)); +% pl3 = plist('factor', sc, 'yunits', 'Hz^2'); +% out1 = scale(at1, pl1); +% out2 = scale(at1, pl2); +% out3 = scale(at1, pl3); +% mout1 = rebuild(out1); +% mout2 = rebuild(out2); +% mout3 = rebuild(out3); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check the output +% % 4) Check that the re-built object is the same as in 'out[1..3]'. +% % +% % +% +% atest = true; +% if stest +% % +% % Check each output +% if ~isequal(out1.y, at1.y .* sc), atest = false; end +% if ~isequal(out2.y, at1.y .* sc), atest = false; end +% if ~isequal(out3.y, at1.y .* sc), atest = false; end +% if ~eq(out3.yunits, unit('Hz^2')), atest = false; end +% % Check the re-built objects +% if ~eq(mout1, out1, ple1), atest = false; end +% if ~eq(mout2, out2, ple1), atest = false; end +% if ~eq(mout3, out3, ple1), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_08 +% +% %% UTP_09 +% +% % +% % +% % Test the shape of the output. +% % +% % +% function result = utp_09 +% +% % +% % +% % Test that the scale method keeps the data shape of the input object. +% % The input AO must be an AO with row data and an AO with column data. +% % +% % +% +% try +% % +% out1 = scale(at5, 2); +% out2 = scale(at6, 2); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the shape of the data doesn't change. +% % +% % +% +% atest = true; +% if stest +% % +% % Check the shape of the output data +% if size(out1.data.y,1) == 1, atest = false; end +% if size(out2.data.y,2) == 1, atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_09 +% +% %% UTP_10 +% +% % +% % +% % Check that the scale method pass back the output objects to a list of +% % output variables or to a single variable. +% % +% % +% function result = utp_10 +% +% % +% % +% % Call the method with a list of output variables and with a single +% % output variable. Additionaly check that the rebuild method works on +% % the output. +% % +% % +% +% try +% % +% [o1, o2] = scale(at5, at6, -2); +% o3 = scale(at5, at6, -2); +% mout1 = rebuild(o1); +% mout2 = rebuild(o2); +% mout3 = rebuild(o3); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the output contains the right number of objects +% % 2) Check that the 'rebuild' method produces the same object as 'out'. +% % +% % +% +% atest = true; +% if stest +% % +% % Check the number of outputs +% if numel(o1) ~=1, atest = false; end +% if numel(o2) ~=1, atest = false; end +% if numel(o3) ~=2, atest = false; end +% % Check the rebuilding of the object +% if ~eq(o1, mout1, ple2), atest = false; end +% if ~eq(o2, mout2, ple2), atest = false; end +% if ~eq(o3, mout3, ple2), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_search.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_search.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,517 @@ +% UTP_AO_SEARCH a set of UTPs for the ao/search method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_search.m,v 1.6 2010/09/01 13:58:17 ingo Exp $ +% + +% +% +% The search method of the ao class selects AOs that match the given name. +% +% + +function results = utp_ao_search(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'search'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('regexp'), atest = false; end + if ~io(3).plists.isparam('exact'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('regexp')), atest = false; end + if ~isequal(io(3).plists.find('exact'), false), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('regexp'), {''}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('exact'), {false, true}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the search method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the search method works for a vector of AOs as input. + % + % + + try + % + % Get all AOs with the regular expression '.*' + out1 = search(atvec, '.*'); + % Get only the AO with the name 'at5' + out2 = search(atvec, 'at5'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' are the same as in 'atvec' + % 2) Check that the number of elements in 'out2' + % 3) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(atvec)), atest = false; end + if numel(out2) ~= 1, atest = false; end + % Check the output except the history because the output have + % one additionally history step + if ~eq(out1, atvec, 'hist', 'UUID'), atest = false; end + if ~eq(out2, at5, 'hist', 'UUID'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the search method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the search method works for a matrix of AOs as input. + % + % + + try + % + % Get all AOs with the regular expression '.*' + out1 = search(atmat, '.*'); + % Get only the AO with the name 'at5' + out2 = search(atmat, 'at5'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' are the same as in 'atmat' + % 2) Check that the number of elements in 'out2' + % 3) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(numel(out1), numel(atmat)), atest = false; end + if numel(out2) ~= 1, atest = false; end + % Check the output except the history because the output have + % one additionally history step + if ~eq(reshape(out1, size(atmat)), atmat, 'hist', 'UUID'), atest = false; end + if ~eq(out2, at5, 'hist', 'UUID'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the search method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the search method works for a list of AOs as input. + % + % + + try + % + % Get all AOs with the regular expression '.*' + out1 = search(at1,at2,at3, '.*'); + % Get only the AO with the name 'at5' + out2 = search(at1,at2,at3, 'at3'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' are the same as the input + % 2) Check that the number of elements in 'out2' + % 3) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 3, atest = false; end + if numel(out2) ~= 1, atest = false; end + % Check the output except the history because the output have + % one additionally history step + if ~eq(out1, [at1, at2, at3], 'hist', 'UUID'), atest = false; end + if ~eq(out2, at3, 'hist', 'UUID'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the search method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the search method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + % Get all AOs with the regular expression '.*' + out1 = search(at1,atvec,at2,atmat,at3, '.*'); + % Get only the AO with the name 'at5' + out2 = search(at1,atvec,at2,atmat,at3, 'at3'); + % Negative test with the name 'foo' + out3 = search(at1,atvec,at2,atmat,at3, 'foo'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' are the same as the input + % 2) Check that the number of elements in 'out2' + % 3) Check that 'out3' doesn't contain an AO + % 4) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1,reshape(atvec,1,[]),at2,reshape(atmat,1,[]),at3]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 3+numel(atvec)+numel(atmat), atest = false; end + if numel(out2) ~= 2, atest = false; end + if numel(out3) ~= 0, atest = false; end + % Check the output except the history because the output have + % one additionally history step + if ~eq(out1, aoin, 'hist', 'UUID'), atest = false; end + if ~eq(out2, [at3, at3], 'hist', 'UUID'), atest = false; end + if ~isempty(out3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the search method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the search method can be processed back. + % + % + + try + % + out1 = search(atmat, 'at[45]'); + out2 = search(atmat, plist('regexp', 'at[45]', 'exact', false)); + out3 = search(atmat, plist('regexp', 'at4', 'exact', true)); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'search'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out1(1).hist.methodInfo.mname, 'search'), atest = false; end + if ~strcmp(out1(2).hist.methodInfo.mname, 'search'), atest = false; end + if ~strcmp(out2(1).hist.methodInfo.mname, 'search'), atest = false; end + if ~strcmp(out2(2).hist.methodInfo.mname, 'search'), atest = false; end + if ~strcmp(out3.hist.methodInfo.mname, 'search'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the modifier call for the search method doesn't work. + % + % + function result = utp_07 + + % + % + % Tests that the modifier call for the search method doesn't work. + % + % + + try + % + atvec.search('at2'); + % + stest = false; + catch err + disp(err.message) + stest = true; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Check that the search method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_08 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = search(at5, at6, 'at'); + o3 = search(at5, at6, 'at'); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_select.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_select.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,827 @@ +% UTP_AO_SELECT a set of UTPs for the ao/select method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_select.m,v 1.8 2010/08/18 15:45:12 ingo Exp $ +% + +% +% +% The select method of the ao class select particular samples from the +% input AOs and return new AOs with only those samples. +% +% + +function results = utp_ao_select(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'select'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test plist(sample) + results = [results utp_11(mthd, at1, ple1, plist('SAMPLES', 1:10))]; % Test plotinfo doesn't disappear + results = [results utp_12]; % Test that 'dx' and 'dy' are also selected + results = [results utp_13]; % Test with setted t0 + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('samples'), atest = false; end + if ~io(3).plists.isparam('axis'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('samples')), atest = false; end + if ~isequal(io(3).plists.find('axis'), 'x'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('samples'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('axis'), {'x', 'y'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the select method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the select method works for a vector of AOs as input. + % + % + + try + % + sel = 1:30; + out = select(atvec, sel); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check that the output have only the selected data + for kk=1:numel(out) + if any(abs(out(kk).x - atvec(kk).x(sel)) > TOL), atest = false; end + if ~isequal(out(kk).y, atvec(kk).y(sel)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the select method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the select method works for a matrix of AOs as input. + % + % + + try + % + sel = [1 3 5 7 9]; + out = select(atmat, sel); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check that the output have only the selected data + for kk=1:numel(out) + if ~isa(out(kk).data, 'cdata') + if any(abs(out(kk).x - atmat(kk).x(sel)) > TOL), atest = false; end + if ~isequal(out(kk).y, atmat(kk).y(sel)), atest = false; end + else + if ~isequal(out(kk).y, atmat(kk).y(sel).'), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the select method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the select method works for a list of AOs as input. + % + % + + try + % + sel = 30:45; + out = select(at1,at2,at3,sel); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1,at2,at3]; + TOL = 1e-14; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check that the output have only the selected data + for kk=1:numel(out) + if ~isa(out(kk).data, 'cdata') + if isa(out(kk).data, 'tsdata') + % Add first the T0 of the tsdata + t0off = (out(kk).t0.utc_epoch_milli - aoin(kk).t0.utc_epoch_milli)/1e3; + if any(abs(out(kk).x + t0off - aoin(kk).x(sel)) > TOL), atest = false; end + else + if any(abs(out(kk).x - aoin(kk).x(sel)) > TOL), atest = false; end + end + if ~isequal(out(kk).y, aoin(kk).y(sel)), atest = false; end + else + if ~isequal(out(kk).y, aoin(kk).y(sel).'), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the select method works with a mix of different shaped AOs + % as input. + % + % + function result = utp_05 + + % + % + % Test that the select method works with an input of matrices and + % vectors and single AOs. + % + % + + try + % + sel = 2:9; + out = select(at1,sel,atvec,at2,atmat,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1,reshape(atvec,1,[]),at2,reshape(atmat,1,[]),at3]; + TOL = 1e-14; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(aoin), atest = false; end + % Check that the output have only the selected data + for kk=1:numel(out) + if ~isa(out(kk).data, 'cdata') + if isa(out(kk).data, 'tsdata') + % Add first the T0 of the tsdata + t0off = (out(kk).t0.utc_epoch_milli - aoin(kk).t0.utc_epoch_milli)/1e3; + if any(abs(out(kk).x + t0off - aoin(kk).x(sel)) > TOL), atest = false; end + else + if any(abs(out(kk).x - aoin(kk).x(sel)) > TOL), atest = false; end + end + if ~isequal(out(kk).y, aoin(kk).y(sel)), atest = false; end + else + if ~isequal(out(kk).y, aoin(kk).y(sel).'), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the select method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the select method can be processed back. + % + % + + try + % + out = select(at1, [30:70, 80:120]); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'select'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'select'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the select method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the select method can modify the input AO by calling with + % no output and that the method doesn't change the input of the + % function notation (with a equal sign). + % + % + + try + % + % copy at1 to work with + sel = 30:80; + amodi = ao(at1); + aeq = ao(at1); + out = aeq.select(sel); + amodi.select(sel); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'out' and 'aeq' are now different. + % 2) Check that 'aeq' is not changed + % 3) Check that the modified input is the selected value of the copy + % 4) Check that out and amodi are the same + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check that 'out' and 'aeq' are now different. + if eq(out, aeq, ple2), atest = false; end + % Check that 'aeq' is not changed + if ~eq(aeq, ao(at1), ple1), atest = false; end + % Check that the modified input is the selected value of the copy + if ~isequal(at1.y(sel), amodi.y), atest = false; end + t0off = (amodi.t0.utc_epoch_milli - at1.t0.utc_epoch_milli)/1e3; + if any(abs(at1.x(sel) - (amodi.x+t0off))>TOL), atest = false; end + % Check that out and amodi are the same + if ~eq(out, amodi, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the select method keeps the data shape of the input object. + % The input AO must be an AO with row data and an AO with column data. + % + % + + try + % + sel = [1, 4, 7, 1:30, 33, 6:70]; + out1 = select(at5, sel); + out2 = select(at6, sel); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,1) == 1, atest = false; end + if size(out2.data.y,2) == 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the select method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + sel = 1:150; + [o1, o2] = select(at5, at6, sel); + o3 = select(at5, at6, sel); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Test that the select method uses the plist to select the samples. + % + % + function result = utp_10 + + % + % + % Test that the select method uses the plist to select the samples. + % + % + + try + % + pl = plist('samples', 30:100); + + out1 = select(at1, pl); + out2 = select(at1, pl, 110:150); + out3 = select(at1, pl, 110:150, 200:220); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the select method uses the samples in the plist + % 2) Check that the select method uses the samples in the plist and input + % 3) Check that the select method uses the samples in the plist and input + % 4) Check that the re-built object is the same as in 'out[1..3]'. + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check each output against the selected data samples of the input + sl1 = 30:100; + sl2 = 110:150; + sl3 = 200:220; + if ~isequal(at1.y(sl1), out1.y), atest = false; end + t0off = (out1.t0.utc_epoch_milli - at1.t0.utc_epoch_milli)/1e3; + if any(abs(at1.x(sl1) - (out1.x+t0off))>TOL), atest = false; end + if ~isequal(at1.y([sl1 sl2]), out2.y), atest = false; end + t0off = (out2.t0.utc_epoch_milli - at1.t0.utc_epoch_milli)/1e3; + if any(abs(at1.x([sl1 sl2]) - (out2.x+t0off))>TOL), atest = false; end + if ~isequal(at1.y([sl1 sl2 sl3]), out3.y), atest = false; end + t0off = (out3.t0.utc_epoch_milli - at1.t0.utc_epoch_milli)/1e3; + if any(abs(at1.x([sl1 sl2 sl3]) - (out3.x+t0off))>TOL), atest = false; end + % Check the re-built objects + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + + %% UTP_12 + + % + % + % Test that the select method also select the 'dx' and 'dy' values. + % + % + function result = utp_12 + + % + % + % Test that the select method also select the 'dx' and 'dy' values. + % + % + + try + % + % Create default values for 'dx' and 'dy' + dx = randn(1000,1); + dy = randn(1000,1); + % tsdata + a1 = at1.setDx(dx(1:at1.len)); + a1.setDy(dy(1:at1.len)); + % fsdata + a2 = at2.setDx(dx(1:at2.len)); + a2.setDy(dy(1:at2.len)); + % xydata + a3 = at3.setDx(dx(1:at3.len)); + a3.setDy(dy(1:a3.len)); + % cdata + a4 = at4.setDy(dy(1:at4.len)); + + % Test with only one value for 'dx' and 'dy' + % tsdata + a5 = at1.setDx(123); + a5.setDy(123); + + sl = [20:40 70:90]; + out1 = select(a1, sl); + out2 = select(a2, sl); + out3 = select(a3, sl); + out4 = select(a4, 3:7); + out5 = select(a5, sl); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + mout5 = rebuild(out5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the re-built object is the same as in 'out'. + % + % + + atest = true; + if stest + % + % Check the output + ddx = dx(1:at1.len); + ddy = dy(1:at1.len); + if ~isequal(out1.dx, ddx(sl)); atest = false; end + if ~isequal(out1.dy, ddy(sl)); atest = false; end + ddx = dx(1:at1.len); + ddy = dy(1:at2.len); + if ~isequal(out2.dx, ddx(sl)); atest = false; end + if ~isequal(out2.dy, ddy(sl)); atest = false; end + ddx = dx(1:at3.len); + ddy = dy(1:at3.len); + if ~isequal(out3.dx, ddx(sl)); atest = false; end + if ~isequal(out3.dy, ddy(sl)); atest = false; end + ddy = dy(1:at4.len); + if ~isequal(out4.dy, ddy(3:7)); atest = false; end + if ~isequal(out5.dx, a5.dx); atest = false; end + if ~isequal(out5.dy, a5.dy); atest = false; end + % Check the re-built objects + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + if ~eq(mout4, out4, ple2), atest = false; end + if ~eq(mout5, out5, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Test that the select method updates the t0. + % + % + function result = utp_13 + + % + % + % Test that the select method updates the t0. + % + % + + try + % + sl = 30:300; + aa = at1.setT0('14:00:00'); + + out = select(aa, sl); + + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the re-built object is the same as in 'out'. + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check each output against the selected data samples of the input + toff = (out.t0.utc_epoch_milli - aa.t0.utc_epoch_milli)/1000; + if ~isequal(aa.y(sl), out.y), atest = false; end + if any(abs(aa.x(sl) - (out.x + toff))>TOL), atest = false; end + % Check the re-built objects + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_setDescription.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_setDescription.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,566 @@ +% UTP_AO_SETDESCRIPTION a set of UTPs for the ao/setDescription method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_setDescription.m,v 1.12 2011/04/19 18:14:00 ingo Exp $ +% + +% +% +% The setDescription method of the ao class sets the description property. +% +% + +function results = utp_ao_setDescription(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'setDescription'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + results = [results utp_11(mthd, at1, ple1, plist('DESCRIPTION', 'foo'))]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('description'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('description')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('description'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setDescription method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the setDescription method works for a vector of AOs as input. + % + % + + try + % + out = setDescription(atvec, 'my description'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check description field of each output + for kk=1:numel(out) + if ~strcmp(out(kk).description, 'my description') + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setDescription method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the setDescription method works for a matrix of AOs as input. + % + % + + try + % + out = setDescription(atmat, 'my description'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check description field of each output + for kk=1:numel(out) + if ~strcmp(out(kk).description, 'my description') + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setDescription method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the setDescription method works for a list of AOs as input. + % + % + + try + % + out = setDescription(at1,at2,at3, 'my description'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~strcmp(out(1).description, 'my description'), atest = false; end + if ~strcmp(out(2).description, 'my description'), atest = false; end + if ~strcmp(out(3).description, 'my description'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setDescription method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the setDescription method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = setDescription(at1,atvec,at2,atmat,at3, 'my description'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(atmat)+numel(atvec)), atest = false; end + for kk=1:numel(out) + if ~strcmp(out(kk).description, 'my description') + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setDescription method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setDescription method can be processed back + % to an m-file. + % + % + + try + % + out1 = setDescription(at1, 'my description'); + out2 = testCallerIsMethod(@setDescription, at1, 'my description'); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setDescription'. + % 1) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setDescription'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~strcmp(out1.hist.methodInfo.mname, 'setDescription'), atest = false; end + % Check the last step in the history of 'out2' + if strcmp(out2.hist.methodInfo.mname, 'setDescription'), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'description'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setDescription method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the setDescription method can modify the input AO by calling with no + % output. + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = ain.setDescription('my description'); + ain.setDescription('my description'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' has the correct description field + % + % + + atest = true; + if stest + % + % Check that setDescription modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that setDescription doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~strcmp(ain.description, 'my description'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setDescription method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setDescription method can modify the property 'description' + % with a value in a plist. + % + % + + try + % + pl = plist('description', 'my description'); + out = at1.setDescription(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct description field + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'description' + if ~strcmp(out.description, 'my description'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setDescription method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setDescription(at5, at6, 'new'); + o3 = setDescription(at5, at6, 'new'); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_setFs.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_setFs.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,570 @@ +% UTP_AO_SETFS a set of UTPs for the ao/setFs method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_setFs.m,v 1.13 2011/09/30 11:00:20 ingo Exp $ +% + +% +% +% The setFs method of the ao class sets the fs property. +% +% + +function results = utp_ao_setFs(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'setFs'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + results = [results utp_11(mthd, at1, ple1, plist('FS', 2))]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('fs'), atest = false; end + % Check default value + if ~isnan(io(3).plists.find('fs')), atest = false; end + % Check options + if ~isequalwithequalnans(io(3).plists.getOptionsForParam('fs'), {NaN}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setFs method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the setFs method works for a vector of AOs as input. + % + % + + try + % + avec = [at1, at2, at5, at6]; + out = setFs(avec, 37.123); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'avec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(avec)), atest = false; end + % Check fs field of each output + for kk=1:numel(out) + if ~isequal(out(kk).data.fs, 37.123) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setFs method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the setFs method works for a matrix of AOs as input. + % + % + + try + % + amat = [at1, at2, at5; at5, at6, at1]; + out = setFs(amat, 37.123); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'amat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(amat)), atest = false; end + % Check fs field of each output + for kk=1:numel(out) + if ~isequal(out(kk).data.fs, 37.123) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setFs method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the setFs method works for a list of AOs as input. + % + % + + try + % + out = setFs(at1,at2,at5, 37.123); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~isequal(out(1).data.fs, 37.123), atest = false; end + if ~isequal(out(2).data.fs, 37.123), atest = false; end + if ~isequal(out(3).data.fs, 37.123), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setFs method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the setFs method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + avec = [at1, at2, at5, at6]; + amat = [at1, at2, at5; at5, at6, at1]; + out = setFs(at1,avec,at2,amat,at5, 37.123); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(amat)+numel(avec)), atest = false; end + for kk=1:numel(out) + if ~isequal(out(kk).data.fs, 37.123) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setFs method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setFs method can be processed back + % to an m-file. + % + % + + try + % + out1 = setFs(at1, 37.123); + out2 = testCallerIsMethod(@setFs, at1, 37.123); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setFs'. + % 1) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setFs'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~strcmp(out1.hist.methodInfo.mname, 'setFs'), atest = false; end + % Check the last step in the history of 'out2' + if strcmp(out2.hist.methodInfo.mname, 'setFs'), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'fs', 'nsecs'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setFs method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the setFs method can modify the input AO by calling with no + % output. + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = ain.setFs(37.123); + ain.setFs(37.123); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' has the correct fs field + % + % + + atest = true; + if stest + % + % Check that setFs modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that setFs doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~isequal(ain.data.fs, 37.123), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setFs method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setFs method can modify the property 'fs' + % with a value in a plist. + % + % + + try + % + pl = plist('fs', 37.123); + out = at1.setFs(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct fs field + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'fs' + if ~isequal(out.data.fs, 37.123), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setFs method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setFs(at5, at6, 123.123); + o3 = setFs(at5, at6, 123.123); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_setName.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_setName.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,562 @@ +% UTP_AO_SETNAME a set of UTPs for the ao/setName method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_setName.m,v 1.12 2011/04/19 18:14:00 ingo Exp $ +% + +% +% +% The setName method of the ao class sets the name property. +% +% + +function results = utp_ao_setName(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'setName'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + results = [results utp_11(mthd, at1, ple1, plist('NAME', 'foo'))]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('name'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('name')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('name'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setName method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the setName method works for a vector of AOs as input. + % + % + + try + % + out = setName(atvec, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check name field of each output + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setName method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the setName method works for a matrix of AOs as input. + % + % + + try + % + out = setName(atmat, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check name field of each output + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setName method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the setName method works for a list of AOs as input. + % + % + + try + % + out = setName(at1,at2,at3, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~strcmp(out(1).name, 'my name'), atest = false; end + if ~strcmp(out(2).name, 'my name'), atest = false; end + if ~strcmp(out(3).name, 'my name'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setName method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the setName method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = setName(at1,atvec,at2,atmat,at3, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(atmat)+numel(atvec)), atest = false; end + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setName method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setName method can be processed back + % to an m-file. + % + % + + try + % + out1 = setName(at1, 'myy name'); + out2 = testCallerIsMethod(@setName, at1, 'myy name'); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setName'. + % 1) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setName'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setName') && ... + eq(out1.hist.plistUsed, plist('name', 'myy name'), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('name', 'myy name'), ple1) + atest = false; + end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'name'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setName method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the setName method can modify the input AO by calling with no + % output. + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = ain.setName('my name'); + ain.setName('my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' has the correct name field + % + % + + atest = true; + if stest + % + % Check that setName modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that setName doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~strcmp(ain.name, 'my name'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setName method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setName method can modify the property 'name' + % with a value in a plist. + % + % + + try + % + pl = plist('name', 'my name'); + out = at1.setName(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct name field + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'name' + if ~strcmp(out.name, 'my name'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setName method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setName(at5, at6, 'new name'); + o3 = setName(at5, at6, 'new name'); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_setPlotinfo.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_setPlotinfo.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,562 @@ +% UTP_AO_SETPLOTINFO a set of UTPs for the ao/setPlotinfo method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_setPlotinfo.m,v 1.10 2011/04/19 18:14:00 ingo Exp $ +% + +% +% +% The setPlotinfo method of the ao class sets the plotinfo property. +% +% + +function results = utp_ao_setPlotinfo(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'setPlotinfo'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('plotinfo'), atest = false; end + % Check default value + if ~eq(io(3).plists.find('plotinfo'), plist(), ple1), atest = false; end + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setPlotinfo method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the setPlotinfo method works for a vector of AOs as input. + % + % + + try + % + pl = plist('Yscales', {'All', 'lin'}); + out = setPlotinfo(atvec, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check plotinfo field of each output + for kk=1:numel(out) + if ~eq(out(kk).plotinfo, pl, 'UUID'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setPlotinfo method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the setPlotinfo method works for a matrix of AOs as input. + % + % + + try + % + pl = plist('Yscales', {'All', 'lin'}); + out = setPlotinfo(atmat, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check plotinfo field of each output + for kk=1:numel(out) + if ~eq(out(kk).plotinfo, pl, 'UUID'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setPlotinfo method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the setPlotinfo method works for a list of AOs as input. + % + % + + try + % + pl = plist('Yscales', {'All', 'lin'}); + out = setPlotinfo(at1,at2,at5, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~eq(out(1).plotinfo, pl, 'UUID'), atest = false; end + if ~eq(out(2).plotinfo, pl, 'UUID'), atest = false; end + if ~eq(out(3).plotinfo, pl, 'UUID'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setPlotinfo method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the setPlotinfo method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + pl = plist('Yscales', {'All', 'lin'}); + out = setPlotinfo(at1,atvec,at2,atmat,at5, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(atmat)+numel(atvec)), atest = false; end + for kk=1:numel(out) + if ~eq(out(kk).plotinfo, pl, 'UUID'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setPlotinfo method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setPlotinfo method can be processed back + % to an m-file. + % + % + + try + % + pl = plist('Yscales', {'All', 'lin'}); + out1 = setPlotinfo(at1, pl); + out2 = testCallerIsMethod(@setPlotinfo, at1, pl); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setPlotinfo'. + % 1) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setPlotinfo'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~strcmp(out1.hist.methodInfo.mname, 'setPlotinfo'), atest = false; end + % Check the last step in the history of 'out2' + if strcmp(out2.hist.methodInfo.mname, 'setPlotinfo'), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'plotinfo'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setPlotinfo method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the setPlotinfo method can modify the input AO by calling with no + % output. + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + pl = plist('Yscales', {'All', 'lin'}); + % modify ain + aout = ain.setPlotinfo(pl); + ain.setPlotinfo(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' has the correct plotinfo field + % + % + + atest = true; + if stest + % + % Check that setPlotinfo modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that setPlotinfo doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~eq(ain.plotinfo, pl, 'UUID'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setPlotinfo method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setPlotinfo method can modify the property 'plotinfo' + % with a value in a plist. + % + % + + try + % + pl = plist('Yscales', {'All', 'lin'}); + pli = plist('plotinfo', pl); + out = at1.setPlotinfo(pli); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct plotinfo field + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'plotinfo' + if ~eq(out.plotinfo, pl, ple1), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setPlotinfo method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setPlotinfo(at5, at6, plist()); + o3 = setPlotinfo(at5, at6, plist()); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_setT0.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_setT0.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,575 @@ +% UTP_AO_SETT0 a set of UTPs for the ao/setT0 method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_setT0.m,v 1.13 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The setT0 method of the ao class sets the t0 property. +% +% + +function results = utp_ao_setT0(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'setT0'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + results = [results utp_11(mthd, at1, ple1, plist('T0', 123))]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('t0'), atest = false; end + % Check default value + if ~strcmpi(io(3).plists.find('t0'), '14:00:00 10-10-2009'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('t0'), {'14:00:00 10-10-2009'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setT0 method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the setT0 method works for a vector of AOs as input. + % + % + + try + % + avec = [at1, at2, at5, at6]; + out = setT0(avec, '14:00:00'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'avec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(avec)), atest = false; end + % Check t0 field of each output + for kk=1:numel(out) + if ~eq(out(kk).data.t0, time('14:00:00'), ple1) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setT0 method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the setT0 method works for a matrix of AOs as input. + % + % + + try + % + amat = [at1, at2, at5; at5, at6, at1]; + out = setT0(amat, 123456); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'amat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(amat)), atest = false; end + % Check t0 field of each output + for kk=1:numel(out) + if ~eq(out(kk).data.t0, time(123456), ple1) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setT0 method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the setT0 method works for a list of AOs as input. + % + % + + try + % + t1 = time('2008-10-15 14:00:00'); + out = setT0(at1,at2,at5, t1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~eq(out(1).data.t0, t1), atest = false; end + if ~eq(out(2).data.t0, t1), atest = false; end + if ~eq(out(3).data.t0, t1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setT0 method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the setT0 method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + t1 = time('2008-10-15 14:00:00'); + avec = [at1, at2, at5, at6]; + amat = [at1, at2, at5; at5, at6, at1]; + out = setT0(at1,avec,at2,amat,at5, t1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(amat)+numel(avec)), atest = false; end + for kk=1:numel(out) + if ~eq(out(kk).data.t0, t1) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setT0 method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setT0 method can be processed back + % to an m-file. + % + % + + try + % + t1 = time('2008-10-15 14:00:00'); + out1 = setT0(at1, t1); + out2 = testCallerIsMethod(@setT0, at1, t1); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setT0'. + % 1) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setT0'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~strcmp(out1.hist.methodInfo.mname, 'setT0'), atest = false; end + % Check the last step in the history of 'out2' + if strcmp(out2.hist.methodInfo.mname, 'setT0'), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'t0'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setT0 method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the setT0 method can modify the input AO by calling with no + % output. + % + % + + try + % + % copy at1 to work with + t1 = time('2008-10-15 14:00:00'); + ain = ao(at1); + % modify ain + aout = ain.setT0(t1); + ain.setT0(t1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' has the correct t0 field + % + % + + atest = true; + if stest + % + % Check that setT0 modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that setT0 doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~eq(ain.data.t0, t1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setT0 method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setT0 method can modify the property 't0' + % with a value in a plist. + % + % + + try + % + t1 = time('2008-10-15 14:00:00'); + pl = plist('t0', t1); + out = at1.setT0(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct t0 field + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 't0' + if ~eq(out.data.t0, t1), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setT0 method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setT0(at5, at6, time(123)); + o3 = setT0(at5, at6, time(123)); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_setX.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_setX.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,636 @@ +% UTP_AO_SETX a set of UTPs for the ao/setX method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_setX.m,v 1.16 2011/05/09 12:26:21 ingo Exp $ +% + +% +% +% The setX method of the ao class sets the 'x' property. +% +% + +function results = utp_ao_setX(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'setX'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test that the shape of the data doesn't change + results = [results utp_10]; % Test output of the data + results = [results utp_11(mthd, at1, ple1, plist('X', at1.y))]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('x'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('x')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('x'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setX method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the setX method works for a vector of AOs as input. + % + % + + try + % + in = [1:at1.len]'; + avec = [at1, at1, at1, at1]; + out = setX(avec, in); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'avec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(avec)), atest = false; end + % Check 'x' field of each output + for kk=1:numel(out) + out_x = out(kk).data.x; + if size(out_x, 1) == 1 + out_x = out_x.'; + end + if ~isequal(out_x, in), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setX method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the setX method works for a matrix of AOs as input. + % + % + + try + % + in = [1:at2.len]'; + amat = [at2, at2, at2; at2, at2, at2]; + out = setX(amat, in); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'amat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(amat)), atest = false; end + % Check 'x' field of each output + for kk=1:numel(out) + out_x = out(kk).data.x; + if size(out_x, 1) == 1 + out_x = out_x.'; + end + if ~isequal(out_x, in), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setX method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the setX method works for a list of AOs as input. + % + % + + try + % + in = [1:at3.len]'; + out = setX(at3,at3,at3, in); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~isequal(out(1).x, in), atest = false; end + if ~isequal(out(2).x, in), atest = false; end + if ~isequal(out(3).x, in), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setX method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the setX method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + in = [1:at3.len]'; + avec = [at3, at3, at3, at3]; + amat = [at3, at3, at3; at3, at3, at3]; + out = setX(at3,avec,at3,amat,at3, in); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(amat)+numel(avec)), atest = false; end + for kk=1:numel(out) + out_x = out(kk).data.x; + if size(out_x, 1) == 1 + out_x = out_x.'; + end + if ~isequal(out_x, in), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setX method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setX method can be processed back + % to an m-file. + % + % + + try + % + in = [1:at1.len]'; + out1 = setX(at1, in); + out2 = testCallerIsMethod(@setX, at1, in); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setX'. + % 1) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setX'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~strcmp(out1.hist.methodInfo.mname, 'setX'), atest = false; end + % Check the last step in the history of 'out2' + if strcmp(out2.hist.methodInfo.mname, 'setX'), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'x'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setX method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the setX method can modify the input AO by calling with no + % output. + % + % + + try + % + % copy at1 to work with + in = [1:at1.len]'; + ain = ao(at1); + % modify ain + aout = ain.setX(in); + ain.setX(in); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' has the correct 'x' field + % + % + + atest = true; + if stest + % + % Check that setX modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that setX doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~isequal(ain.data.x, in), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setX method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setX method can modify the property 'x' + % with a value in a plist. + % + % + + try + % + in = [1:at1.len]'; + pl = plist('x', in); + out = at1.setX(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct x field + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'x' + if ~isequal(out.data.x, in), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Tests that the setX method keeps the shape of the data. + % + % + function result = utp_09 + + % + % + % Test that the setX method keeps the shape of the data. Independent of the + % input + % + % + + try + % + in_r = [1:at5.len]; + in_c = [1:at5.len]'; + out1 = at5.setX(in_r); + out2 = at5.setX(in_c); + out3 = at6.setX(in_r); + out4 = at6.setX(in_c); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % The data of at5 is stored as a row vector + if size(out1.data.x, 2) ~= 1, atest = false; end + if size(out2.data.x, 2) ~= 1, atest = false; end + % The data of at6 is stored as a column vector + if size(out3.data.x, 1) ~= 1, atest = false; end + if size(out4.data.x, 1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the setX method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_10 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setX(at5, at6, [1:at5.len]); + o3 = setX(at5, at6, [1:at5.len]); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_setXY.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_setXY.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,644 @@ +% UTP_AO_SETXY a set of UTPs for the ao/setXY method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_setXY.m,v 1.15 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The setXY method of the ao class sets the 'x' and 'y' property. +% +% + +function results = utp_ao_setXY(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'setXY'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test that theshape of the data doesn't change + results = [results utp_10]; % Test output of the data + results = [results utp_11(mthd, at1, ple1, plist('x', at2.x, 'y', at2.y))]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('x'), atest = false; end + if ~io(3).plists.isparam('y'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('x')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('y')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('x'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('y'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setXY method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the setXY method works for a vector of AOs as input. + % + % + + try + % + inx = [1; 2; 3]; + iny = randn(3,1); + avec = [at1, at2, at3, at6]; + out = setXY(avec, inx, iny); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'avec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(avec)), atest = false; end + % Check 'x' and 'y' field of each output + for kk=1:numel(out) + if ~isequal(out(kk).x, inx), atest = false; break; end + if ~isequal(out(kk).y, iny), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setXY method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the setXY method works for a matrix of AOs as input. + % + % + + try + % + inx = [1; 2; 3]; + iny = randn(3,1); + amat = [at1, at2, at5; at3, at6, at1]; + out = setXY(amat, inx, iny); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'amat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(amat)), atest = false; end + % Check 'x' and 'y' field of each output + for kk=1:numel(out) + if ~isequal(out(kk).x, inx), atest = false; break; end + if ~isequal(out(kk).y, iny), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setXY method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the setXY method works for a list of AOs as input. + % + % + + try + % + inx = [1; 2; 3]; + iny = randn(3,1); + out = setXY(at1,at2,at5, inx, iny); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~isequal(out(1).x, inx), atest = false; end + if ~isequal(out(1).y, iny), atest = false; end + if ~isequal(out(2).x, inx), atest = false; end + if ~isequal(out(2).y, iny), atest = false; end + if ~isequal(out(3).x, inx), atest = false; end + if ~isequal(out(3).y, iny), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setXY method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the setXY method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + inx = [1; 2; 3]; + iny = randn(3,1); + avec = [at1, at2, at3, at6]; + amat = [at1, at2, at5; at5, at3, at1]; + out = setXY(at1,avec,at2,amat,at5, inx, iny); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(amat)+numel(avec)), atest = false; end + for kk=1:numel(out) + if ~isequal(out(kk).x, inx), atest = false; break; end + if ~isequal(out(kk).y, iny), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setXY method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setXY method can be processed back + % to an m-file. + % + % + + try + % + inx = [1; 2; 3]; + iny = randn(3,1); + out1 = setXY(at1, inx, iny); + out2 = testCallerIsMethod(@setXY, at1, inx, iny); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setXY'. + % 1) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setXY'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~strcmp(out1.hist.methodInfo.mname, 'setXY'), atest = false; end + % Check the last step in the history of 'out2' + if strcmp(out2.hist.methodInfo.mname, 'setXY'), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'x', 'y'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setXY method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the setXY method can modify the input AO by calling with no + % output. + % + % + + try + % + % copy at1 to work with + inx = [1; 2; 3]; + iny = randn(3,1); + ain = ao(at1); + % modify ain + aout = ain.setXY(inx, iny); + ain.setXY(inx, iny); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' has the correct 'x' and 'y' field + % + % + + atest = true; + if stest + % + % Check that setXY modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that setXY doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~isequal(ain.x, inx), atest = false; end + if ~isequal(ain.y, iny), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setXY method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setXY method can modify the property 'x' and 'y' + % with a value in a plist. + % + % + + try + % + inx = [1; 2; 3]; + iny = randn(3,1); + pl = plist('x', inx, 'y', iny); + out = at1.setXY(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct x and y fields + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'x' and 'y' + if ~isequal(out.x, inx), atest = false; end + if ~isequal(out.y, iny), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Tests that the setXY method keeps the shape of the data. + % + % + function result = utp_09 + + % + % + % Test that the setXY method keeps the shape of the data. Independent of the + % input + % + % + + try + % + inx_r = [1 2 3]; + iny_r = [4 5 6]; + inx_c = [1; 2; 3]; + iny_c = [4; 5; 6]; + out1 = at5.setXY(inx_r, iny_r); + out2 = at5.setXY(inx_c, iny_c); + out3 = at6.setXY(inx_r, iny_r); + out4 = at6.setXY(inx_c, iny_c); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % The data of at5 is stored as a row vector + if size(out1.data.y, 2) ~= 1, atest = false; end + if size(out2.data.y, 2) ~= 1, atest = false; end + % The data of at6 is stored as a column vector + if size(out3.data.y, 1) ~= 1, atest = false; end + if size(out4.data.y, 1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the setXY method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_10 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setXY(at5, at6, [1 2 3], [4 5 6]); + o3 = setXY(at5, at6, [1 2 3], [4 5 6]); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_setXunits.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_setXunits.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,575 @@ +% UTP_AO_SETXUNITS a set of UTPs for the ao/setXunits method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_setXunits.m,v 1.14 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The setXunits method of the ao class sets the xunits property. +% +% + +function results = utp_ao_setXunits(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'setXunits'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + results = [results utp_11(mthd, at1, ple1, plist('xunits', 'm'))]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('xunits'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('xunits')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('xunits'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setXunits method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the setXunits method works for a vector of AOs as input. + % + % + + try + % + avec = [at1, at2, at3, at6]; + out = setXunits(avec, 's m'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'avec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(avec)), atest = false; end + % Check xunits field of each output + for kk=1:numel(out) + if ~eq(out(kk).data.xunits, unit('s m'), ple1) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setXunits method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the setXunits method works for a matrix of AOs as input. + % + % + + try + % + amat = [at1, at2, at5; at3, at6, at1]; + out = setXunits(amat, 'kg s^2'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'amat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(amat)), atest = false; end + % Check xunits field of each output + for kk=1:numel(out) + if ~eq(out(kk).data.xunits, unit('kg s^2'), ple1) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setXunits method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the setXunits method works for a list of AOs as input. + % + % + + try + % + u1 = unit('V m^-1'); + out = setXunits(at1,at2,at5, u1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~eq(out(1).data.xunits, u1), atest = false; end + if ~eq(out(2).data.xunits, u1), atest = false; end + if ~eq(out(3).data.xunits, u1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setXunits method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the setXunits method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + u1 = unit('V m^-1'); + avec = [at1, at2, at3, at6]; + amat = [at1, at2, at5; at5, at3, at1]; + out = setXunits(at1,avec,at2,amat,at5, u1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(amat)+numel(avec)), atest = false; end + for kk=1:numel(out) + if ~eq(out(kk).data.xunits, u1) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setXunits method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setXunits method can be processed back + % to an m-file. + % + % + + try + % + u1 = unit('V m^-1'); + out1 = setXunits(at1, u1); + out2 = testCallerIsMethod(@setXunits, at1, u1); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setXunits'. + % 1) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setXunits'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~strcmp(out1.hist.methodInfo.mname, 'setXunits'), atest = false; end + % Check the last step in the history of 'out2' + if strcmp(out2.hist.methodInfo.mname, 'setXunits'), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'xunits'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setXunits method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the setXunits method can modify the input AO by calling with no + % output. + % + % + + try + % + % copy at1 to work with + u1 = unit('N V'); + ain = ao(at1); + % modify ain + aout = ain.setXunits(u1); + ain.setXunits(u1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' has the correct xunits field + % + % + + atest = true; + if stest + % + % Check that setXunits modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that setXunits doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~eq(ain.data.xunits, u1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setXunits method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setXunits method can modify the property 'xunits' + % with a value in a plist. + % + % + + try + % + u1 = unit('V m^-1'); + pl = plist('xunits', u1); + out = at1.setXunits(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct xunits field + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'xunits' + if ~eq(out.data.xunits, u1), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setXunits method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setXunits(at5, at6, unit('s')); + o3 = setXunits(at5, at6, unit('s')); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_setY.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_setY.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,620 @@ +% UTP_AO_SETY a set of UTPs for the ao/setY method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_setY.m,v 1.16 2011/05/09 12:26:22 ingo Exp $ +% + +% +% +% The setY method of the ao class sets the 'y' property. +% +% + +function results = utp_ao_setY(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'setY'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test that theshape of the data doesn't change + results = [results utp_10]; % Test output of the data + results = [results utp_11(mthd, at1, ple1, plist('y', at1.x))]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('y'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('y')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('y'), {[]}), atest = false; end + % + end + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setY method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the setY method works for a vector of AOs as input. + % + % + + try + % + in = [1:at1.len]'; + out = setY([at1, at1, at1], in); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check 'y' field of each output + for kk=1:numel(out) + if ~isequal(out(kk).data.getY, in), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setY method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the setY method works for a matrix of AOs as input. + % + % + + try + % + in = [1:at2.len]'; + mm = [at2 at2; at2 at2; at2 at2]; + out = setY(mm, in); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(mm)), atest = false; end + % Check 'y' field of each output + for kk=1:numel(out) + if ~isequal(out(kk).data.getY, in), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setY method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the setY method works for a list of AOs as input. + % + % + + try + % + in = [1:at5.len]'; + out = setY(at5, at6, in); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 2, atest = false; end + % Check each output against the input + if ~isequal(out(1).data.getY, in), atest = false; end + if ~isequal(out(2).data.getY, in), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setY method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the setY method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + in = [1:at1.len]'; + out = setY(at1,[at1 at1],at1, in); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 4, atest = false; end + for kk=1:numel(out) + if ~isequal(out(kk).data.getY, in), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setY method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setY method can be processed back + % to an m-file. + % + % + + try + % + in = [1:at1.len]'; + out1 = setY(at1, in); + out2 = testCallerIsMethod(@setY, at1, in); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setY'. + % 1) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setY'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~strcmp(out1.hist.methodInfo.mname, 'setY'), atest = false; end + % Check the last step in the history of 'out2' + if strcmp(out2.hist.methodInfo.mname, 'setY'), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'y'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setY method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the setY method can modify the input AO by calling with no + % output. + % + % + + try + % + % copy at1 to work with + in = [1:at1.len]'; + ain = ao(at1); + % modify ain + aout = ain.setY(in); + ain.setY(in); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' has the correct 'y' field + % + % + + atest = true; + if stest + % + % Check that setY modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that setY doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~isequal(ain.data.getY, in), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setY method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setY method can modify the property 'y' + % with a value in a plist. + % + % + + try + % + in = [1:at1.len]'; + pl = plist('y', in); + out = at1.setY(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct y field + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'y' + if ~isequal(out.data.getY, in), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Tests that the setY method keeps the shape of the data. + % + % + function result = utp_09 + + % + % + % Test that the setY method keeps the shape of the data. Independent of the + % input + % + % + + try + % + in_r = [1:at5.len]; + in_c = [1:at5.len]'; + out1 = at5.setY(in_r); + out2 = at5.setY(in_c); + out3 = at6.setY(in_r); + out4 = at6.setY(in_c); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % The data of at5 is stored as a row vector + if size(out1.data.y, 2) ~= 1, atest = false; end + if size(out2.data.y, 2) ~= 1, atest = false; end + % The data of at6 is stored as a column vector + if size(out3.data.y, 1) ~= 1, atest = false; end + if size(out4.data.y, 1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the setY method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_10 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setY(at5, at6, [1:at5.len]); + o3 = setY(at5, at6, [1:at5.len]); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_setYunits.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_setYunits.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,572 @@ +% UTP_AO_SETYUNITS a set of UTPs for the ao/setYunits method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_setYunits.m,v 1.15 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The setYunits method of the ao class sets the yunits property. +% +% + +function results = utp_ao_setYunits(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'setYunits'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + results = [results utp_11(mthd, at1, ple1, plist('yunits', 'm'))]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('yunits'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('yunits')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('yunits'), {''}), atest = false; end + % + end + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setYunits method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the setYunits method works for a vector of AOs as input. + % + % + + try + % + out = setYunits(atvec, 's m'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check yunits field of each output + for kk=1:numel(out) + if ~eq(out(kk).data.yunits, unit('s m'), ple1) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setYunits method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the setYunits method works for a matrix of AOs as input. + % + % + + try + % + out = setYunits(atmat, 'kg s^2'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check yunits field of each output + for kk=1:numel(out) + if ~eq(out(kk).data.yunits, unit('kg s^2'), ple1) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setYunits method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the setYunits method works for a list of AOs as input. + % + % + + try + % + u1 = unit('V m^-1'); + out = setYunits(at1,at2,at5, u1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~eq(out(1).data.yunits, u1), atest = false; end + if ~eq(out(2).data.yunits, u1), atest = false; end + if ~eq(out(3).data.yunits, u1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setYunits method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the setYunits method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + u1 = unit('V m^-1'); + atvec = [at1, at2, at3, at6]; + out = setYunits(at1,atvec,at2,atmat,at5, u1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(atmat)+numel(atvec)), atest = false; end + for kk=1:numel(out) + if ~eq(out(kk).data.yunits, u1) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setYunits method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setYunits method can be processed back + % to an m-file. + % + % + + try + % + u1 = unit('V m^-1'); + out1 = setYunits(at1, u1); + out2 = testCallerIsMethod(@setYunits, at1, u1); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setYunits'. + % 1) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setYunits'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~strcmp(out1.hist.methodInfo.mname, 'setYunits'), atest = false; end + % Check the last step in the history of 'out2' + if strcmp(out2.hist.methodInfo.mname, 'setYunits'), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'yunits'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setYunits method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the setYunits method can modify the input AO by calling with no + % output. + % + % + + try + % + % copy at1 to work with + u1 = unit('N V'); + ain = ao(at1); + % modify ain + aout = ain.setYunits(u1); + ain.setYunits(u1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' has the correct yunits field + % + % + + atest = true; + if stest + % + % Check that setYunits modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that setYunits doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~eq(ain.data.yunits, u1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setYunits method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setYunits method can modify the property 'yunits' + % with a value in a plist. + % + % + + try + % + u1 = unit('V m^-1'); + pl = plist('yunits', u1); + out = at1.setYunits(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct yunits field + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'yunits' + if ~eq(out.data.yunits, u1), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setYunits method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setYunits(at5, at6, unit('Hz')); + o3 = setYunits(at5, at6, unit('Hz')); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_setZ.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_setZ.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,569 @@ +% UTP_AO_SETZ a set of UTPs for the ao/setZ method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_setZ.m,v 1.11 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The setZ method of the ao class sets the 'z' property. +% +% + +function results = utp_ao_setZ(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'setZ'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs +% pl = plist('type', 'xyzdata', 'xvals', randn(12,1), 'yvals', randn(15,1), 'zvals', randn(15,12)); +% at7 = ao(pl); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests +% results = [results utp_01]; % getInfo call +% results = [results utp_02]; % Vector input +% results = [results utp_03]; % Matrix input +% results = [results utp_04]; % List input +% results = [results utp_05]; % Test with mixed input +% results = [results utp_06]; % Test history is working +% results = [results utp_07]; % Test the modify call works +% results = [results utp_08]; % Set the property with a plist +% results = [results utp_09]; % Test output of the data +% results = [results utp_11(mthd, at1, ple1, plist('z', ))]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('z'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('z')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('z'), {[]}), atest = false; end + % + end + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setZ method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the setZ method works for a vector of AOs as input. + % + % + + try + % + in = randn(12); + avec = [at7, at7, at7, at7]; + out = setZ(avec, in); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'avec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(avec)), atest = false; end + % Check 'z' field of each output + for kk=1:numel(out) + if ~isequal(out(kk).data.z, in), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setZ method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the setZ method works for a matrix of AOs as input. + % + % + + try + % + in = randn(12); + amat = [at7, at7, at7; at7, at7, at7]; + out = setZ(amat, in); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'amat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(amat)), atest = false; end + % Check 'z' field of each output + for kk=1:numel(out) + if ~isequal(out(kk).data.z, in), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setZ method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the setZ method works for a list of AOs as input. + % + % + + try + % + in = randn(12); + out = setZ(at7,at7,at7, in); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~isequal(out(1).data.z, in), atest = false; end + if ~isequal(out(2).data.z, in), atest = false; end + if ~isequal(out(3).data.z, in), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setZ method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the setZ method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + in = randn(12); + avec = [at7, at7, at7, at7]; + amat = [at7, at7, at7; at7, at7, at7]; + out = setZ(at7,avec,at7,amat,at7, in); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(amat)+numel(avec)), atest = false; end + for kk=1:numel(out) + if ~isequal(out(kk).data.z, in), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setZ method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setZ method can be processed back + % to an m-file. + % + % + + try + % + in = randn(12); + out1 = setZ(at7, in); + out2 = testCallerIsMethod(@setZ, at7, in); + mout1 = rebuild (out1); + mout2 = rebuild (out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setZ'. + % 1) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setZ'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~strcmp(out1.hist.methodInfo.mname, 'setZ'), atest = false; end + % Check the last step in the history of 'out2' + if strcmp(out2.hist.methodInfo.mname, 'setZ'), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple1.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'z'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setZ method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the setZ method can modify the input AO by calling with no + % output. + % + % + + try + % + % copy at7 to work with + in = randn(12); + ain = ao(at7); + % modify ain + aout = ain.setZ(in); + ain.setZ(in); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at7' and 'ain' are now different. + % 2) Check that 'ain' has the correct 'z' field + % + % + + atest = true; + if stest + % + % Check that setZ modified the input by comparing to the copy + if eq(ao(at7), ain, ple1), atest = false; end + % Check that setZ doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~isequal(ain.data.z, in), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setZ method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setZ method can modify the property 'z' + % with a value in a plist. + % + % + + try + % + in = randn(12); + pl = plist('z', in); + out = at7.setZ(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct z field + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'z' + if ~isequal(out.data.z, in), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setZ method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setZ(at7, at7, randn(12)); + o3 = setZ(at7, at7, randn(12)); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_sign.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_sign.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,127 @@ +% UTP_AO_SIGN a set of UTPs for the ao/sign method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_sign.m,v 1.12 2011/04/17 10:50:04 hewitson Exp $ +% + +% +% +% The sign method of the ao class computes the signum of the y +% and/or x data. +% +% + +function results = utp_ao_sign(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'sign'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple1)]; % Test the modify call works + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at5, at6, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(sign(in.data.getY), out.data.getY) + atest = false; + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_simplifyYunits.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_simplifyYunits.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,753 @@ +% UTP_AO_SIMPLIFYYUNITS a set of UTPs for the ao/simplifyYunits method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_simplifyYunits.m,v 1.8 2009/08/07 11:27:08 hewitson Exp $ +% + +% +% +% The simplifyYunits method of the ao class simplify the 'yunits' property +% of the ao. +% +% + +function results = utp_ao_simplifyYunits(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'simplifyYunits'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test output of the data + results = [results utp_09]; % Test with different complex y-units + results = [results utp_10]; % Test with exception list + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + results = [results utp_12]; % Test doesn't apply prefixes to the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('prefixes'), atest = false; end + if ~io(3).plists.isparam('exceptions'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('prefixes'), true), atest = false; end + if ~isEmptyChar(io(3).plists.find('exceptions')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('prefixes'), {true, false}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('exceptions'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the simplifyYunits method works with a vector of AOs as + % input. + % + % + function result = utp_02 + + % + % + % Test that the simplifyYunits method works for a vector of AOs as + % input. + % + % + + try + % + objs = atvec.setYunits('km V^1/3 mm^-2 V^-1'); + out = simplifyYunits(objs); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check the output + for kk = 1:numel(out) + % Check the new y-units + if ~eq(out(kk).yunits, unit('m^-1 V^-2/3')), atest = false; end + % Check that simplifyYunits also modify the y-units depending on + % the prefixes: Here multiply the y-values with 1e9 + if ~isequal(objs(kk).y .* 1e9, out(kk).y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the simplifyYunits method works with a matrix of AOs as + % input. + % + % + function result = utp_03 + + % + % + % Test that the simplifyYunits method works for a matrix of AOs as + % input. + % + % + + try + % + objs = atmat.setYunits('km kV^1/3 km^-1'); + out = simplifyYunits(objs); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check the output + for kk = 1:numel(out) + % Check the new y-units + if ~eq(out(kk).yunits, unit('V^(1/3)')), atest = false; end + % Check that simplifyYunits also modify the y-units depending on + % the prefixes: Here multiply the y-values with 10 + if abs(objs(kk).y .* 10 - out(kk).y) > eps(out(kk).y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the simplifyYunits method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the simplifyYunits method works for a list of AOs as input. + % + % + + try + % + obj1 = at1.setYunits('km V^1/3 mm^-2 V^-1'); + obj2 = at2.setYunits('km V^1/3 mm^-2 V^-1'); + obj3 = at3.setYunits('km V^1/3 mm^-2 V^-1'); + out = simplifyYunits(obj1, obj2, obj3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [obj1, obj2, obj3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check the output + for kk = 1:numel(out) + % Check the new y-units + if ~eq(out(kk).yunits, unit('m^-1 V^-2/3')), atest = false; end + % Check that simplifyYunits also modify the y-units depending on + % the prefixes: Here multiply the y-values with 1e9 + if ~isequal(aoin(kk).y .* 1e9, out(kk).y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the simplifyYunits method works with a mix of different + % shaped AOs as input. + % + % + function result = utp_05 + + % + % + % Test that the simplifyYunits method works with an input of matrices + % and vectors and single AOs. + % + % + + try + % + objv = atvec.setYunits('km V^1/3 mm^-2 V^-1'); + objm = atmat.setYunits('km V^1/3 mm^-2 V^-1'); + obj1 = at1.setYunits('km V^1/3 mm^-2 V^-1'); + obj2 = at2.setYunits('km V^1/3 mm^-2 V^-1'); + out = simplifyYunits(obj1, objm, objv, obj2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [obj1, reshape(objm, 1, []), reshape(objv, 1, []), obj2]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(aoin), atest = false; end + % Check the output + for kk = 1:numel(out) + % Check the new y-units + if ~eq(out(kk).yunits, unit('m^-1 V^-2/3')), atest = false; end + % Check that simplifyYunits also modify the y-units depending on + % the prefixes: Here multiply the y-values with 1e9 + if ~isequal(aoin(kk).y .* 1e9, out(kk).y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the simplifyYunits method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the simplifyYunits method can be + % processed back. + % + % + + try + % + out = simplifyYunits(at1); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'simplifyYunits'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'simplifyYunits'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the simplifyYunits method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the simplifyYunits method can modify the input AO by + % calling with no output and that the method doesn't change the input + % of the function notation (with a equal sign). + % + % + + try + % + % copy at1 to work with + aa = at1.setYunits('km V^1/3 mm^-2 V^-1'); + amodi = ao(aa); + aeq = ao(aa); + out = aeq.simplifyYunits(); + amodi.simplifyYunits(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'out' and 'aeq' are now different. + % 2) Check that 'aeq' is not changed + % 3) Check that the modified input simplifies the y-units of the copy + % 4) Check that out and amodi are the same + % + % + + atest = true; + if stest + % + % Check that 'out' and 'aeq' are now different. + if eq(out, aeq, ple2), atest = false; end + % Check that 'aeq' is not changed + if ~eq(aeq, ao(aa), ple1), atest = false; end + % Check that the modified input simplifies the y-units of the copy + if ~eq(amodi.yunits, unit('m^-1 V^-2/3')), atest = false; end + % Check that simplifyYunits also modify the y-units depending on + % the prefixes: Here multiply the y-values with 1e9 + if ~isequal(aa.y .* 1e9, amodi.y), atest = false; end + % Check that out and amodi are the same + if ~eq(out, amodi, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Check that the simplifyYunits method pass back the output objects to a + % list of output variables or to a single variable. + % + % + function result = utp_08 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [o1, o2] = simplifyYunits(at5, at6); + o3 = simplifyYunits(at5, at6); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test that the simplifyYunits works for different complex y-units. + % + % + function result = utp_09 + + % + % + % Test that the simplifyYunits works for different complex y-units. + % + % + + try + % + % No changes to the data AND units + a1 = at1.setYunits('m Hz^-2 V^2/3'); + out1 = a1.simplifyYunits(); + + % No changes to the data + a2 = at1.setYunits('m^2 m^-3 m^2/3'); + out2 = a2.simplifyYunits(); + + % The data is multiplied with the pefix 1e6 + a3 = at1.setYunits('km^2 km^-2/3'); + out3 = a3.simplifyYunits(); + + % Re-build the object + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the correct data + % 2) Check that the re-built object is the same as in 'out[1..3]'. + % + % + + atest = true; + if stest + % + % Check 'out1' + if ~eq(out1, a1, ple3), atest = false; end + % Check 'out2' + if ~eq(out2.yunits, unit('m^-1/3'), ple3), atest = false; end + e = ple3.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'yunits'}]); + if ~eq(out1, a1, ple), atest = false; end + % Check 'out3' -> data is multiplied by 1e4 + % REMARK: The optimal value is 1e4 but in case of rounding proplems + % is the value '1e6 * 1e3 .^ (-2/3)' + fact = 1e6 * 1e3 .^ (-2/3); + if ~eq(out3.yunits, unit('m^4/3')), atest = false; end + if ~isequal(out3.y, a3.y .* fact), atest = false; end + % Check the re-built objects + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Test that the simplifyYunits works with a exception list. + % + % + function result = utp_10 + + % + % + % Test that the simplifyYunits works with a exception list. + % + % + + try + % + a1 = at1.setYunits('km^2 nm^-2/3 m'); + ple = plist('exceptions', 'nm'); + out1 = a1.simplifyYunits(ple); + + a2 = at1.setYunits('km^2 km^-2/3 Hz^1/2 Hz'); + ple = plist('exceptions', 'Hz', 'prefixes', false); + out2 = a2.simplifyYunits(ple); + + % Re-build the object + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the correct data + % 2) Check that the re-built object is the same as in 'out[1..2]'. + % + % + + atest = true; + if stest + % + % Check 'out1' + if ~eq(out1.yunits, unit('m^3 nm^-2/3')), atest = false; end + if ~isequal(out1.y, a1.y .* 1e6), atest = false; end + e = ple3.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'y', 'yunits'}]); + if ~eq(out1, a1, ple), atest = false; end + % Check 'out2' + if ~eq(out2.yunits, unit('km^4/3 Hz^1/2 Hz')), atest = false; end + e = ple3.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'yunits'}]); + if ~eq(out2, a2, ple), atest = false; end + % Check the re-built objects + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_12 + + % + % + % Test that the simplifyYunits doesn't apply the prefixes to the data. + % + % + function result = utp_12 + + % + % + % Test that the simplifyYunits doesn't apply the prefixes to the data. + % + % + + try + % + a1 = at1.setYunits('km^2 nm^-2/3 m'); + ple = plist('prefixes', false); + out1 = a1.simplifyYunits(ple); + + a2 = at1.setYunits('km^2 km^-2/3 Hz^1/2 Hz'); + ple = plist('prefixes', false); + out2 = a2.simplifyYunits(ple); + + % Re-build the object + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the correct data + % 2) Check that the re-built object is the same as in 'out[1..2]'. + % + % + + atest = true; + if stest + % + % Check 'out1' + if ~eq(out1.yunits, unit('km^2 nm^-2/3 m')), atest = false; end + e = ple3.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'yunits'}]); + if ~eq(out1, a1, ple), atest = false; end + % Check 'out2' + if ~eq(out2.yunits, unit('km^4/3 Hz^3/2')), atest = false; end + if ~eq(out2, a2, ple), atest = false; end + % Check the re-built objects + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_sin.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_sin.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,127 @@ +% UTP_AO_SIN a set of UTPs for the ao/sin method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_sin.m,v 1.13 2011/04/17 10:50:04 hewitson Exp $ +% + +% +% +% The sin method of the ao class computes the sine of the y +% and/or x data. +% +% + +function results = utp_ao_sin(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'sin'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple1)]; % Test the modify call works + results = [results utp_08(mthd, at1, ple2)]; % Test with additional plist with the key 'axis' + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at5, at6, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(sin(in.data.getY), out.data.getY) + atest = false; + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_smoother.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_smoother.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,537 @@ +% UTP_AO_SMOOTHER a set of UTPs for the ao/smoother method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_smoother.m,v 1.8 2009/08/07 12:28:47 hewitson Exp $ +% + +% +% +% The smoother method of the ao class smooths time-series AOs. +% +% + +function results = utp_ao_smoother(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'smoother'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test the data shape + results = [results utp_09]; % Test output of the data + + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 3, atest = false; end + % Check key + if ~io(3).plists.isparam('width'), atest = false; end + if ~io(3).plists.isparam('hc'), atest = false; end + if ~io(3).plists.isparam('method'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('width'), 20), atest = false; end + if ~isequal(io(3).plists.find('hc'), .8), atest = false; end + if ~isequal(io(3).plists.find('method'), 'median'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('width'), {20}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('hc'), {.8}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('method'), {'median', 'mean', 'max', 'mode'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the smoother method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the smoother method works for a vector of AOs as input. + % + % + + try + % + avec = [at1 at5 at6]; + out = smoother(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the smoother method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the smoother method works for a matrix of AOs as input. + % + % + + try + % + amat = [at1 at5 at6; at5 at6 at1]; + out = smoother(amat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the smoother method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the smoother method works for a list of AOs as input. + % + % + + try + % + out = smoother(at1,at5,at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the smoother method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the smoother method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = smoother(at1,[at5 at6],at5,[at5 at1; at6 at1],at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the smoother method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the smoother method can be processed back + % to an m-file. + % + % + + try + % + out = smoother(at5); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'smoother'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'smoother'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the smoother method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the smoother method can modify the input AO by calling + % with no output. + % + % + + try + % + % copy at1 to work with + ain = ao(at5); + % modify ain + aout = ain.smoother(); + ain.smoother(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is smoother(at5). + % + % + + atest = true; + if stest + % + % Check that smoother modified the input by comparing to the copy + if eq(ao(at5), ain, ple1), atest = false; end + % Check that smoother doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the smoother method keeps the data shape of the input object. + % + % + function result = utp_08 + + % + % + % Test that the smoother method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = dsmean(at5); + out2 = dsmean(at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y) ~= size(at5.data.y), atest = false; end + if size(out2.data.y) ~= size(at6.data.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the smoother method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = smoother(at5, at6); + o3 = smoother(at5, at6); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_sort.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_sort.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,654 @@ +% UTP_AO_SORT a set of UTPs for the ao/sort method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_sort.m,v 1.5 2010/06/07 16:43:06 ingo Exp $ +% + +% +% +% The sort method of the ao class sorts the values in the AO. +% +% + +function results = utp_ao_sort(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'sort'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test with plist() + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('dim'), atest = false; end + if ~io(3).plists.isparam('dir'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('dim'), 'y'), atest = false; end + if ~isequal(io(3).plists.find('dir'), 'ascend'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('dim'), {'x', 'y'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('dir'), {'ascend', 'descend'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the sort method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the sort method works for a vector of AOs as input. + % + % + + try + % + out = sort(atvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check that the sort method sorts the y-axis + for kk = 1:numel(atvec) + [my, idx] = sort(atvec(kk).y, 1, 'ascend'); + mx = atvec(kk).data.getX(idx); + if ~isequal(out(kk).x, mx), atest = false; end + if ~isequal(out(kk).y, my), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the sort method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the sort method works for a matrix of AOs as input. + % + % + + try + % + out = sort(atmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check that the sort method sorts the y-axis + for kk = 1:numel(atmat) + [my, idx] = sort(atmat(kk).y, 1, 'ascend'); + if ~isequal(out(kk).y, my), atest = false; end + if ~isa(out(kk).data,'cdata') + mx = atmat(kk).data.getX(idx); + if ~isequal(out(kk).x, mx), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the sort method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the sort method works for a list of AOs as input. + % + % + + try + % + out = sort(at1,at2,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1,at2,at3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check that the sort method sorts the y-axis + for kk = 1:numel(aoin) + [my, idx] = sort(aoin(kk).y, 1, 'ascend'); + if ~isequal(out(kk).y, my), atest = false; end + if ~isa(out(kk).data,'cdata') + mx = aoin(kk).data.getX(idx); + if ~isequal(out(kk).x, mx), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the sort method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the sort method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = sort(at1,atvec,at2,atmat,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [at1,reshape(atvec,1,[]),at2,reshape(atmat,1,[]),at3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(aoin), atest = false; end + % Check that the sort method sorts the y-axis + for kk = 1:numel(aoin) + [my, idx] = sort(aoin(kk).y, 1, 'ascend'); + if ~isequal(out(kk).y, my), atest = false; end + if ~isa(out(kk).data,'cdata') + mx = aoin(kk).data.getX(idx); + if ~isequal(out(kk).x, mx), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the sort method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the sort method can be processed back. + % + % + + try + % + out = sort(at1); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'sort'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'sort'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the sort method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the sort method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at1 to work with + amodi = ao(at1); + aeq = ao(at1); + out = aeq.sort(); + amodi.sort(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'out' and 'aeq' are now different. + % 2) Check that 'aeq' is not changed + % 3) Check that the modified input is the sort value of the copy + % 4) Check that out and amodi are the same + % + % + + atest = true; + if stest + % + % Check that 'out' and 'aeq' are now different. + if eq(out, aeq, ple2), atest = false; end + % Check that 'aeq' is not changed + if ~eq(aeq, ao(at1), ple1), atest = false; end + % Check that the modified input is the sorted value of the copy + if ~isequal(sort(at1.data.getY), amodi.data.getY), atest = false; end + % Check that out and amodi are the same + if ~eq(out, amodi, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the sort method keeps the data shape of the input object. + % The input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = sort(at5); + out2 = sort(at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,1) == 1, atest = false; end + if size(out2.data.y,2) == 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the sort method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [o1, o2] = sort(at5, at6); + o3 = sort(at5, at6); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Test that the sort method uses the plist to sort on the x- or y- axis + % + % + function result = utp_10 + + % + % + % Test that the sort method uses the plist to get the axis. + % + % + + try + % + pl1 = plist('dim', 'y', 'dir', 'ascend'); + pl2 = plist('dim', 'y', 'dir', 'descend'); + pl3 = plist('dim', 'x', 'dir', 'ascend'); + pl4 = plist('dim', 'x', 'dir', 'descend'); + out1 = sort(at1, pl1); + out2 = sort(at1, pl2); + out3 = sort(at1, pl3); + out4 = sort(at1, pl4); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the sort method applies to the y-axis in ascend direction + % 2) Check that the sort method applies to the y-axis in descend direction + % 3) Check that the sort method applies to the x-axis in ascend direction + % 4) Check that the sort method applies to the x-axis in descend direction + % 5) Check that the re-built object is the same as in 'out[1..4]'. + % + % + + atest = true; + if stest + % + % Check each output against the sortolute value of the input + [my, idx] = sort(at1.y, 1, 'ascend'); + mx = at1.x(idx); + if ~isequal(out1.x, mx), atest = false; end + if ~isequal(out1.y, my), atest = false; end + [my, idx] = sort(at1.y, 1, 'descend'); + mx = at1.x(idx); + if ~isequal(out2.x, mx), atest = false; end + if ~isequal(out2.y, my), atest = false; end + [mx, idx] = sort(at1.x, 1, 'ascend'); + my = at1.y(idx); + if ~isequal(out3.x, mx), atest = false; end + if ~isequal(out3.y, my), atest = false; end + [mx, idx] = sort(at1.x, 1, 'descend'); + my = at1.y(idx); + if ~isequal(out4.x, mx), atest = false; end + if ~isequal(out4.y, my), atest = false; end + % Check the re-built objects + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + if ~eq(mout4, out4, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_spcorr.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_spcorr.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,486 @@ +% UTP_AO_SPCORR a set of UTPs for the ao/spcorr method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_spcorr.m,v 1.1 2011/07/06 15:42:51 luigi Exp $ +% + +% +% +% The ifft method of the ao class computes the inverse fast fourier +% transform of time-series AOs. +% +% + +function results = utp_ao_spcorr(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'spcorr'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call does not work + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('ALPHA'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('ALPHA'), 0.05), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('ALPHA'), {0.05}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the spcorr method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the spcorr method works for a vector of AOs as input. + % + % + + try + % + avec = [at5 at5]; + out1 = spcorr(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= numel(avec)-1, atest = false; end + % Check each output + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the spcorr method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the spcorr method works for a matrix of AOs as input. + % + % + + try + % + amat = [at5 at5 at5; at5 at5 at5]; + out1 = spcorr(amat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= numel(amat)-1, atest = false; end + % Check each output + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the spcorr method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the spcorr method works for a list of AOs as input. + % + % + + try + % + out1 = spcorr(at5, at5, at5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 2, atest = false; end + % Check each output + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the spcorr method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the spcorr method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out1 = spcorr(at5,[at6 at6],at5,[at5 at5; at5 at5],at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; +% aoin = [at1, reshape([at1 at1], 1, []), at1, reshape([at1 at1; at1 at1], 1, []), at1]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 8, atest = false; end + % Check each output + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the spcorr method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the spcorr method can be processed back + % to an m-file. + % + % + + try + % + out1 = spcorr(at5, at6); + mout1 = rebuild(out1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'spcorr'. + % 2) % Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'spcorr'), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the spcorr method cannot modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the spcorr method cannot modify the input AO by calling with no + % output. + % + % + + try + % + % copy at2 to work with + ain1 = ao(at5); + ain2 = ao(at6); + ainv = [ain1 ain2]; + % modify ain + out1 = spcorr(ainv); + ainv.spcorr(); + % + stest = false; + catch err + disp(err.message) + stest = true; + end + + % + % + % + % + + atest = true; + + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + + %% UTP_09 + + % + % + % Check that the spcorr method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o11, o12] = spcorr(at5, at6, at6); + no1 = spcorr(at5, at6, at6); + mout11 = rebuild(o11); + mout12 = rebuild(o12); + moutn1 = rebuild(no1); + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o11) ~=1, atest = false; end + if numel(o12) ~=1, atest = false; end + if numel(no1) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o11, mout11, ple2), atest = false; end + if ~eq(o12, mout12, ple2), atest = false; end + if ~eq(no1, moutn1, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_spectrogram.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_spectrogram.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,382 @@ +% UTP_AO_SPECTROGRAM a set of UTPs for the ao/spectrogram method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_spectrogram.m,v 1.10 2010/09/18 06:51:58 mauro Exp $ +% + +% +% +% The spectrogram method of the ao class computes the spectrogram of time-series AOs. +% +% + +function results = utp_ao_spectrogram(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'spectrogram'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + % + try + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + % + atest = true; + if stest + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + defaultWinType = char(prefs.getMiscPrefs.getDefaultWindow); + + %%% SET 'None' + pn = 1; + if ~isempty(io(pn).sets), atest = false; end + if ~isempty(io(pn).plists), atest = false; end + %%% Check all Sets + pn = 2; + if ~any(strcmpi(io(pn).sets, 'Default')), atest = false; end + if numel(io(pn).plists) ~= numel(io(pn).sets), atest = false; end + %%%%%%%%%% SET 'Default' + pn = 3; + if io(pn).plists.nparams ~= 3, atest = false; end + % Check key + if ~io(pn).plists.isparam('win'), atest = false; end + if ~io(pn).plists.isparam('nolap'), atest = false; end + if ~io(pn).plists.isparam('nfft'), atest = false; end + % Check default value + if ~strcmpi(io(pn).plists.find('win'), defaultWinType), atest = false; end + if ~isequal(io(pn).plists.find('nolap'), -1), atest = false; end + if ~isequal(io(pn).plists.find('nfft'), -1), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('win'), specwin.getTypes), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('nolap'), {-1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('nfft'), {-1}), atest = false; end + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the spectrogram method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the spectrogram method works for a vector of AOs as input. + % + % + + % + try + avec = [at1 at5 at6]; + out = spectrogram(avec); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the spectrogram method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the spectrogram method works for a matrix of AOs as input. + % + % + + % + try + amat = [at1 at5 at6; at5 at6 at1]; + out = spectrogram(amat); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the spectrogram method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the spectrogram method works for a list of AOs as input. + % + % + + % + try + out = spectrogram(at1,at5,at6); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the spectrogram method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the spectrogram method works with an input of matrices and vectors + % and single AOs. + % + % + + % + try + out = spectrogram(at1,[at5 at6],at5,[at5 at1; at6 at1],at6); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + % + atest = true; + if stest + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the spectrogram method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the spectrogram method can be processed back + % to an m-file. + % + % + + % + try + out = spectrogram(at5); + mout = rebuild(out); + stest = true; + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'spectrogram'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + % + atest = true; + if stest + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'spectrogram'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_split_chunks.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_split_chunks.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,1056 @@ +% UTP_AO_SPLIT a set of UTPs for the ao/split method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_split_chunks.m,v 1.7 2011/09/29 12:09:56 ingo Exp $ +% + +% +% +% The split method of the ao class splits an analysis object into the +% specified segments. This UTP splits the AOs into sample segments. +% +% + +function results = utp_ao_split_chunks(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'split'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + at4.setY(randn(15)); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test plist(N) || plist(CHUNKS) + results = [results utp_11(mthd, at1, ple1, plist('N', 10))]; % Test plotinfo doesn't disappear + results = [results utp_12]; % Test 'dx' and 'dy' + results = [results utp_13]; % Test plist(match) + results = [results utp_15]; % Test not equal sampled data (tsdata) + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + idx = 1; + if ~isempty(io(idx).sets), atest = false; end + if ~isempty(io(idx).plists), atest = false; end + %%% Check all Sets + idx = 2; + if ~any(strcmpi(io(idx).sets, 'Default')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By times')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By frequencies')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By samples')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By chunks')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By interval start/end')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By interval start/duration')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By interval timespan')), atest = false; end + if numel(io(idx).plists) ~= numel(io(idx).sets), atest = false; end + %%%%%%%%%% SET 'Default' + idx = 3; + if io(idx).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(idx).plists.isparam('times'), atest = false; end + % Check default value + if ~isEmptyDouble(io(idx).plists.find('times')), atest = false; end + % Check options + if ~isequal(io(idx).plists.getOptionsForParam('times'), {[]}), atest = false; end + %%%%%%%%%% SET 'By times' + idx = 4; + if io(idx).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(idx).plists.isparam('times'), atest = false; end + % Check default value + if ~isEmptyDouble(io(idx).plists.find('times')), atest = false; end + % Check options + if ~isequal(io(idx).plists.getOptionsForParam('times'), {[]}), atest = false; end + %%%%%%%%%% SET 'By frequencies' + idx = 5; + if io(idx).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(idx).plists.isparam('frequencies'), atest = false; end + % Check default value + if ~isEmptyDouble(io(idx).plists.find('frequencies')), atest = false; end + % Check options + if ~isequal(io(idx).plists.getOptionsForParam('frequencies'), {[]}), atest = false; end + %%%%%%%%%% SET 'By samples' + idx = 6; + if io(idx).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(idx).plists.isparam('samples'), atest = false; end + % Check default value + if ~isEmptyDouble(io(idx).plists.find('samples')), atest = false; end + % Check options + if ~isequal(io(idx).plists.getOptionsForParam('samples'), {[]}), atest = false; end + %%%%%%%%%% SET 'By chunks' + idx = 7; + if io(idx).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(idx).plists.isparam('N'), atest = false; end + if ~io(idx).plists.isparam('match'), atest = false; end + % Check default value + if ~isEmptyDouble(io(idx).plists.find('N')), atest = false; end + if ~isequal(io(idx).plists.find('match'), true), atest = false; end + % Check options + if ~isequal(io(idx).plists.getOptionsForParam('N'), {[]}), atest = false; end + if ~isequal(io(idx).plists.getOptionsForParam('match'), {true, false}), atest = false; end + %%%%%%%%%% SET 'By interval start/end' + idx = 8; + if io(idx).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(idx).plists.isparam('start_time'), atest = false; end + if ~io(idx).plists.isparam('end_time'), atest = false; end + % Check default value + if ~eq(io(idx).plists.find('start_time'), time(0), ple1), atest = false; end + if ~eq(io(idx).plists.find('end_time'), time(0), ple1), atest = false; end + % Check options + %%%%%%%%%% SET 'By interval start/duration' + idx = 9; + if io(idx).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(idx).plists.isparam('start_time'), atest = false; end + if ~io(idx).plists.isparam('duration'), atest = false; end + % Check default value + if ~eq(io(idx).plists.find('start_time'), time(0), ple1), atest = false; end + if ~eq(io(idx).plists.find('duration'), time(0), ple1), atest = false; end + % Check options + %%%%%%%%%% SET 'By interval timespan' + idx = 10; + if io(idx).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(idx).plists.isparam('timespan'), atest = false; end + % Check default value + ts = timespan(0,0); + if ~eq(io(idx).plists.find('timespan'), ts, ple1), atest = false; end + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the split method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the split method works for a vector of AOs as input. + % + % + + try + % + N = 13; + pl = plist('chunks', N); + out = split(atvec, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of outputs + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-12; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(atvec) * N, atest = false; end + + % Check each output + for kk=1:numel(atvec) + + ff = floor(length(atvec(kk).y)/N); + is = 1:ff:length(atvec(kk).y); + ie = ff:ff:length(atvec(kk).y); + idx = sort([is(1:N) ie(1:N)]); + idx(end) = length(atvec(kk).y); + for jj = 1:N + + % Get reference values + x = atvec(kk).x; + y = atvec(kk).y; + % Get and normalize for tsdata the values + if isa(atvec(kk).data, 'tsdata') + t0off = (out((kk-1)*N+jj).t0.utc_epoch_milli - atvec(kk).t0.utc_epoch_milli)/1e3; + ox = out((kk-1)*N+jj).x + t0off; + else + ox = out((kk-1)*N+jj).x; + end + oy = out((kk-1)*N+jj).y; + % Compute the range + range = idx(jj*2-1):idx(jj*2); + % Check data + if any(abs(ox - x(range)) > TOL), atest = false; end + if ~isequal(oy, y(range)), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the split method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Tests that the split method works with a matrix of AOs as input. + % + % + + try + % + N = 4; + pl = plist('chunks', N); + out = split(atmat, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of outputs + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(atmat) * N, atest = false; end + + % Check each output + for kk=1:numel(atmat) + + ff = floor(length(atmat(kk).y)/N); + is = 1:ff:length(atmat(kk).y); + ie = ff:ff:length(atmat(kk).y); + idx = sort([is(1:N) ie(1:N)]); + idx(end) = length(atmat(kk).y); + + for jj = 1:N + + % Get reference values + x = atmat(kk).x; + y = atmat(kk).y; + % Get and normalize for tsdata the values + if isa(atmat(kk).data, 'tsdata') + t0off = (out((kk-1)*N+jj).t0.utc_epoch_milli - atmat(kk).t0.utc_epoch_milli)/1e3; + ox = out((kk-1)*N+jj).x + t0off; + else + ox = out((kk-1)*N+jj).x; + end + oy = out((kk-1)*N+jj).y; + % Compute the range + range = idx(jj*2-1):idx(jj*2); + % Check data + if ~isa(atmat(kk).data, 'cdata') + if any(abs(ox - x(range)) > TOL), atest = false; end + if ~isequal(oy, y(range)), atest = false; end + else + if ~isequal(oy, y(range).'), atest = false; end + end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the split method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Tests that the split method works with a matrix of AOs as input. + % + % + + try + % + N = 4; + pl = plist('chunks', N); + out = split(at1, at2, at3, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of outputs + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-14; + aoin = [at1, at2, at3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(aoin) * N, atest = false; end + + % Check each output + for kk=1:numel(aoin) + + ff = floor(length(aoin(kk).y)/N); + is = 1:ff:length(aoin(kk).y); + ie = ff:ff:length(aoin(kk).y); + idx = sort([is(1:N) ie(1:N)]); + idx(end) = length(aoin(kk).y); + + for jj = 1:N + + % Get reference values + x = aoin(kk).x; + y = aoin(kk).y; + % Get and normalize for tsdata the values + if isa(aoin(kk).data, 'tsdata') + t0off = (out((kk-1)*N+jj).t0.utc_epoch_milli - aoin(kk).t0.utc_epoch_milli)/1e3; + ox = out((kk-1)*N+jj).x + t0off; + else + ox = out((kk-1)*N+jj).x; + end + oy = out((kk-1)*N+jj).y; + % Compute the range + range = idx(jj*2-1):idx(jj*2); + % Check data + if ~isa(aoin(kk).data, 'cdata') + if any(abs(ox - x(range)) > TOL), atest = false; end + if ~isequal(oy, y(range)), atest = false; end + else + if ~isequal(oy, y(range).'), atest = false; end + end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the split method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Tests that the split method works with a matrix of AOs as input. + % + % + + try + % + N = 3; + pl = plist('chunks', N); + out = split(at1, atmat, atvec, at3, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of outputs + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-14; + aoin = [at1, reshape(atmat, 1, []), reshape(atvec, 1, []), at3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(aoin) * N, atest = false; end + + % Check each output + for kk=1:numel(aoin) + + ff = floor(length(aoin(kk).y)/N); + is = 1:ff:length(aoin(kk).y); + ie = ff:ff:length(aoin(kk).y); + idx = sort([is(1:N) ie(1:N)]); + idx(end) = length(aoin(kk).y); + + for jj = 1:N + + % Get reference values + x = aoin(kk).x; + y = aoin(kk).y; + % Get and normalize for tsdata the values + if isa(aoin(kk).data, 'tsdata') + t0off = (out((kk-1)*N+jj).t0.utc_epoch_milli - aoin(kk).t0.utc_epoch_milli)/1e3; + ox = out((kk-1)*N+jj).x + t0off; + else + ox = out((kk-1)*N+jj).x; + end + oy = out((kk-1)*N+jj).y; + % Compute the range + range = idx(jj*2-1):idx(jj*2); + % Check data + if ~isa(aoin(kk).data, 'cdata') + if any(abs(ox - x(range)) > TOL), atest = false; end + if ~isequal(oy, y(range)), atest = false; end + else + if ~isequal(oy, y(range).'), atest = false; end + end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the split method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the split method can be processed back. + % + % + + try + % + pl = plist('N', 3); + out = split(at1, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'split'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out(1).hist.methodInfo.mname, 'split'), atest = false; end + if ~strcmp(out(2).hist.methodInfo.mname, 'split'), atest = false; end + if ~strcmp(out(3).hist.methodInfo.mname, 'split'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % The split method can not modify the input AO. + % + % + function result = utp_07 + + % + % + % The split method can not modify the input AO. + % + % + + try + % + pl = plist('N', 7); + amodi = ao(at1); + aeq = ao(at1); + out = aeq.split(pl); + amodi.split(pl); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothind to do. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the split method keeps the data shape of the input object. + % The input AO must be an AO with row data and an AO with column data. + % + % + + try + % + pl = plist('chunks', 3); + out1 = split(at5, pl); + out2 = split(at6, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1(1).data.y,1) == 1, atest = false; end + if size(out1(2).data.y,1) == 1, atest = false; end + if size(out1(3).data.y,1) == 1, atest = false; end + if size(out2(1).data.y,2) == 1, atest = false; end + if size(out2(2).data.y,2) == 1, atest = false; end + if size(out2(3).data.y,2) == 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the split method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + pl = plist('chunks', 2); + [o1, o2] = split(at5, pl); + o3 = split(at5, pl); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the split method accepts both key-words 'N' and 'chunks'. + % + % + function result = utp_10 + + % + % + % Check that the split method accepts both key-words 'N' and 'chunks'. + % + % + + try + % + N = 4; + plC = plist('chunks', N); + plN = plist('N', N); + outC = split(at5, plC); + outN = split(at5, plN); + moutC = rebuild(outC); + moutN = rebuild(outN); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of outputs + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(outC) ~= 4, atest = false; end + if numel(outN) ~= 4, atest = false; end + % Check that 'outN' and 'outC' are the same + if ~eq(outN, outC,ple2), atest = false; end + % Check the rebuilding of the object + if ~eq(outC, moutC, ple2), atest = false; end + if ~eq(outN, moutN, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_12 + + % + % + % Tests that the split method works also split 'dx' and 'dy'. + % + % + function result = utp_12 + + % + % + % Tests that the split method works also split 'dx' and 'dy'. + % + % + + try + % + N = 4; + pl = plist('chunks', N); + out = split(atmat, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of outputs + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(atmat) * N, atest = false; end + + % Check each output + for kk=1:numel(atmat) + + ff = floor(length(atmat(kk).y)/N); + is = 1:ff:length(atmat(kk).y); + ie = ff:ff:length(atmat(kk).y); + idx = sort([is(1:N) ie(1:N)]); + idx(end) = length(atmat(kk).y); + + for jj = 1:N + + % Get reference values + x = atmat(kk).x; + y = atmat(kk).y; + % Get and normalize for tsdata the values + if isa(atmat(kk).data, 'tsdata') + t0off = (out((kk-1)*N+jj).t0.utc_epoch_milli - atmat(kk).t0.utc_epoch_milli)/1e3; + ox = out((kk-1)*N+jj).x + t0off; + else + ox = out((kk-1)*N+jj).x; + end + oy = out((kk-1)*N+jj).y; + % Compute the range + range = idx(jj*2-1):idx(jj*2); + % Check data + if ~isa(atmat(kk).data, 'cdata') + if any(abs(ox - x(range)) > TOL), atest = false; end + if ~isequal(oy, y(range)), atest = false; end + else + if ~isequal(oy, y(range).'), atest = false; end + end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + + %% UTP_13 + + % + % + % Check that the split method ignores the samples which doesn't fit. + % + % + function result = utp_13 + + % + % + % Check that the split method ignores the samples which doesn't fit. + % Use for this test the key-word 'match' + % + % + + try + % + N = 7; + pl = plist('chunks', N, 'match', false); + out = split(at5, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of outputs + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check the number of outputs + if numel(out) ~= N, atest = false; end + % Check the output + ff = floor(length(at5.y)/N); + is = 1:ff:length(at5.y); + ie = ff:ff:length(at5.y); + idx = sort([is(1:N) ie(1:N)]); + + for jj = 1:N + + % Get reference values + x = at5.x; + y = at5.y; + % Get and normalize for tsdata the values + ox = out(jj).x + (out(jj).t0.utc_epoch_milli - at5.t0.utc_epoch_milli)/1000; + oy = out(jj).y; + % Compute the range + range = idx(jj*2-1):idx(jj*2); + % Check data + if any(abs(ox - x(range)) > TOL), atest = false; end + if ~isequal(oy, y(range)), atest = false; end + end + + % Check the rebuilding of the object + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + %% UTP_15 + + % + % + % Check that the split method works with notequal sampled data. + % + % + function result = utp_15 + + % + % + % Check that the split method works with notequal sampled data. + % + % + + try + % + xOffset = 60; + y = randn(2e3,1); + x = [1:150 152:400 402:1019 1021:1999]; + y = y(x); + + a1 = ao(plist('xvals', x, 'yvals', y, 'fs', 1, 'yunits', 'N')); + a1.setXY(x + xOffset, y); + a1.setT0(time('2009-11-03 18:00:00.000')); + + N = 5; + + pl1 = plist(... + 'chunks', N, ... + 'match', false); + pl2 = plist(... + 'chunks', N, ... + 'match', true); + out1 = split(a1, pl1); + out2 = split(a1, pl2); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the outputs + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Compute the starting point of the first data sample. + firstX = 1:floor(a1.len/N):a1.len; + firstX = a1.x(firstX(1:N)); + + % Check the number of outputs + if numel(out1) ~= N, atest = false; end + if numel(out2) ~= N, atest = false; end + + for jj = 1:numel(out1) + % Check t0 + if ~isequal(out1(jj).t0, a1.t0), atest = false; end + % Check first x value + if ~isequal(out1(jj).x(1), firstX(jj)), atest = false; end + if ~isequal(out2(jj).x(1), firstX(jj)), atest = false; end + % Check the rebuilding of the object + if ~eq(out1(jj), mout1(jj), ple2), atest = false; end + if ~eq(out2(jj), mout2(jj), ple2), atest = false; end + end + + % Check length + if ~isequal(sum(out2.len), a1.len), atest = false; end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_15 +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_split_interval.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_split_interval.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,1277 @@ +% UTP_AO_SPLIT a set of UTPs for the ao/split method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_split_interval.m,v 1.9 2011/09/29 12:09:56 ingo Exp $ +% + +% +% +% The split method of the ao class splits an analysis object into the +% specified segments. This UTP splits the AOs into sample segments. +% +% + +function results = utp_ao_split_interval(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'split'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test with AO which can collapse the x-axis + + n = 300; + fs = 3; + x = 0:(1/fs):(n/fs)-1/fs; + a1 = ao(x, randn(n,1), fs); + a1.setT0(a1.t0 + time('14:00:00')); + st = '14:00:25'; + et = '14:01:15'; + pli = plist('start_time', st, 'end_time', et); + results = [results utp_11(mthd, a1, ple1, pli)]; % Test plotinfo doesn't disappear + + results = [results utp_12]; % Test key-words: start_time + duration + results = [results utp_13]; % Test key-words: timespan + results = [results utp_14]; % Test key-words: start_time + end_time + results = [results utp_15]; % Test not equal sampled data (tsdata) and 'timeshift' option + results = [results utp_16]; % Test not equal sampled data (tsdata) and 'timeshift' option + results = [results utp_17]; % Test not equal sampled data (tsdata) and 'timeshift' option + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + idx = 1; + if ~isempty(io(idx).sets), atest = false; end + if ~isempty(io(idx).plists), atest = false; end + %%% Check all Sets + idx = 2; + if ~any(strcmpi(io(idx).sets, 'Default')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By times')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By frequencies')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By samples')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By chunks')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By interval start/end')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By interval start/duration')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By interval timespan')), atest = false; end + if numel(io(idx).plists) ~= numel(io(idx).sets), atest = false; end + %%%%%%%%%% SET 'Default' + idx = 3; + if io(idx).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(idx).plists.isparam('times'), atest = false; end + % Check default value + if ~isEmptyDouble(io(idx).plists.find('times')), atest = false; end + % Check options + if ~isequal(io(idx).plists.getOptionsForParam('times'), {[]}), atest = false; end + %%%%%%%%%% SET 'By times' + idx = 4; + if io(idx).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(idx).plists.isparam('times'), atest = false; end + % Check default value + if ~isEmptyDouble(io(idx).plists.find('times')), atest = false; end + % Check options + if ~isequal(io(idx).plists.getOptionsForParam('times'), {[]}), atest = false; end + %%%%%%%%%% SET 'By frequencies' + idx = 5; + if io(idx).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(idx).plists.isparam('frequencies'), atest = false; end + % Check default value + if ~isEmptyDouble(io(idx).plists.find('frequencies')), atest = false; end + % Check options + if ~isequal(io(idx).plists.getOptionsForParam('frequencies'), {[]}), atest = false; end + %%%%%%%%%% SET 'By samples' + idx = 6; + if io(idx).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(idx).plists.isparam('samples'), atest = false; end + % Check default value + if ~isEmptyDouble(io(idx).plists.find('samples')), atest = false; end + % Check options + if ~isequal(io(idx).plists.getOptionsForParam('samples'), {[]}), atest = false; end + %%%%%%%%%% SET 'By chunks' + idx = 7; + if io(idx).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(idx).plists.isparam('N'), atest = false; end + if ~io(idx).plists.isparam('match'), atest = false; end + % Check default value + if ~isEmptyDouble(io(idx).plists.find('N')), atest = false; end + if ~isequal(io(idx).plists.find('match'), true), atest = false; end + % Check options + if ~isequal(io(idx).plists.getOptionsForParam('N'), {[]}), atest = false; end + if ~isequal(io(idx).plists.getOptionsForParam('match'), {true, false}), atest = false; end + %%%%%%%%%% SET 'By interval start/end' + idx = 8; + if io(idx).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(idx).plists.isparam('start_time'), atest = false; end + if ~io(idx).plists.isparam('end_time'), atest = false; end + % Check default value + if ~eq(io(idx).plists.find('start_time'), time(0), ple1), atest = false; end + if ~eq(io(idx).plists.find('end_time'), time(0), ple1), atest = false; end + % Check options + %%%%%%%%%% SET 'By interval start/duration' + idx = 9; + if io(idx).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(idx).plists.isparam('start_time'), atest = false; end + if ~io(idx).plists.isparam('duration'), atest = false; end + % Check default value + if ~eq(io(idx).plists.find('start_time'), time(0), ple1), atest = false; end + if ~eq(io(idx).plists.find('duration'), time(0), ple1), atest = false; end + % Check options + %%%%%%%%%% SET 'By interval timespan' + idx = 10; + if io(idx).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(idx).plists.isparam('timespan'), atest = false; end + % Check default value + ts = timespan(0,0); + if ~eq(io(idx).plists.find('timespan'), ts, ple1), atest = false; end + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the split method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the split method works for a vector of AOs as input. + % + % + + try + % + n1 = 300; + fs1 = 3; + x1 = 0:(1/fs1):(n1/fs1)-1/fs1; + a1 = ao(x1, randn(n1,1), fs1); + n2 = 100; + fs2 = 1; + x2 = 0:(1/fs2):(n2/fs2)-1/fs2; + a2 = ao(x2, randn(n2,1), fs2); + n3 = 100; + fs3 = .3; + x3 = 0:(1/fs3):(n3/fs3)-1/fs3; + a3 = ao(x3, randn(n3,1), fs3); + a1.setT0(a1.t0 + time('14:00:00')); + a2.setT0(a2.t0 + time('14:00:00')); + a3.setT0(a3.t0 + time('14:00:00')); + avec = [a1, a2, a3]; + st = '14:00:25'; + et = '14:01:15'; + pl = plist('start_time', st, 'end_time', et); + out = split(avec, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % 'avec' times numbers of intervals + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + % Check each output + for kk=1:2:numel(out) + %%%% Check Interval '14:00:25' .. '14:01:15' + x = avec(kk).x + avec(kk).t0.double; + y = avec(kk).y; + % Comput start/end time + ts = time(st).double; + te = time(et).double; + idx = find(x >= ts & x < te); + % Normalize out data + ox = out(kk).x + out(kk).t0.double; + oy = out(kk).y; + % Check data + if ~isequal(ox, x(idx)), atest = false; end + if ~isequal(oy, y(idx)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the split method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Tests that the split method works with a matrix of AOs as input. + % + % + + try + % + n1 = 300; + fs1 = 3; + x1 = 0:(1/fs1):(n1/fs1)-1/fs1; + a1 = ao(x1, randn(n1,1), fs1); + n2 = 100; + fs2 = 1; + x2 = 0:(1/fs2):(n2/fs2)-1/fs2; + a2 = ao(x2, randn(n2,1), fs2); + n3 = 100; + fs3 = .3; + x3 = 0:(1/fs3):(n3/fs3)-1/fs3; + a3 = ao(x3, randn(n3,1), fs3); + a1.setT0(a1.t0 + time('14:00:00')); + a2.setT0(a2.t0 + time('14:00:00')); + a3.setT0(a3.t0 + time('14:00:00')); + amat = [a1, a2, a3; a3, a1, a2]; + st = '14:00:25'; + et = '14:01:15'; + pl = plist('start_time', st, 'end_time', et); + out = split(amat, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % 'amat' times numbers of intervals + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + % Check each output + for kk=1:2:numel(out) + %%%% Check Interval '14:00:25' .. '14:01:15' + x = amat(kk).x + amat(kk).t0.double; + y = amat(kk).y; + % Comput start/end time + ts = time(st).double; + te = time(et).double; + idx = find(x >= ts & x < te); + % Normalize out data + ox = out(kk).x + out(kk).t0.double; + oy = out(kk).y; + % Check data + if ~isequal(ox, x(idx)), atest = false; end + if ~isequal(oy, y(idx)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the split method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Tests that the split method works with a list of AOs as input. + % + % + + try + % + n1 = 300; + fs1 = 3; + x1 = 0:(1/fs1):(n1/fs1)-1/fs1; + a1 = ao(x1, randn(n1,1), fs1); + n2 = 100; + fs2 = 1; + x2 = 0:(1/fs2):(n2/fs2)-1/fs2; + a2 = ao(x2, randn(n2,1), fs2); + n3 = 100; + fs3 = .3; + x3 = 0:(1/fs3):(n3/fs3)-1/fs3; + a3 = ao(x3, randn(n3,1), fs3); + a1.setT0(a1.t0 + time('14:00:00')); + a2.setT0(a2.t0 + time('14:00:00')); + a3.setT0(a3.t0 + time('14:00:00')); + st = '14:00:25'; + et = '14:01:15'; + pl = plist('start_time', st, 'end_time', et); + out = split(a1, a2, a3, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % 'amat' times numbers of intervals + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [a1, a2, a3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(aoin), atest = false; end + % Check each output + for kk=1:2:numel(out) + %%%% Check Interval '14:00:25' .. '14:01:15' + x = aoin(kk).x + aoin(kk).t0.double; + y = aoin(kk).y; + % Comput start/end time + ts = time(st).double; + te = time(et).double; + idx = find(x >= ts & x < te); + % Normalize out data + ox = out(kk).x + out(kk).t0.double; + oy = out(kk).y; + % Check data + if ~isequal(ox, x(idx)), atest = false; end + if ~isequal(oy, y(idx)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the split method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Tests that the split method works with a mix of different shaped AOs as + % input. + % + % + + try + % + n1 = 300; + fs1 = 3; + x1 = 0:(1/fs1):(n1/fs1)-1/fs1; + a1 = ao(x1, randn(n1,1), fs1); + n2 = 100; + fs2 = 1; + x2 = 0:(1/fs2):(n2/fs2)-1/fs2; + a2 = ao(x2, randn(n2,1), fs2); + n3 = 100; + fs3 = .3; + x3 = 5000:(1/fs3):5000+((n3/fs3)-1/fs3); + a3 = ao(x3, randn(n3,1), fs3); + a1.setT0(a1.t0 + time('14:00:00')); + a2.setT0(a2.t0 + time('14:00:00')); + a3.setT0(a3.t0 + time('14:00:00')); + st = '14:00:25'; + et = '14:01:15'; + pl = plist('start_time', st, 'end_time', et); + out = split(a1, [a2;a1], a3, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % 'amat' times numbers of intervals + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [a1, a2, a1, a3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(aoin), atest = false; end + % Check each output + for kk=1:2:numel(out) + %%%% Check Interval '14:00:25' .. '14:01:15' + x = aoin(kk).x + aoin(kk).t0.double; + y = aoin(kk).y; + % Comput start/end time + ts = time(st).double; + te = time(et).double; + idx = find(x >= ts & x < te); + % Normalize out data + ox = out(kk).x + out(kk).t0.double; + oy = out(kk).y; + % Check data + if ~isequal(ox, x(idx)), atest = false; end + if ~isequal(oy, y(idx)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the split method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the split method can be processed back. + % + % + + try + % + n1 = 100; + fs1 = .3; + x1 = 5000:1/fs1:5000+((n1/fs1)-1/fs1); + a1 = ao(x1, randn(n1,1), fs1); + a1.setT0(a1.t0 + time('14:00:00')); + st = '14:00:25'; + et = '14:01:15'; + pl = plist('start_time', st, 'end_time', et); + out = split(a1, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'split'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'split'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % The split method can not modify the input AO. + % + % + function result = utp_07 + + % + % + % The split method can not modify the input AO. + % + % + + try + % + a1 = ao(5000:5099, randn(100,1), 1); + a1.setT0(a1.t0 + time('14:00:00')); + st = '14:00:25'; + et = '14:01:15'; + pl = plist('start_time', st, 'end_time', et); + amodi = ao(at1); + aeq = ao(at1); + out = aeq.split(pl); + amodi.split(pl); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothind to do. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the split method keeps the data shape of the input object. + % The input AO must be an AO with row data and an AO with column data. + % + % + + try + % + a1 = ao(5000:5099, randn(100,1), 1); + a2 = ao(5000:5099, randn(100,1).', 1); + a1.setT0(a1.t0 + time('14:00:00')); + a2.setT0(a1.t0 + time('14:00:00')); + st = '14:00:25'; + et = '14:01:15'; + pl = plist('start_time', st, 'end_time', et); + out1 = split(a1, pl); + out2 = split(a2, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,1) == 1, atest = false; end + if size(out2.data.y,2) == 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the split method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + a1 = ao(5000:5099, randn(100,1), 1); + a2 = ao(5000:5099, randn(100,1).', 1); + a1.setT0(a1.t0 + time('14:00:00')); + a2.setT0(a1.t0 + time('14:00:00')); + st = '14:00:25'; + et = '14:01:15'; + pl = plist('start_time', st, 'end_time', et); + [o1, o2] = split(a1, a2, pl); + o3 = split(a1, a2, pl); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the split method can handle AO which have a collaped x-axis. + % + % + function result = utp_10 + + % + % + % Check that the split method can handle AO which have a collaped x-axis. + % + % + + try + % + plao = plist('fs', 30, 'nsecs', 30, 'waveform', 'sine wave', 'f', 1.23, 'phi', 30); + a1 = ao(plao); + a1.setT0(a1.t0 + time('14:00:00')); + st = '14:00:07'; + et = '14:00:17'; + pl = plist('start_time', st, 'end_time', et); + out = split(a1, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of outputs + % 2) Check the output + % 3) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(out) ~= 1, atest = false; end + % Check the output + x = a1.x + a1.t0.double; + y = a1.y; + % Comput start/end time + ts = time(st).double; + te = time(et).double; + idx = find(x >= ts & x < te); + % Normalize out data + ox = out.x + out.t0.double; + oy = out.y; + % Check data + if ~isequal(ox, x(idx)), atest = false; end + if ~isequal(oy, y(idx)), atest = false; end + % Check the rebuilding of the object + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + + %% UTP_12 + + % + % + % Check that the split method uses the key-words: start_time and duration + % + % + function result = utp_12 + + % + % + % Check that the split method uses the key-words: start_time and + % duration + % + % + + try + % + a1 = ao(5000:5099, randn(100,1), 1); + a1.setT0(a1.t0 + time('14:00:00')); + st = format(time('14:01:00')+5000, 'HH:MM:SS'); + du = '00:00:10'; + plc = plist('start_time', st, 'duration', du); + plo = plist('start_time', time(st), 'duration', time(du)); + outc = split(a1, plc); + outo = split(a1, plo); + moutc = rebuild(outc); + mouto = rebuild(outo); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of outputs + % 2) Check the output + % 3) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + TOL = 1e-11; + if stest + % + % Check the number of outputs + if numel(outc) ~= 1, atest = false; end + if numel(outo) ~= 1, atest = false; end + % Check the output + x = a1.x + a1.t0.double; + y = a1.y; + % Comput start/end time + ts = time(st).double; + te = ts + time(du).double; + idx = find(x >= ts & x < te); + % Normalize out data + oxc = outc.x + outc.t0.double; + oyc = outc.y; + oxo = outo.x + outo.t0.double; + oyo = outo.y; + % Check data + if any(abs(oxc - x(idx)) > TOL), atest = false; end + if ~isequal(oyc, y(idx)), atest = false; end + if any(abs(oxo - x(idx)) > TOL), atest = false; end + if ~isequal(oyo, y(idx)), atest = false; end + % Check the rebuilding of the object + if ~eq(outc, moutc, ple2), atest = false; end + if ~eq(outo, mouto, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Check that the split method uses the key-words: timespan + % + % + function result = utp_13 + + % + % + % Check that the split method uses the key-words: timespan + % + % + + try + % + a1 = ao(5000:5099, randn(100,1), 1); + a1.setT0(a1.t0 + time('14:00:00')); + ts = timespan(time('14:00:20')+5e3, time('14:00:50')+5e3); + pl = plist('timespan', ts); + out = split(a1, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of outputs + % 2) Check the output + % 3) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + TOL = 1e-11; + if stest + % + % Check the number of outputs + if numel(out) ~= 1, atest = false; end + % Check the output + x = a1.x + a1.t0.double; + y = a1.y; + % Comput start/end time + ts = double(time('14:00:20')+5e3); + te = double(time('14:00:50')+5e3); + idx = find(x >= ts & x < te); + % Normalize out data + ox = out.x + out.t0.double; + oy = out.y; + % Check data + if any(abs(ox - x(idx)) > TOL), atest = false; end + if ~isequal(oy, y(idx)), atest = false; end + % Check the rebuilding of the object + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + %% UTP_14 + + % + % + % Check that the split method uses the key-words: start_time and end_time + % + % + function result = utp_14 + + % + % + % Check that the split method uses the key-words: start_time and end_time + % + % + + try + % + a1 = ao(plist('xvals', '0:199', 'yvals', 'randn(200,1)', 'fs', 1, 't0', '14:00:00 2009-02-17')); + st = '14:01:40 2009-02-17'; + et = '14:03:20 17-02-2009'; + plc = plist('start_time', st, 'end_time', et); + plo = plist('start_time', time(st), 'end_time', time(et)); + outc = split(a1, plc); + outo = split(a1, plo); + moutc = rebuild(outc); + mouto = rebuild(outo); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of outputs + % 2) Check the output + % 3) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(outc) ~= 1, atest = false; end + if numel(outo) ~= 1, atest = false; end + % Check the output + x = a1.x + a1.t0.double; + y = a1.y; + % Comput start/end time + ts = time(st).double; + te = time(et).double; + idx = find(x >= ts & x < te); + % Normalize out data + oxc = outc.x + outc.t0.double; + oyc = outc.y; + oxo = outo.x + outo.t0.double; + oyo = outo.y; + % Check data + if ~isequal(oxc, x(idx)), atest = false; end + if ~isequal(oyc, y(idx)), atest = false; end + if ~isequal(oxo, x(idx)), atest = false; end + if ~isequal(oyo, y(idx)), atest = false; end + % Check the rebuilding of the object + if ~eq(outc, moutc, ple2), atest = false; end + if ~eq(outo, mouto, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_14 + + %% UTP_15 + + % + % + % Check that the split method works with notequal sampled data. + % Check that the interval can be passed via two time objects. + % + % + function result = utp_15 + + % + % + % Check that the split method works with notequal sampled data. + % Check that the interval can be passed via two time objects. + % + % + + try + % + x = [1:1018 1020:1999 2001:3000 3002:6500 6502:7000 7002:10000]; + y = randn(1e4,1); + y = y(x); % Use the x values as an index + a1 = ao(plist('xvals', x, 'yvals', y, 'fs', 1, 't0', '2009-11-03 18:00:00.000', 'yunits', 'N')); + + start_time = time('2009-11-03 18:10:00.000'); + end_time = time('2009-11-03 18:20:00.000'); + + pl1 = plist(... + 'start_time', start_time, ... + 'end_time', end_time); + out1 = split(a1, pl1); + mout1 = rebuild(out1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the outputs + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + + % Check number of seconds + dt = double(end_time - start_time); + if out1.nsecs ~= dt, atest = false; end + % Check t0 + dt0 = double(out1.t0 - a1.t0); + if dt0 ~= 0, atest = false; end + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_15 + + + %% UTP_16 + + % + % + % Check that the split method works with notequal sampled data. + % Check that the interval can be passed via two time strings. + % + % + function result = utp_16 + + % + % + % Check that the split method works with notequal sampled data. + % Check that the interval can be passed via two time strings. + % + % + + try + % + x = [1:1018 1020:1999 2001:3000 3002:6500 6502:7000 7002:10000]; + y = randn(1e5, 1); + y = y(x); % Use the x values as an index + a1 = ao(plist('xvals', x, 'yvals', y, 'fs', 1, 't0', '2009-11-03 18:00:00.000', 'yunits', 'N')); + + start_time = '2009-11-03 18:10:00.000'; + end_time = '2009-11-03 18:20:00.000'; + + pl1 = plist(... + 'start_time', start_time, ... + 'end_time', end_time); + out1 = split(a1, pl1); + mout1 = rebuild(out1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + + % Check number of seconds + dt = double(time(end_time) - time(start_time)); + if out1.nsecs ~= dt, atest = false; end + % Check t0 + dt0 = double(out1.t0 - a1.t0); + if dt0 ~= 0, atest = false; end + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_16 + + %% UTP_17 + + % + % + % Check that the split method works with notequal sampled data. + % Check that the interval can be passed via one timespan object. + % + % + function result = utp_17 + + % + % + % Check that the split method works with notequal sampled data. + % Check that the interval can be passed via one timespan object. + % + % + + try + % + x = [1:1018 1020:1999 2001:3000 3002:6500 6502:7000 7002:10000]; + y = randn(1e5, 1); + y = y(x); % Use the x values as an index + a1 = ao(plist('xvals', x, 'yvals', y, 'fs', 1, 't0', '2009-11-03 18:00:00.000', 'yunits', 'N')); + + start_time = '2009-11-03 18:10:00.000'; + end_time = '2009-11-03 18:15:00.000'; + + time_range = timespan(start_time, end_time); + + pl1 = plist(... + 'timespan', time_range); + out1 = split(a1, pl1); + mout1 = rebuild(out1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + + % Check number of seconds + dt = double(time_range.endT - time_range.startT); + if out1.nsecs ~= dt, atest = false; end + % Check t0 + dt0 = double(out1.t0 - a1.t0); + if dt0 ~= 0, atest = false; end + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_17 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_split_samples.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_split_samples.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,867 @@ +% UTP_AO_SPLIT a set of UTPs for the ao/split method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_split_samples.m,v 1.10 2011/09/29 12:09:56 ingo Exp $ +% + +% +% +% The split method of the ao class splits an analysis object into the +% specified segments. This UTP splits the AOs into sample segments. +% +% + +function results = utp_ao_split_samples(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'split'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + at4.setY(randn(15)); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test 'dx' and 'dy' + + pli = plist('samples', [4 150 10 125]); + results = [results utp_11(mthd, a1, ple1, pli)]; % Test plotinfo doesn't disappear + results = [results utp_15]; % Test not equal sampled data (tsdata) and 'timeshift' option + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + idx = 1; + if ~isempty(io(idx).sets), atest = false; end + if ~isempty(io(idx).plists), atest = false; end + %%% Check all Sets + idx = 2; + if ~any(strcmpi(io(idx).sets, 'Default')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By times')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By frequencies')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By samples')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By chunks')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By interval start/end')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By interval start/duration')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By interval timespan')), atest = false; end + if numel(io(idx).plists) ~= numel(io(idx).sets), atest = false; end + %%%%%%%%%% SET 'Default' + idx = 3; + if io(idx).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(idx).plists.isparam('times'), atest = false; end + % Check default value + if ~isEmptyDouble(io(idx).plists.find('times')), atest = false; end + % Check options + if ~isequal(io(idx).plists.getOptionsForParam('times'), {[]}), atest = false; end + %%%%%%%%%% SET 'By times' + idx = 4; + if io(idx).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(idx).plists.isparam('times'), atest = false; end + % Check default value + if ~isEmptyDouble(io(idx).plists.find('times')), atest = false; end + % Check options + if ~isequal(io(idx).plists.getOptionsForParam('times'), {[]}), atest = false; end + %%%%%%%%%% SET 'By frequencies' + idx = 5; + if io(idx).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(idx).plists.isparam('frequencies'), atest = false; end + % Check default value + if ~isEmptyDouble(io(idx).plists.find('frequencies')), atest = false; end + % Check options + if ~isequal(io(idx).plists.getOptionsForParam('frequencies'), {[]}), atest = false; end + %%%%%%%%%% SET 'By samples' + idx = 6; + if io(idx).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(idx).plists.isparam('samples'), atest = false; end + % Check default value + if ~isEmptyDouble(io(idx).plists.find('samples')), atest = false; end + % Check options + if ~isequal(io(idx).plists.getOptionsForParam('samples'), {[]}), atest = false; end + %%%%%%%%%% SET 'By chunks' + idx = 7; + if io(idx).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(idx).plists.isparam('N'), atest = false; end + if ~io(idx).plists.isparam('match'), atest = false; end + % Check default value + if ~isEmptyDouble(io(idx).plists.find('N')), atest = false; end + if ~isequal(io(idx).plists.find('match'), true), atest = false; end + % Check options + if ~isequal(io(idx).plists.getOptionsForParam('N'), {[]}), atest = false; end + if ~isequal(io(idx).plists.getOptionsForParam('match'), {true, false}), atest = false; end + %%%%%%%%%% SET 'By interval start/end' + idx = 8; + if io(idx).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(idx).plists.isparam('start_time'), atest = false; end + if ~io(idx).plists.isparam('end_time'), atest = false; end + % Check default value + if ~eq(io(idx).plists.find('start_time'), time(0), ple1), atest = false; end + if ~eq(io(idx).plists.find('end_time'), time(0), ple1), atest = false; end + % Check options + %%%%%%%%%% SET 'By interval start/duration' + idx = 9; + if io(idx).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(idx).plists.isparam('start_time'), atest = false; end + if ~io(idx).plists.isparam('duration'), atest = false; end + % Check default value + if ~eq(io(idx).plists.find('start_time'), time(0), ple1), atest = false; end + if ~eq(io(idx).plists.find('duration'), time(0), ple1), atest = false; end + % Check options + %%%%%%%%%% SET 'By interval timespan' + idx = 10; + if io(idx).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(idx).plists.isparam('timespan'), atest = false; end + % Check default value + ts = timespan(0,0); + if ~eq(io(idx).plists.find('timespan'), ts, ple1), atest = false; end + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the split method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the split method works for a vector of AOs as input. + % + % + + try + % + pl = plist('samples', [4 150 10 125]); + out = split(atvec, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % 'atvec' times numbers of intervals + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(atvec) * numel(pl.find('samples'))/2, atest = false; end + % Check each output + for kk=1:2:numel(out) + %%%% Check Interval 4 .. 150 + x = atvec((kk+1)/2).x; + y = atvec((kk+1)/2).y; + if isa(out(kk).data, 'tsdata') + t0off = (out(kk).t0.utc_epoch_milli - atvec((kk+1)/2).t0.utc_epoch_milli)/1e3; + ox = out(kk).x + t0off; + else + ox = out(kk).x; + end + oy = out(kk).y; + if any(abs(ox - x(4:150)) > TOL), atest = false; end + if ~isequal(oy, y(4:150)), atest = false; end + %%%% Check Interval 10 .. 125 + x = atvec((kk+1)/2).x; + y = atvec((kk+1)/2).y; + if isa(out(kk+1).data, 'tsdata') + t0off = (out(kk+1).t0.utc_epoch_milli - atvec((kk+1)/2).t0.utc_epoch_milli)/1e3; + ox = out(kk+1).x + t0off; + else + ox = out(kk+1).x; + end + oy = out(kk+1).y; + if any(abs(ox - x(10:125)) > TOL), atest = false; end + if ~isequal(oy, y(10:125)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the split method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Tests that the split method works with a matrix of AOs as input. + % + % + + try + % + pl = plist('samples', [50 90]); + out = split(atmat, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % 'atmat' times numbers of intervals + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(atmat) * numel(pl.find('samples'))/2, atest = false; end + % Check each output + for kk=1:numel(out) + %%%% Check Interval 50 .. 90 + x = atmat(kk).x; + y = atmat(kk).y; + if isa(out(kk).data, 'tsdata') + t0off = (out(kk).t0.utc_epoch_milli - atmat(kk).t0.utc_epoch_milli)/1e3; + ox = out(kk).x + t0off; + else + ox = out(kk).x; + end + oy = out(kk).y; + if ~isa(out(kk).data, 'cdata') + if any(abs(ox - x(50:90)) > TOL), atest = false; end + if ~isequal(oy, y(50:90)), atest = false; end + else + if ~isequal(oy, []), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the split method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Tests that the split method works with a list of AOs as input. + % + % + + try + % + pl = plist('samples', [4 15]); + out = split(at1, at2, at3, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % 'atvec' times numbers of intervals + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-14; + aoin = [at1, at2, at3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(aoin) * numel(pl.find('samples'))/2, atest = false; end + % Check each output + for kk=1:numel(out) + %%%% Check Interval 4 .. 15 + x = aoin(kk).x; + y = aoin(kk).y; + if isa(out(kk).data, 'tsdata') + t0off = (out(kk).t0.utc_epoch_milli - aoin(kk).t0.utc_epoch_milli)/1e3; + ox = out(kk).x + t0off; + else + ox = out(kk).x; + end + oy = out(kk).y; + if any(abs(ox - x(4:15)) > TOL), atest = false; end + if ~isequal(oy, y(4:15)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the split method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Tests that the split method works with a mix of different shaped AOs as + % input. + % + % + + try + % + pl = plist('samples', [13 99]); + out = split(at1, atmat, atvec, at6, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % 'atvec' times numbers of intervals + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-14; + aoin = [at1, reshape(atmat, 1, []), reshape(atvec, 1, []), at6]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(aoin) * numel(pl.find('samples'))/2, atest = false; end + % Check each output + for kk=1:numel(out) + %%%% Check Interval 13 .. 99 + x = aoin(kk).x; + y = aoin(kk).y; + if isa(out(kk).data, 'tsdata') + t0off = (out(kk).t0.utc_epoch_milli - aoin(kk).t0.utc_epoch_milli)/1e3; + ox = out(kk).x + t0off; + else + ox = out(kk).x; + end + oy = out(kk).y; + if ~isa(out(kk).data, 'cdata') + if any(abs(ox - x(13:99)) > TOL), atest = false; end + if ~isequal(oy, y(13:99)), atest = false; end + else + if ~isequal(oy, y(13:15)'), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the split method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the split method can be processed back. + % + % + + try + % + pl = plist('samples', [10 30 25 55]); + out = split(at1, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'split'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out(1).hist.methodInfo.mname, 'split'), atest = false; end + if ~strcmp(out(2).hist.methodInfo.mname, 'split'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % The split method can not modify the input AO. + % + % + function result = utp_07 + + % + % + % The split method can not modify the input AO. + % + % + + try + % + pl = plist('samples', [4 15]); + amodi = ao(at1); + aeq = ao(at1); + out = aeq.split(pl); + amodi.split(pl); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothind to do. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the split method keeps the data shape of the input object. + % The input AO must be an AO with row data and an AO with column data. + % + % + + try + % + pl = plist('samples', [5 7]); + out1 = split(at5, pl); + out2 = split(at6, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,1) == 1, atest = false; end + if size(out2.data.y,2) == 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the split method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + pl = plist('samples', [2 6 10 12]); + [o1, o2] = split(at5, pl); + o3 = split(at5, pl); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Test that the split method also splits the 'dx' and 'dy' values. + % + % + function result = utp_10 + + % + % + % Test that the split method also splits the 'dx' and 'dy' values. + % + % + + try + % + % Create default values for 'dx' and 'dy' + dx = randn(1000,1); + dy = randn(1000,1); + % tsdata + a1 = at1.setDx(dx(1:at1.len)); + a1.setDy(dy(1:at1.len)); + % fsdata + a2 = at2.setDx(dx(1:at2.len)); + a2.setDy(dy(1:at2.len)); + % xydata + a3 = at3.setDx(dx(1:at3.len)); + a3.setDy(dy(1:a3.len)); + % cdata + a4 = at4.setDy(dy(1:at4.len)); + + % Test with only one value for 'dx' and 'dy' + % tsdata + a5 = at1.setDx(123); + a5.setDy(123); + + sl = [20 90]; + out1 = split(a1, plist('samples', sl)); + out2 = split(a2, plist('samples', sl)); + out3 = split(a3, plist('samples', sl)); + out4 = split(a4, plist('samples', [3 7])); + out5 = split(a5, plist('samples', sl)); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + mout5 = rebuild(out5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the re-built object is the same as in 'out'. + % + % + + atest = true; + if stest + % + % Check the output + ddx = dx(1:at1.len); + ddy = dy(1:at1.len); + if ~isequal(out1.dx, ddx(sl(1):sl(2))); atest = false; end + if ~isequal(out1.dy, ddy(sl(1):sl(2))); atest = false; end + ddx = dx(1:at1.len); + ddy = dy(1:at2.len); + if ~isequal(out2.dx, ddx(sl(1):sl(2))); atest = false; end + if ~isequal(out2.dy, ddy(sl(1):sl(2))); atest = false; end + ddx = dx(1:at3.len); + ddy = dy(1:at3.len); + if ~isequal(out3.dx, ddx(sl(1):sl(2))); atest = false; end + if ~isequal(out3.dy, ddy(sl(1):sl(2))); atest = false; end + ddy = dy(1:at4.len); + if ~isequal(out4.dy, ddy(3:7)); atest = false; end + if ~isequal(out5.dx, a5.dx); atest = false; end + if ~isequal(out5.dy, a5.dy); atest = false; end + % Check the re-built objects + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + if ~eq(mout4, out4, ple2), atest = false; end + if ~eq(mout5, out5, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_15 + + % + % + % Check that the split method works with notequal sampled data. + % Check that the split method works with 'timeshift' option. + % + % + function result = utp_15 + + % + % + % Check that the split method works with notequal sampled data. + % Check that the split method works with 'timeshift' option. + % + % + + try + % + a1 = ao(plist('tsfcn', 'randn(size(t))', 'fs', 10, 'nsecs', 200, 'yunits', 'N')); + in = [1:150 152:400 402:1019 1021:1999]; + a1.setXY(a1.x(in) + 60, a1.y(in)); + a1.setT0(time('2009-11-03 18:00:00.000')); + + samples_v = [120 300 500 1500 2500 2600]; + samples_o = [samples_v(2) - samples_v(1) + 1;samples_v(4) - samples_v(3) + 1;0;]; + + pl1 = plist(... + 'samples', samples_v); + out1 = split(a1, pl1); + mout1 = rebuild(out1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the outputs + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + + for jj = 1:numel(out1) + % Check number of samples + if ~eq(out1(jj).len, samples_o(jj)), atest = false; end + if ~isempty(out1(jj).data.x) + % Check t0 + if ~isequal(out1(jj).t0, a1.t0), atest = false; end + % Check first x value + if ~eq(out1(jj).data.x(1), a1.data.x(samples_v(jj*2 - 1))), atest = false; end + end + % Check the rebuilding of the object + if ~eq(out1(jj), mout1(jj), ple2), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_15 +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_split_times_frequ.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_split_times_frequ.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,1189 @@ +% UTP_AO_SPLIT a set of UTPs for the ao/split method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_split_times_frequ.m,v 1.20 2011/11/06 18:45:44 mauro Exp $ +% + +% +% +% The split method of the ao class splits an analysis object into the +% specified segments. This UTP splits the AOs into frequencies segments or +% into time segments. +% +% + +function results = utp_ao_split_times_frequ(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'split'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test different end interval (tsdata) + + pli = plist('times', [4 15 10 25]); + results = [results utp_11(mthd, at1, ple1, pli)]; % Test plotinfo doesn't disappear + + results = [results utp_12]; % Test not equal sampled data (tsdata) + results = [results utp_13]; % Test 'dx' and 'dy' + results = [results utp_14]; % Test different end interval (fsdata) + results = [results utp_15]; % Test not equal sampled data (tsdata) and 'timeshift' option + results = [results utp_16]; % Test different end interval (tsdata) + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + idx = 1; + if ~isempty(io(idx).sets), atest = false; end + if ~isempty(io(idx).plists), atest = false; end + %%% Check all Sets + idx = 2; + if ~any(strcmpi(io(idx).sets, 'Default')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By times')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By frequencies')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By samples')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By chunks')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By interval start/end')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By interval start/duration')), atest = false; end + if ~any(strcmpi(io(idx).sets, 'By interval timespan')), atest = false; end + if numel(io(idx).plists) ~= numel(io(idx).sets), atest = false; end + %%%%%%%%%% SET 'Default' + idx = 3; + if io(idx).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(idx).plists.isparam('times'), atest = false; end + % Check default value + if ~isEmptyDouble(io(idx).plists.find('times')), atest = false; end + %%%%%%%%%% SET 'By times' + idx = 4; + if io(idx).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(idx).plists.isparam('times'), atest = false; end + % Check default value + if ~isEmptyDouble(io(idx).plists.find('times')), atest = false; end + %%%%%%%%%% SET 'By frequencies' + idx = 5; + if io(idx).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(idx).plists.isparam('frequencies'), atest = false; end + % Check default value + if ~isEmptyDouble(io(idx).plists.find('frequencies')), atest = false; end + % Check options + if ~isequal(io(idx).plists.getOptionsForParam('frequencies'), {[]}), atest = false; end + %%%%%%%%%% SET 'By samples' + idx = 6; + if io(idx).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(idx).plists.isparam('samples'), atest = false; end + % Check default value + if ~isEmptyDouble(io(idx).plists.find('samples')), atest = false; end + %%%%%%%%%% SET 'By chunks' + idx = 7; + if io(idx).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(idx).plists.isparam('N'), atest = false; end + if ~io(idx).plists.isparam('match'), atest = false; end + % Check default value + if ~isEmptyDouble(io(idx).plists.find('N')), atest = false; end + if ~isequal(io(idx).plists.find('match'), true), atest = false; end + %%%%%%%%%% SET 'By interval start/end' + idx = 8; + if io(idx).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(idx).plists.isparam('start_time'), atest = false; end + if ~io(idx).plists.isparam('end_time'), atest = false; end + % Check default value + if ~eq(io(idx).plists.find('start_time'), time(0), ple1), atest = false; end + if ~eq(io(idx).plists.find('end_time'), time(0), ple1), atest = false; end + %%%%%%%%%% SET 'By interval start/duration' + idx = 9; + if io(idx).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(idx).plists.isparam('start_time'), atest = false; end + if ~io(idx).plists.isparam('duration'), atest = false; end + % Check default value + if ~eq(io(idx).plists.find('start_time'), time(0), ple1), atest = false; end + if ~eq(io(idx).plists.find('duration'), time(0), ple1), atest = false; end + %%%%%%%%%% SET 'By interval timespan' + idx = 10; + if io(idx).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(idx).plists.isparam('timespan'), atest = false; end + % Check default value + ts = timespan(0,0); + if ~eq(io(idx).plists.find('timespan'), ts, ple1), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the split method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the split method works for a vector of AOs as input. + % + % + + try + % + pl_ts = plist('times', [4 15 10 25]); + pl_fs = plist('frequencies', [2.2 4.2 3 6]); + vec_ts = [at1, at5, at6]; + vec_fs = [at1.psd, at5.psd, at6.psd]; + out_ts = split(vec_ts, pl_ts); + out_fs = split(vec_fs, pl_fs); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % 'atvec' times numbers of intervals + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check we have the correct number of outputs + if numel(out_ts) ~= numel(vec_ts) * numel(pl_ts.find('times'))/2, atest = false; end + if numel(out_fs) ~= numel(vec_fs) * numel(pl_fs.find('frequencies'))/2, atest = false; end + % Check each output + for kk=1:2:numel(out_ts) + %%%% Check Interval 4 .. 15 + x = vec_ts((kk+1)/2).x; + y = vec_ts((kk+1)/2).y; + idx = find(x >= 4 & x < 15); + t0off = (out_ts(kk).t0.utc_epoch_milli - vec_ts((kk+1)/2).t0.utc_epoch_milli)/1e3; + ox = out_ts(kk).x + t0off; + oy = out_ts(kk).y; + if any(abs(ox - x(idx)) > TOL), atest = false; end + if ~isequal(oy, y(idx)), atest = false; end + %%%% Check Interval 10 .. 25 + x = vec_ts((kk+1)/2).x; + y = vec_ts((kk+1)/2).y; + idx = find(x >= 10 & x < 25); + t0off = (out_ts(kk+1).t0.utc_epoch_milli - vec_ts((kk+1)/2).t0.utc_epoch_milli)/1e3; + ox = out_ts(kk+1).x + t0off; + oy = out_ts(kk+1).y; + if any(abs(ox - x(idx)) > TOL), atest = false; end + if ~isequal(oy, y(idx)), atest = false; end + end + for kk=1:2:numel(out_fs) + %%%% Check Interval 2.2 .. 4.2 + x = vec_fs((kk+1)/2).x; + y = vec_fs((kk+1)/2).y; + idx = find(x >= 2.2 & x < 4.2); + ox = out_fs(kk).x; + oy = out_fs(kk).y; + if any(abs(ox - x(idx)) > TOL), atest = false; end + if ~isequal(oy, y(idx)), atest = false; end + %%%% Check Interval 3 .. 6 + x = vec_fs((kk+1)/2).x; + y = vec_fs((kk+1)/2).y; + idx = find(x >= 3 & x < 6); + ox = out_fs(kk+1).x; + oy = out_fs(kk+1).y; + if any(abs(ox - x(idx)) > TOL), atest = false; end + if ~isequal(oy, y(idx)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the split method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Tests that the split method works with a matrix of AOs as input. + % + % + + try + % + pl_ts = plist('times', [4 15]); + pl_fs = plist('frequencies', [2.2 4.2]); + mat_ts = [at1, at5, at6; at1, at5, at6; ]; + a = at1.psd; + b = at5.psd; + c = at6.psd; + mat_fs = [a, b, c; a, b, c]; + out_ts = split(mat_ts, pl_ts); + out_fs = split(mat_fs, pl_fs); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % 'atvec' times numbers of intervals + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check we have the correct number of outputs + if numel(out_ts) ~= numel(mat_ts) * numel(pl_ts.find('times'))/2, atest = false; end + if numel(out_fs) ~= numel(mat_fs) * numel(pl_fs.find('frequencies'))/2, atest = false; end + % Check each output + for kk=1:numel(out_ts) + %%%% Check Interval 4 .. 15 + x = mat_ts(kk).x; + y = mat_ts(kk).y; + idx = find(x >= 4 & x < 15); + t0off = (out_ts(kk).t0.utc_epoch_milli - mat_ts(kk).t0.utc_epoch_milli)/1e3; + ox = out_ts(kk).x + t0off; + oy = out_ts(kk).y; + if any(abs(ox - x(idx)) > TOL), atest = false; end + if ~isequal(oy, y(idx)), atest = false; end + end + for kk=1:numel(out_fs) + %%%% Check Interval 2.2 .. 4.2 + x = mat_fs(kk).x; + y = mat_fs(kk).y; + idx = find(x >= 2.2 & x < 4.2); + ox = out_fs(kk).x; + oy = out_fs(kk).y; + if any(abs(ox - x(idx)) > TOL), atest = false; end + if ~isequal(oy, y(idx)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the split method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Tests that the split method works with a list of AOs as input. + % + % + + try + % + pl_ts = plist('times', [4 15]); + pl_fs = plist('frequencies', [2.2 4.2]); + out_ts = split(at1, at5, at6, pl_ts); + out_fs = split(at1.psd, at5.psd, at6.psd, pl_fs); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % 'atvec' times numbers of intervals + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-14; + ints = [at1, at5, at6]; + infs = [at1.psd, at5.psd, at6.psd]; + if stest + % + % Check we have the correct number of outputs + if numel(out_ts) ~= numel(ints) * numel(pl_ts.find('times'))/2, atest = false; end + if numel(out_fs) ~= numel(infs) * numel(pl_fs.find('frequencies'))/2, atest = false; end + % Check each output + for kk=1:numel(out_ts) + %%%% Check Interval 4 .. 15 + x = ints(kk).x; + y = ints(kk).y; + idx = find(x >= 4 & x < 15); + t0off = (out_ts(kk).t0.utc_epoch_milli - ints(kk).t0.utc_epoch_milli)/1e3; + ox = out_ts(kk).x + t0off; + oy = out_ts(kk).y; + if any(abs(ox - x(idx)) > TOL), atest = false; end + if ~isequal(oy, y(idx)), atest = false; end + end + for kk=1:numel(out_fs) + %%%% Check Interval 2.2 .. 4.2 + x = infs(kk).x; + y = infs(kk).y; + idx = find(x >= 2.2 & x < 4.2); + ox = out_fs(kk).x; + oy = out_fs(kk).y; + if any(abs(ox - x(idx)) > TOL), atest = false; end + if ~isequal(oy, y(idx)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the split method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Tests that the split method works with a mix of different shaped AOs as + % input. + % + % + + try + % + pl_ts = plist('times', [4 15]); + pl_fs = plist('frequencies', [2.2 4.2]); + out_ts = split([at1, at5], at6, pl_ts); + out_fs = split([at1.psd, at5.psd], at6.psd, pl_fs); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % 'atvec' times numbers of intervals + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + TOL = 1e-14; + ints = [at1, at5, at6]; + infs = [at1.psd, at5.psd, at6.psd]; + if stest + % + % Check we have the correct number of outputs + if numel(out_ts) ~= numel(ints) * numel(pl_ts.find('times'))/2, atest = false; end + if numel(out_fs) ~= numel(infs) * numel(pl_fs.find('frequencies'))/2, atest = false; end + % Check each output + for kk=1:numel(out_ts) + %%%% Check Interval 4 .. 15 + x = ints(kk).x; + y = ints(kk).y; + idx = find(x >= 4 & x < 15); + t0off = (out_ts(kk).t0.utc_epoch_milli - ints(kk).t0.utc_epoch_milli)/1e3; + ox = out_ts(kk).x + t0off; + oy = out_ts(kk).y; + if any(abs(ox - x(idx)) > TOL), atest = false; end + if ~isequal(oy, y(idx)), atest = false; end + end + for kk=1:numel(out_fs) + %%%% Check Interval 2.2 .. 4.2 + x = infs(kk).x; + y = infs(kk).y; + idx = find(x >= 2.2 & x < 4.2); + ox = out_fs(kk).x; + oy = out_fs(kk).y; + if any(abs(ox - x(idx)) > TOL), atest = false; end + if ~isequal(oy, y(idx)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the split method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the split method can be processed back. + % + % + + try + % + pl_ts = plist('times', [4 15 13 25.5]); + pl_fs = plist('frequencies', [2.2 4.2 1 4]); + out_ts = split(at1, pl_ts); + out_fs = split(at2, pl_fs); + mout_ts = rebuild(out_ts); + mout_fs = rebuild(out_fs); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'split'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out_ts(1).hist.methodInfo.mname, 'split'), atest = false; end + if ~strcmp(out_ts(2).hist.methodInfo.mname, 'split'), atest = false; end + if ~strcmp(out_fs(1).hist.methodInfo.mname, 'split'), atest = false; end + if ~strcmp(out_fs(2).hist.methodInfo.mname, 'split'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout_ts, out_ts, ple2), atest = false; end + if ~eq(mout_fs, out_fs, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % The split method can not modify the input AO. + % + % + function result = utp_07 + + % + % + % The split method can not modify the input AO. + % + % + + try + % + pl = plist('times', [4 15]); + amodi = ao(at1); + aeq = ao(at1); + out = aeq.split(pl); + amodi.split(pl); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothind to do. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the split method keeps the data shape of the input object. + % The input AO must be an AO with row data and an AO with column data. + % + % + + try + % + pl_ts = plist('times', [5 7]); + out1_ts = split(at5, pl_ts); + out2_ts = split(at6, pl_ts); + pl_fs = plist('frequencies', [1 3]); + out1_fs = split(at5.psd, pl_fs); + out2_fs = split(at6.psd, pl_fs); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1_ts.data.y,1) == 1, atest = false; end + if size(out2_ts.data.y,2) == 1, atest = false; end + if size(out1_fs.data.y,1) == 1, atest = false; end + if size(out2_fs.data.y,2) == 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the split method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + pl = plist('times', [2 6 10 12]); + [o1, o2] = split(at5, pl); + o3 = split(at5, pl); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the split method interprets a negative end interval as a + % indicates count from end and a zero for the and interval as the end of + % the vector. + % + % + function result = utp_10 + + % + % + % Check this behavior for time-series data. + % + % + + try + % + toff = 10; + tt = [100 0 120 -40]; + fs = .1; + n = 30; + x = 0:1/fs:1+(n/fs)-1/fs; + aa = ao(x, randn(n,1), fs); + aa.setT0('14:00:00'); + aa.setXY(aa.x+toff, aa.y); % Create an offset + pl = plist('times', tt); + out = split(aa, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Interval 100 .. 0 -> (end) + x = aa.x; + y = aa.y; + idx = find(x >= 100 & x <= x(end)); + ox = out(1).x + (out(1).t0.utc_epoch_milli/1000 - aa.t0.utc_epoch_milli/1000); + oy = out(1).y; + if ~isequal(ox, x(idx)), atest = false; end + if ~isequal(oy, y(idx)), atest = false; end + % Interval 120 .. -40 -> nsecs - 40 + x = aa.x; + y = aa.y; + idx = find(x >= 120 & x < aa.data.nsecs - 40); + ox = out(2).x + (out(2).t0.utc_epoch_milli/1000 - aa.t0.utc_epoch_milli/1000); + oy = out(2).y; + if ~isequal(ox, x(idx)), atest = false; end + if ~isequal(oy, y(idx)), atest = false; end + % Check properties + if ~isequal(out(1).data.nsecs, 200+toff), atest = false; end + if ~isequal(out(2).data.nsecs, 140), atest = false; end + for ii = 1:2 + if ~isequal(out(ii).fs, aa.fs), atest = false; end + if ~eq(out(ii).t0, aa.t0), atest = false; end + if ~eq(out(ii).data.xunits, aa.data.xunits), atest = false; end + if ~eq(out(ii).data.yunits, aa.data.yunits), atest = false; end + end + % Check the rebuilding of the object + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + + %% UTP_12 + + % + % + % Check that the split method works with notequal sampled data. + % + % + function result = utp_12 + + % + % + % Check that the split method works with notequal sampled data. + % + % + + try + % + x = sort(randn(1000,1)* 10); + y = randn(1000,1); + aa = ao(x, y, plist('type', 'tsdata')); + aa.setT0('14:00:00'); + + pl = plist('times', [-5 5]); + out = split(aa, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + tol = 1e-14; + is = -5; + ie = 5; + idx = find(x >= is & x < ie); + if max(out.x - x(idx)) >= tol, atest = false; end + if ~isequal(out.y, y(idx)), atest = false; end + % Check the rebuilding of the object + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Check that the split method also split 'dx' and 'dy'. + % + % + function result = utp_13 + + % + % + % Check that the split method also split 'dx' and 'dy' if this values + % have the same length of the y-values. + % + % + + try + % + x = sort(randn(1000,1)* 10); + y = randn(1000,1); + % Create default values for 'dx' and 'dy' + dx = randn(1000,1); + dy = randn(1000,1); + + ats1 = ao(x, y, plist('type', 'tsdata')); + ats2 = copy(at1, 1); + afs1 = copy(at2, 1); + + ats1.setDx(dx); + ats1.setDy(dy); + ats2.setDx(dx(1:ats2.len)); + ats2.setDy(dy(1:ats2.len)); + afs1.setDx(dx(1:afs1.len)); + afs1.setDy(dy(1:afs1.len)); + + out1 = split(ats1, plist('times', [-5 5])); + out2 = split(ats2, plist('times', [5 15])); + out3 = split(afs1, plist('frequencies', [.5 2])); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + idx = find(x >= -5 & x < 5); + if ~isequal(dx(idx), out1.dx), atest = false; end + if ~isequal(dy(idx), out1.dy), atest = false; end + idx = find(ats2.x >= 5 & ats2.x < 15); + ddx = dx(1:ats2.len); + ddy = dy(1:ats2.len); + if ~isequal(ddx(idx), out2.dx), atest = false; end + if ~isequal(ddy(idx), out2.dy), atest = false; end + idx = find(afs1.x >= .5 & afs1.x < 2); + ddx = dx(1:afs1.len); + ddy = dy(1:afs1.len); + if ~isequal(ddx(idx), out3.dx), atest = false; end + if ~isequal(ddy(idx), out3.dy), atest = false; end + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + if ~eq(out3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + %% UTP_14 + + % + % + % Check that the split method interprets a negative end interval as a + % indicates count from end and a zero for the and interval as the end of + % the vector. + % + % + function result = utp_14 + + % + % + % Check this behavior for frequency-series data. + % + % + + try + % + fs = 60; + n = 30; + x = 1:1/fs:1+(n-1)/fs; + aa = ao(x, randn(n,1), fs); + aa.setT0('14:00:00'); + aa.psd; + pl = plist('frequencies', [7 0 16 -4]); + out = split(aa, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % 3) Check that the output have the same 'fs', 'enbw', 'navs', 'xunits' + % and 'yunits' + % + % + + atest = true; + if stest + % + % Interval 7 .. 0 -> (end) + x = aa.x; + y = aa.y; + idx = find(x >= 7 & x <= x(end)); + ox = out(1).x + (out(1).t0.utc_epoch_milli/1000 - aa.t0.utc_epoch_milli/1000); + oy = out(1).y; + if ~isequal(ox, x(idx)), atest = false; end + if ~isequal(oy, y(idx)), atest = false; end + % Interval 16 .. -4 -> x(end) - 4 + x = aa.x; + y = aa.y; + idx = find(x >= 16 & x < aa.x(end) - 4); + ox = out(2).x; + oy = out(2).y; + if ~isequal(ox, x(idx)), atest = false; end + if ~isequal(oy, y(idx)), atest = false; end + % Check properties + for ii = 1:2 + if ~isequal(out(ii).data.navs, aa.data.navs), atest = false; end + if ~isequal(out(ii).data.fs, aa.data.fs), atest = false; end + if ~isequal(out(ii).data.enbw, aa.data.enbw), atest = false; end + if ~eq(out(ii).data.xunits, aa.data.xunits), atest = false; end + if ~eq(out(ii).data.yunits, aa.data.yunits), atest = false; end + end + % Check the rebuilding of the object + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_14 + + %% UTP_15 + + % + % + % Check that the split method works with notequal sampled data. + % Check that the interval can be passed via an array of double. + % Check that the split method works with 'timeshift' option. + % + % + function result = utp_15 + + % + % + % Check that the split method works with notequal sampled data. + % Check that the interval can be passed via an array of double. + % Check that the split method works with 'timeshift' option. + % + % + + try + % + a1 = ao(plist('tsfcn', 'randn(size(t))', 'fs', 10, 'nsecs', 1000, 'yunits', 'N')); + in = [1:1019 1020:1999 2001:3000 3002:10000]; + a1.setXY(a1.x(in) + 60, a1.y(in)); + a1.setT0(time('2009-11-03 18:00:00.000')); + + times_v = [120 300]; + pl1 = plist(... + 'times', times_v, ... + 'timeshift', false); + pl2 = plist(... + 'times', times_v, ... + 'timeshift', true); + out1 = split(a1, pl1); + out2 = split(a1, pl2); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the outputs + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + + TOL = 1e-14; + % Check number of seconds + if abs(out1.nsecs - (times_v(2) - times_v(1)))/out1.nsecs > TOL, atest = false; end + if abs(out2.nsecs - (times_v(2) - times_v(1)))/out2.nsecs > TOL, atest = false; end + % Check t0 + if ~isequal(out1.t0, a1.t0), atest = false; end + if ~isequal(out2.t0, a1.t0), atest = false; end + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_15 + + %% UTP_15 + + % + % + % Check that the split method works with time intervals which doesn' + % match the sample frequency. + % + % + function result = utp_16 + + % + % + % Check that the split method works with time intervals which doesn' + % match the sample frequency. + % + % + + try + % + % Construct an AO + a1 = ao(plist('waveform', 'sine', 'f', 0.1, 'a', 1, 'fs', 10, 'nsecs', 10)); + a2 = ao(plist('waveform', 'sine', 'f', 0.1, 'a', 1, 'fs', .1, 'nsecs', 1000)); + + % This should just remove the first data point + out1 = split(a1, plist('times', [0.05 0])); + out2 = split(a2, plist('times', [5 0])); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the outputs + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + if ~(all(out1.y == a1.y(2:end))), atest = false; end + if ~(all(out2.y == a2.y(2:end))), atest = false; end + if ~(all(((out1.x + out1.t0.utc_epoch_milli/1000.0) - (a1.x(2:end) + a1.t0.utc_epoch_milli/1000.0)) < 2*eps(out1.x))), atest = false; end + if ~(all(((out2.x + out2.t0.utc_epoch_milli/1000.0) - (a2.x(2:end) + a2.t0.utc_epoch_milli/1000.0)) < 2*eps(out2.x))), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_15 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_sqrt.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_sqrt.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,127 @@ +% UTP_AO_SQRT a set of UTPs for the ao/sqrt method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_sqrt.m,v 1.13 2011/04/17 11:10:40 hewitson Exp $ +% + +% +% +% The sqrt method of the ao class computes the square root of the y +% and/or x data. +% +% + +function results = utp_ao_sqrt(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'sqrt'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple1)]; % Test the modify call works + results = [results utp_08(mthd, at1, ple2)]; % Test with additional plist with the key 'axis' + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at5, at6, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(sqrt(in.data.getY), out.data.getY) + atest = false; + end + end + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_std.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_std.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,178 @@ +% UTP_AO_STD a set of UTPs for the ao/std method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_std.m,v 1.14 2011/04/17 11:10:54 hewitson Exp $ +% + +% +% +% The std method of the ao class computes the standard deviation of the y +% and/or x data. +% +% + +function results = utp_ao_std(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'std'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Overide to include only data2D objects + atmat = [at1 at5 at2; at2 at1 at6]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple1)]; % Test the modify call works + results = [results utp_108(mthd, at1, ple2)]; % Test with additional plist with the key 'axis' + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at5, at6, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(std(in.data.getY).', out.data.getY) + atest = false; + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = true; + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, '1D')), atest = false; end + if ~any(strcmpi(io(2).sets, '2D')), atest = false; end + if ~any(strcmpi(io(2).sets, '3D')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET '1D' + % Check key + if ~io(3).plists.isparam('axis'), atest = false; end + if ~io(3).plists.isparam('dim'), atest = false; end + if ~io(3).plists.isparam('option'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('axis'), 'y'), atest = false; end + if ~isEmptyDouble(io(3).plists.find('dim')), atest = false; end + if ~isequal(io(3).plists.find('option'), 0), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('axis'), {'y'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('dim'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('option'), {0}), atest = false; end + % SET '2D' + % Check key + if ~io(4).plists.isparam('axis'), atest = false; end + if ~io(4).plists.isparam('dim'), atest = false; end + if ~io(4).plists.isparam('option'), atest = false; end + % Check default value + if ~isequal(io(4).plists.find('axis'), 'y'), atest = false; end + if ~isEmptyDouble(io(4).plists.find('dim')), atest = false; end + if ~isequal(io(4).plists.find('option'), 0), atest = false; end + % Check options + if ~isequal(io(4).plists.getOptionsForParam('axis'), {'x', 'y', 'xy'}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('dim'), {[]}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('option'), {0}), atest = false; end + % SET '3D' + % Check key + if ~io(5).plists.isparam('axis'), atest = false; end + if ~io(5).plists.isparam('dim'), atest = false; end + if ~io(5).plists.isparam('option'), atest = false; end + % Check default value + if ~isequal(io(5).plists.find('axis'), 'z'), atest = false; end + if ~isEmptyDouble(io(5).plists.find('dim')), atest = false; end + if ~isequal(io(5).plists.find('option'), 0), atest = false; end + % Check options + if ~isequal(io(5).plists.getOptionsForParam('axis'), {'x', 'y', 'z', 'xyz'}), atest = false; end + if ~isequal(io(5).plists.getOptionsForParam('dim'), {[]}), atest = false; end + if ~isequal(io(5).plists.getOptionsForParam('option'), {0}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_string.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_string.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,429 @@ +% UTP_AO_STRING a set of UTPs for the ao/string method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_string.m,v 1.2 2009/07/21 15:13:32 ingo Exp $ +% + +% +% +% The string method of the ao class writes a command string that can be +% used to recreate the input object(s). But the object should not have more than +% one history step. +% +% + +function results = utp_ao_string(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'string'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + pl1 = plist('fs', 10, 'nsecs', 30, 'waveform', 'sine wave', 'f', 1.23, 'phi', 30); + at1 = ao(pl1); + at2 = ao(plist('tsfcn', 'randn(size(t))', 'nsecs', 30, 'fs', 10)); + atv = [at1, at2, at1]; + atm = [at1, at2, at1; at1, at2, at1]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Negative test: The object have more than one history step. + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the string method works with a vector of AO objects as input. + % + % + function result = utp_02 + + % + % + % Test that the string method works for a vector of AO objects as input. + % + % + + try + % + out = string(atv); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end; + if ~isa(rout, 'ao'), atest = false; end + if numel(rout) ~= numel(atv), atest = false; end + for kk = 1:numel(atv) + if eq(rout(kk), atv(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the string method works with a matrix of AO objects as input. + % + % + function result = utp_03 + + % + % + % Test that the string method works for a matrix of AO objects as input. + % + % + + try + % + out = string(atm); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'ao'), atest = false; end + if numel(rout) ~= numel(atm), atest = false; end + for kk = 1:numel(atm) + if eq(rout(kk), atm(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the string method works with a list of AO objects as input. + % + % + function result = utp_04 + + % + % + % Test that the string method works for a list of AO objects as input. + % + % + + try + % + out = string(at1,at2); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + atin = [at1, at2]; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'ao'), atest = false; end + if numel(rout) ~= numel(atin), atest = false; end + for kk = 1:numel(atin) + if eq(rout(kk), atin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the string method works with a mix of different shaped AO objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the string method works with an input of matrices and vectors + % and single AO objects. + % + % + + try + % + out = string(at1,atm,at2); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + atin = [at1, reshape(atm, 1, []), at2]; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'ao'), atest = false; end + if numel(rout) ~= numel(atin), atest = false; end + for kk = 1:numel(atin) + if eq(rout(kk), atin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the string method properly applies history. + % + % + function result = utp_06 + + % + % + % The method string doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the string method doesn't work if the AO object have more + % than one history step. + % + % + function result = utp_07 + + % + % + % The method string throws an error because the input object have more than + % one history step. + % + % + + try + % + at3 = ao(); + at3.setName('Second history step'); + out = at3.string(); + % + stest = false; + catch err + stest = true; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_submit.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_submit.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,530 @@ +% UTP_AO_SUBMIT a set of UTPs for the ao/submit method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_submit.m,v 1.15 2010/08/18 09:25:55 ingo Exp $ +% + +% +% +% The bsubmit method of the ao class submits a collection of objects in XML +% form to an LTPDA Repository. The type of the objects are independent. +% +% + +function results = utp_ao_submit(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'submit'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + plForAutoTest = plist('no dialog', true, 'use selector', false); + + connPl = utpGetConnectionPlist(); + rm = LTPDARepositoryManager(); + conn = rm.getConnection(connPl); + try + + experiment_title = 'utp_ao_submit: submit ao'; + experiment_description = 'utp_ao_submit: description'; + analysis_description = ''; + quantity = 'none'; + keywords = 'none'; + reference_ids = ''; + additional_comments = 'none'; + additional_authors = 'no one'; + + plsinfo = plist(... + 'experiment title', experiment_title, ... + 'experiment description', experiment_description, ... + 'analysis description', analysis_description, ... + 'quantity', quantity, ... + 'keywords', keywords, ... + 'reference ids', reference_ids, ... + 'additional comments', additional_comments, ... + 'additional authors', additional_authors); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test output of the data + catch + end + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 16, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('sinfo filename'), atest = false; end + if ~io(3).plists.isparam('binary'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isEmptyChar(io(3).plists.find('sinfo filename')), atest = false; end + if ~isequal(io(3).plists.find('binary'), false), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the submit method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the submit method works for a vector of AOs as input. + % + % + + try + % + [ids, cids] = submit(atvec, connPl, plsinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(atvec), atest = false; end + if numel(robjs2) ~= numel(atvec), atest = false; end + if numel(robjs3) ~= numel(atvec), atest = false; end + % Check the retrieved object against the submitted + if ~eq(atvec, [robjs1{:}]), atest = false; end + if ~eq(atvec, [robjs2{:}]), atest = false; end + if ~eq(atvec, [robjs3{:}]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the submit method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Tests that the submit method works with a matrix of AOs as input. + % + % + + try + % + [ids, cids] = submit(atmat, connPl, plsinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3), ids(4), ids(5), ids(6)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(atmat), atest = false; end + if numel(robjs2) ~= numel(atmat), atest = false; end + if numel(robjs3) ~= numel(atmat), atest = false; end + % Check the retrieved object against the submitted + if ~eq(atmat, reshape([robjs1{:}], size(atmat))), atest = false; end + if ~eq(atmat, reshape([robjs2{:}], size(atmat))), atest = false; end + if ~eq(atmat, reshape([robjs3{:}], size(atmat))), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the submit method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Tests that the submit method works with a list of AOs as input. Use + % for this a mix of different object types. + % + % + + try + % + pl = smodel('a'); + iir = miir(plist('type', 'highpass')); + [ids, cids] = submit(at1, pl, iir, connPl, plsinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 3, atest = false; end + if numel(robjs2) ~= 3, atest = false; end + if numel(robjs3) ~= 3, atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, at1), atest = false; end + if ~eq(robjs1{2}, pl), atest = false; end + if ~eq(robjs1{3}, iir), atest = false; end + % Check robjs2 + if ~eq(robjs2{1}, at1), atest = false; end + if ~eq(robjs2{2}, pl), atest = false; end + if ~eq(robjs2{3}, iir), atest = false; end + % Check robjs3 + if ~eq(robjs3{1}, at1), atest = false; end + if ~eq(robjs3{2}, pl), atest = false; end + if ~eq(robjs3{3}, iir), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the abs method works with a mix of different shaped AO + % objects as input. + % + % + function result = utp_05 + + % + % + % Tests that the submit method works with a list of AOs as input. Use + % for this a mix of different object types. + % + % + + try + % + pl = smodel('a+b'); + iir = miir(plist('type', 'highpass')); + [ids, cids] = submit(pl, atmat, iir, atvec, connPl, plsinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 2 + numel(atmat) + numel(atvec), atest = false; end + if numel(robjs2) ~= 2 + numel(atmat) + numel(atvec), atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, pl), atest = false; end + if ~eq(robjs1{2}, atmat(1)), atest = false; end + if ~eq(robjs1{3}, atmat(2)), atest = false; end + if ~eq(robjs1{4}, atmat(3)), atest = false; end + if ~eq(robjs1{5}, atmat(4)), atest = false; end + if ~eq(robjs1{6}, atmat(5)), atest = false; end + if ~eq(robjs1{7}, atmat(6)), atest = false; end + if ~eq(robjs1{8}, iir), atest = false; end + if ~eq(robjs1{9}, atvec(1)), atest = false; end + if ~eq(robjs1{10}, atvec(2)), atest = false; end + if ~eq(robjs1{11}, atvec(3)), atest = false; end + % Check robjs2 + if ~isequalwithequalnans(robjs1, robjs2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tthe submit method properly applies history. + % + % + function result = utp_06 + + % + % + % Tthe submit method properly applies history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the submit method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [ids, cids] = submit(at1, at2, connPl, plsinfo, plForAutoTest); + + [o1, o2] = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + o3 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the output + if ~eq(o1, at1), atest = false; end + if ~eq(o2, at2), atest = false; end + if ~eq(o3{1}, at1), atest = false; end + if ~eq(o3{2}, at2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_sum.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_sum.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,131 @@ +% UTP_AO_SUM a set of UTPs for the ao/sum method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_sum.m,v 1.15 2011/04/17 11:11:22 hewitson Exp $ +% + +% +% +% The sum method of the ao class computes the sum of the y +% and/or x data. +% +% + +function results = utp_ao_sum(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'sum'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Overide to include only data2D objects + atmat = [at1 at5 at2; at2 at1 at6]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple2)]; % Test the modify call works + results = [results utp_108(mthd, at1, ple2)]; % Test with additional plist with the key 'axis' + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at5, at6, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(sum(in.data.getY).', out.data.getY) + atest = false; + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_sumjoin.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_sumjoin.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,637 @@ +% UTP_AO_SUMJOIN a set of UTPs for the ao/sumjoin method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_sumjoin.m,v 1.7 2011/04/17 15:45:04 ingo Exp $ +% + +% +% +% The sumjoin method of the ao class sums time-series signals togther. +% +% + +function results = utp_ao_sumjoin(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'sumjoin'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the sumjoin method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the sumjoin method works for a vector of AOs as input. + % + % + + try + % + fs = 3; + pl = plist('fs', fs, 'nsecs', 30, 'waveform', 'sine wave', 'f', .1); + a1 = ao(pl); + a2 = ao(pl); + a3 = ao(pl); + a1.setT0('14:00:00'); + a2.setT0('14:00:02'); + a3.setT0('14:00:04'); + avec = [a1, a2, a3]; + out = sumjoin(avec); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one AO + % 2) Check that the output have the correct data. + % 3) Check the rebuilt object + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check that the output is exact one AO + if numel(out) ~= 1, atest = false; end + if ~isa(out, 'ao'), atest = false; end + % Compute reference data. + % Get min/max time + ts = time('14:00:00'); + ts = ts.utc_epoch_milli/1000; + te = time('14:00:04') + 30; + te = te.utc_epoch_milli/1000; + % Compute X and Y + yall = zeros((te - ts)*fs,1); + for kk = 1:numel(avec) + x1 = avec(kk).x(1) + avec(kk).t0.utc_epoch_milli/1000; + xn = avec(kk).x(end) + 1/fs; + post = zeros((te - xn - x1)*fs,1); + pre = zeros((x1 - ts)*fs,1); + y = [pre; avec(kk).y; post]; + yall = yall + y; + end + xall = linspace(0, (te-ts)-1/fs, (te-ts)*fs)'; + % Check output data + if any(abs(out.x - xall) > TOL), atest = false; end + if ~isequal(out.y, yall), atest = false; end + if ~eq(out.t0, time(ts), ple1), atest = false; end + % Check nsecs. Here: 34 sec + if ~isequal(out.data.nsecs, 34), atest = false; end + % Check the re-built object + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the sumjoin method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Tests that the sumjoin method works with a matrix of AOs as input. + % + % + + try + % + fs = .3; + pl = plist('fs', fs, 'nsecs', 300, 'waveform', 'sine wave', 'f', .1); + a1 = ao(pl); + a2 = ao(pl); + a3 = ao(pl); + a4 = ao(pl); + a5 = ao(pl); + a6 = ao(pl); + a1.setT0('14:00:20'); + a2.setT0('14:01:40'); + a3.setT0('14:02:00'); + a4.setT0('14:00:00'); + a5.setT0('14:01:20'); + a6.setT0('14:00:40'); + amat = [a1, a2, a3; a4, a5, a6]; + out = sumjoin(amat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one AO + % 2) Check that the output have the correct data. + % + % + + atest = true; + TOL = 1e-14; + if stest + % + % Check that the output is exact one AO + if numel(out) ~= 1, atest = false; end + if ~isa(out, 'ao'), atest = false; end + % Compute reference data. + % Get min/max time + ts = time('14:00:00'); + ts = ts.utc_epoch_milli/1000; + te = time('14:02:00') + 300; + te = te.utc_epoch_milli/1000; + % Compute X and Y + yall = zeros((te - ts)*fs,1); + for kk = 1:numel(amat) + x1 = amat(kk).x(1) + amat(kk).t0.utc_epoch_milli/1000; + xn = amat(kk).x(end) + 1/fs; + post = zeros((te - xn - x1)*fs,1); + pre = zeros((x1 - ts)*fs,1); + y = [pre; amat(kk).y; post]; + yall = yall + y; + end + xall = linspace(0, (te-ts)-1/fs, (te-ts)*fs)'; + % Check output data + if any(abs(out.x - xall) > TOL), atest = false; end + if ~isequal(out.y, yall), atest = false; end + if ~eq(out.t0, time(ts), ple1), atest = false; end + % Check nsecs. Here: 420 sec + if ~isequal(out.data.nsecs, 420), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the sumjoin method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Tests that the sumjoin method works with a list of AOs as input. + % + % + + try + % + fs = 3; + pl = plist('fs', fs, 'nsecs', 30, 'waveform', 'sine wave', 'f', 10); + a1 = ao(pl); + a2 = ao(pl); + a3 = ao(pl); + a1.setT0('14:00:00'); + a2.setT0('14:00:05'); + a3.setT0('14:00:10'); + out = sumjoin(a1, a2, a3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one AO + % 2) Check that the output have the correct data. + % + % + + atest = true; + TOL = 1e-14; + aoin = [a1, a2, a3]; + if stest + % + % Check that the output is exact one AO + if numel(out) ~= 1, atest = false; end + if ~isa(out, 'ao'), atest = false; end + % Compute reference data. + % Get min/max time + ts = time('14:00:00'); + ts = ts.utc_epoch_milli/1000; + te = time('14:00:10') + 30; + te = te.utc_epoch_milli/1000; + % Compute X and Y + yall = zeros((te - ts)*fs,1); + for kk = 1:numel(aoin) + x1 = aoin(kk).x(1) + aoin(kk).t0.utc_epoch_milli/1000; + xn = aoin(kk).x(end) + 1/fs; + post = zeros((te - xn - x1)*fs,1); + pre = zeros((x1 - ts)*fs,1); + y = [pre; aoin(kk).y; post]; + yall = yall + y; + end + xall = linspace(0, (te-ts)-1/fs, (te-ts)*fs)'; + % Check output data + if any(abs(out.x - xall) > TOL), atest = false; end + if ~isequal(out.y, yall), atest = false; end + if ~eq(out.t0, time(ts), ple1), atest = false; end + % Check nsecs. Here: 40 sec + if ~isequal(out.data.nsecs, 40), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the sumjoin method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Tests that the sumjoin method works with a mix of different shaped AOs as + % input. + % + % + + try + % + fs = .3; + pl = plist('fs', fs, 'nsecs', 300, 'waveform', 'sine wave', 'f', .1); + a1 = ao(pl); + a2 = ao(pl); + a3 = ao(pl); + a4 = ao(pl); + a5 = ao(pl); + a6 = ao(pl); + a1.setT0('14:00:20'); + a2.setT0('14:01:40'); + a3.setT0('14:02:00'); + a4.setT0('14:00:00'); + a5.setT0('14:01:20'); + a6.setT0('14:00:40'); + out = sumjoin(a1, [a2, a3; a4, a5], [a6;a1]); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one AO + % 2) Check that the output have the correct data. + % + % + + atest = true; + TOL = 1e-14; + aoin = [a1, reshape([a2, a3; a4, a5], 1, []), a6, a1]; + if stest + % + % Check that the output is exact one AO + if numel(out) ~= 1, atest = false; end + if ~isa(out, 'ao'), atest = false; end + % Compute reference data. + % Get min/max time + ts = time('14:00:00'); + ts = ts.utc_epoch_milli/1000; + te = time('14:02:00') + 300; + te = te.utc_epoch_milli/1000; + % Compute X and Y + yall = zeros((te - ts)*fs,1); + for kk = 1:numel(aoin) + x1 = aoin(kk).x(1) + aoin(kk).t0.utc_epoch_milli/1000; + xn = aoin(kk).x(end) + 1/fs; + post = zeros((te - xn - x1)*fs,1); + pre = zeros((x1 - ts)*fs,1); + y = [pre; aoin(kk).y; post]; + yall = yall + y; + end + xall = linspace(0, (te-ts)-1/fs, (te-ts)*fs)'; + % Check output data + if any(abs(out.x - xall) > TOL), atest = false; end + if ~isequal(out.y, yall), atest = false; end + if ~eq(out.t0, time(ts), ple1), atest = false; end + % Check nsecs. Here: 420 sec + if ~isequal(out.data.nsecs, 420), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the sumjoin method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the sumjoin method can be processed back. + % + % + + try + % + fs = 3; + pl = plist('fs', fs, 'nsecs', 30, 'waveform', 'sine wave', 'f', 10); + a1 = ao(pl); + a2 = ao(pl); + a1.setT0('14:00:00'); + a2.setT0('14:00:05'); + out = sumjoin(a1, a2); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'sumjoin'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'sumjoin'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the sumjoin method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the sumjoin method can modify the input AO by calling with + % no output and that the method doesn't change the input of the + % function notation (with a equal sign). + % + % + + try + % + fs = 3; + pl = plist('fs', fs, 'nsecs', 30, 'waveform', 'sine wave', 'f', 10); + a1 = ao(pl); + a2 = ao(pl); + a1.setT0('14:00:05'); + a2.setT0('14:00:00'); + amodi = ao(a1); + aeq = ao(a1); + out = aeq.sumjoin(a2); + amodi.sumjoin(a2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'out' and 'aeq' are now different. + % 2) Check that 'aeq' is not changed + % 3) Check that the modified input have the new data + % 4) Check that out and amodi are the same + % + % + + atest = true; + if stest + % + % Check that 'out' and 'aeq' are now different. + if eq(out, aeq, ple2), atest = false; end + % Check that 'aeq' is not changed + if ~eq(aeq, ao(a1), ple2), atest = false; end + % Check that the modified input have the new data + yall = [zeros(5*3,1); a1.y] + [a2.y; zeros(5*3,1)]; + if ~isequal(amodi.y, yall), atest = false; end + % Check that out and amodi are the same + if ~eq(out, amodi, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the sumjoin method keeps the data shape of the input + % object. The input AO must be an AO with row data and an AO with + % column data. + % + % + + try + % + fs = 3; + pl = plist('fs', fs, 'nsecs', 30, 'waveform', 'sine wave', 'f', 10); + a1 = ao(pl); + a2 = ao(pl); + a2 = a2.'; + a1.setT0('14:00:05'); + a2.setT0('14:00:00'); + out1 = sumjoin(a1, a2); + out2 = sumjoin(a2, a1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,1) == 1, atest = false; end + if size(out2.data.y,2) == 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_svd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_svd.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,664 @@ +% UTP_AO_SVD a set of UTPs for the ao/svd method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_svd.m,v 1.10 2011/04/17 11:11:35 hewitson Exp $ +% + +% +% +% The svd method of the ao class computes the singular value decomposition of the y data +% +% + +function results = utp_ao_svd(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'svd'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with additional plist with the key 'axis' + results = [results utp_09]; % Test input data shape == output data shape + results = [results utp_10]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = true; + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, '1D')), atest = false; end + if ~any(strcmpi(io(2).sets, '2D')), atest = false; end + if ~any(strcmpi(io(2).sets, '3D')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET '1D' + % Check key + if ~io(3).plists.isparam('axis'), atest = false; end + if ~io(3).plists.isparam('dim'), atest = false; end + if ~io(3).plists.isparam('option'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('axis'), 'y'), atest = false; end + if ~isEmptyDouble(io(3).plists.find('dim')), atest = false; end + if ~isEmptyChar(io(3).plists.find('option')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('axis'), {'y'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('dim'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('option'), {''}), atest = false; end + % SET '2D' + % Check key + if ~io(4).plists.isparam('axis'), atest = false; end + if ~io(4).plists.isparam('dim'), atest = false; end + if ~io(4).plists.isparam('option'), atest = false; end + % Check default value + if ~isequal(io(4).plists.find('axis'), 'y'), atest = false; end + if ~isEmptyDouble(io(4).plists.find('dim')), atest = false; end + if ~isEmptyChar(io(4).plists.find('option')), atest = false; end + % Check options + if ~isequal(io(4).plists.getOptionsForParam('axis'), {'x', 'y', 'xy'}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('dim'), {[]}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('option'), {''}), atest = false; end + % SET '3D' + % Check key + if ~io(5).plists.isparam('axis'), atest = false; end + if ~io(5).plists.isparam('dim'), atest = false; end + if ~io(5).plists.isparam('option'), atest = false; end + % Check default value + if ~isequal(io(5).plists.find('axis'), 'z'), atest = false; end + if ~isEmptyDouble(io(5).plists.find('dim')), atest = false; end + if ~isEmptyChar(io(5).plists.find('option')), atest = false; end + % Check options + if ~isequal(io(5).plists.getOptionsForParam('axis'), {'x', 'y', 'z', 'xyz'}), atest = false; end + if ~isequal(io(5).plists.getOptionsForParam('dim'), {[]}), atest = false; end + if ~isequal(io(5).plists.getOptionsForParam('option'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the svd method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the svd method works for a vector of AOs as input. + % + % + + try + % + atvec = [at4, at4, at4]; + out = svd(atvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check each output against the singular value decomposition of the input + for kk=1:numel(out) + if ~isequal(svd(atvec(kk).data.getY), out(kk).data.getY) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the svd method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the svd method works for a matrix of AOs as input. + % + % + + try + % + atmat = [at4 at4 at4; at4 at4 at4]; + out = svd(atmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check each output against the singular value decomposition of the input + for kk=1:numel(out) + if ~isequal(svd(atmat(kk).data.getY), out(kk).data.getY) + atest = false; + break; + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the svd method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the svd method works for a list of AOs as input. + % + % + + try + % + out = svd(at4, at4, at4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the singular value decomposition of the input + if ~isequal(svd(at4.data.getY), out(1).data.getY), atest = false; end + if ~isequal(svd(at4.data.getY), out(2).data.getY), atest = false; end + if ~isequal(svd(at4.data.getY), out(3).data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the svd method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the svd method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + atmat = [at4 at4; at4 at4]; + atvec = [at4 at4]; + out = svd(at4,atvec,at4,atmat,at4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(atmat)+numel(atvec)), atest = false; end + % Check the first input + nout = 1; + if ~isequal(svd(at4.data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + % Check the elements of the input vector + for jj=1:numel(atvec) + if ~isequal(svd(atvec(jj).data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + end + % Check the 3rd input + if ~isequal(svd(at4.data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + % Check the elements of the input matrix + for jj=1:numel(atmat) + if ~isequal(svd(atmat(jj).data.getY), out(nout).data.getY), atest = false; end + nout = nout+1; + end + % Check the last input + if ~isequal(svd(at4.data.getY), out(nout).data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the svd method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the svd method can be processed back + % to an m-file. + % + % + + try + % + out = svd(at4); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'svd'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'svd'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the svd method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the svd method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at4 to work with + ain = ao(at4); + % modify ain + aout = ain.svd(); + ain.svd(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at4' and 'ain' are now different. + % 2) Check that 'ain' is svd(at4). + % + % + + atest = true; + if stest + % + % Check that svd modified the input by comparing to the copy + if eq(ao(at4), ain, ple1), atest = false; end + % Check that svd doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the svd value of the copy + if ~isequal(svd(at4.data.getY), ain.data.getY), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the svd method can modify the single axis controlled by the + % plist and the resuld can be processed back to an m-file. + % + % + + try + % + op1 = 0; + op2 = 'econ'; + pl0 = plist('option', op1); + pl1 = plist('option', op2); + out1 = svd(at4, pl0); + out2 = svd(at4, pl1); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the svd method applies with different options. + % 2) Check that the re-built objects are the same object as 'out[1..2]'. + % + % + + atest = true; + if stest + % + % Check each output against the singular value decomposition of the input + if ~isequal(svd(at4.data.getY, op1), out1.data.getY), atest = false; end + if ~isequal(svd(at4.data.getY, op2), out2.data.getY), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Control the method with a plist. + % + % + function result = utp_09 + + % + % + % Test that the svd method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = svd(at4); + out2 = svd(at4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y) ~= size(svd(at4.data.y)), atest = false; end + if size(out2.data.y) ~= size(svd(at4.data.y)), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the svd method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_10 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + at4_10 = at4+10; + [o1, o2] = svd(at4, at4_10); + o3 = svd(at4, at4_10); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_t0.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_t0.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,377 @@ +% UTP_AO_T0 a set of UTPs for the ao/t0 method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_t0.m,v 1.3 2011/03/23 10:25:20 mauro Exp $ +% + +% +% +% The t0 method of the ao class is a get-function to get the t0 value +% of the data object +% +% + +function results = utp_ao_t0(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 't0'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test with all data objects + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the t0 method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % The t0 method doesn't work with a vector of AOs. Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the t0 method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % The t0 method doesn't work with a matrix of AOs. Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the t0 method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % The t0 method doesn't work with a list of AOs. Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the t0 method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % The t0 method can only return the t0 value of one AO. Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the t0 method properly applies history. + % + % + function result = utp_06 + + % + % + % The t0 method doesn't change the AO, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the t0 method works for AOs with different data objects. + % + % + function result = utp_07 + + % + % + % Test that the t0 method returns the t0 value for AOs with cdata, + % fsdata, tsdata and xydata objects. + % + % + + try + % + t01 = at1.t0; + t02 = at2.t0; + t03 = at3.t0; + t04 = at4.t0; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if ~eq(t01, at1.data.t0), atest = false; end; + if ~eq(t02, at2.data.t0), atest = false; end; + if ~isequalwithequalnans(t03, time(NaN)), atest = false; end; + if ~isequalwithequalnans(t04, time(NaN)), atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_tan.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_tan.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,127 @@ +% UTP_AO_TAN a set of UTPs for the ao/tan method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_tan.m,v 1.12 2011/04/17 11:11:50 hewitson Exp $ +% + +% +% +% The tan method of the ao class computes the tangent of the y +% and/or x data. +% +% + +function results = utp_ao_tan(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'tan'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple2)]; % Test the modify call works + results = [results utp_08(mthd, at1, ple2)]; % Test with additional plist with the key 'axis' + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at5, at6, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(tan(in.data.getY), out.data.getY) + atest = false; + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_tfe.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_tfe.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,1290 @@ +% UTP_AO_TFE a set of UTPs for the ao/tfe method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_tfe.m,v 1.35 2011/07/22 12:29:58 mauro Exp $ +% + +% +% +% The tfe method of the ao class computes the transfer function between two +% time-series AOs. +% +% + +function results = utp_ao_tfe(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'tfe'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Get default window from the preferences + prefs = getappdata(0, 'LTPDApreferences'); + defaultWinType = char(prefs.getMiscPrefs.getDefaultWindow); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input (only with two objects) + results = [results utp_03]; % Matrix input (not possible) + results = [results utp_04]; % List input (only with two objects) + results = [results utp_05]; % Test with mixed input (not possible) + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test the basic usage against MATLAB's tfestimate + + results = [results utp_11(mthd, [at1 at1], ple1)]; % Test plotinfo doesn't disappear + + results = [results utp_12]; % Test data lengths + results = [results utp_17]; % Test units handling: tfe + results = [results utp_21]; % Test number of averages: requested/obtained + results = [results utp_22]; % Test number of averages: correct number + results = [results utp_23]; % Test number of averages: syntax + results = [results utp_25]; % Test Kaiser win and olap: tfe + results = [results utp_30]; % Special cases: same input + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 8, atest = false; end + % Check key + if ~io(3).plists.isparam('nfft'), atest = false; end + if ~io(3).plists.isparam('win'), atest = false; end + if ~io(3).plists.isparam('olap'), atest = false; end + if ~io(3).plists.isparam('order'), atest = false; end + if ~io(3).plists.isparam('navs'), atest = false; end + if ~io(3).plists.isparam('times'), atest = false; end + if ~io(3).plists.isparam('split'), atest = false; end + if ~io(3).plists.isparam('psll'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('nfft'), -1), atest = false; end + if ~strcmpi(io(3).plists.find('win'), defaultWinType), atest = false; end + if ~isequal(io(3).plists.find('olap'), -1), atest = false; end + if ~isequal(io(3).plists.find('order'), 0), atest = false; end + if ~isequal(io(3).plists.find('navs'), -1), atest = false; end + if ~isEmptyDouble(io(3).plists.find('times')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('split')), atest = false; end + if ~isequal(io(3).plists.find('psll'), 200), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('nfft'), {-1}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('win'), specwin.getTypes), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('olap'), {-1}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('order'), {-1 0 1 2 3 4 5 6 7 8 9}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('navs'), {-1}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('times'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('split'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('psll'), {200}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the tfe method works with a vector of AOs as input. (only + % with two objects in the vector) + % + % + function result = utp_02 + + % + % + % Test that the tfe method works for a vector of AOs as input. + % + % + + try + % + avec = [at1 at5]; + out = tfe(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is equal to 1. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Test that the tfe method doesn't work for a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the tfe method doesn't work for a matrix of AOs as input. + % + % + + try + % + amat = [at1 at5 at6; at5 at6 at1]; + out = tfe(amat); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the tfe method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the tfe method works for a list of AOs as input. + % + % + + try + % + out = tfe(at1,at5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is equal to 1. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the tfe method doesn't work with a mix of different shaped + % AOs as input. + % + % + function result = utp_05 + + % + % + % Test that the tfe method doesn't work with an input of matrices and + % vectors and single AOs. + % + % + + try + % + out = tfe(at1,[at5 at6],at5,[at5 at1; at6 at1],at6); + stest = false; + % + catch err + stest = true; + end + + % + % + % 1) Nothing to check + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the tfe method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the tfe method can be processed back + % to an m-file. + % + % + + try + % + out = tfe(at5,at6); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'tfe'. + % 2) Check that the re-built object is the same as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'tfe'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the tfe method can not modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the tfe method can not modify the input AO. + % The method must throw an error for the modifier call. + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + ain.tfe(at5); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the tfe method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = tfe(at5, at6); + out2 = tfe(at6, at5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the output data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y, 2) ~= 1, atest = false; end + if size(out2.data.y, 1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the tfe method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % This test is not longer necessary because the tfe method pass back + % always only one object. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Tests that the tfe method agrees with MATLAB's tfestimate when + % configured to use the same parameters. + % + % + function result = utp_10 + + % + % + % Test that applying tfe works on two AOs. + % + % + + try + % + % Construct two test AOs + nsecs = 10; + fs = 1000; + pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'randn(size(t))'); + a1 = ao(pl); a2 = ao(pl); + % Filter one time-series + f2 = miir(plist('type', 'bandpass', 'fs', fs, 'order', 3, 'fc', [50 250])); + a1f = filter(a1, plist('filter', f2)); + % make some cross-power + a4 = a1f+a2; a4.setName; + % Compute transfer function + Nfft = 2*fs; + win = specwin('Hanning', Nfft); + pl = plist('Nfft', Nfft, 'Win', win.type, 'order', -1); + out = tfe(a4,a1,pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that output agrees with the output of MATLAB's tfestimate. + % + % + + atest = true; + if stest + % + % Compute transfer function using MATLAB's tfestimate + [cxy, f] = tfestimate(a4.y, a1.y, win.win, Nfft/2, Nfft, a1.fs); + if ne(cxy, out.y), atest = false; end + if ne(f, out.x), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_12 + + % + % + % Tests that differently sized data sets are treated properly + % + % + function result = utp_12 + + % + % + % Test that applying tfe works on two AOs. + % + % + + try + % + % Construct two test AOs + nsecs = [10000:1:20000]; + fs = 1; + pl = plist('fs', fs, 'tsfcn', 'randn(size(t))'); + a1 = ao(pl.pset('nsecs', utils.math.randelement(nsecs, 1))); + a2 = ao(pl.pset('nsecs', utils.math.randelement(nsecs, 1))); + len_1 = a1.len; + len_2 = a2.len; + % Filter one time-series + f2 = miir(plist('type', 'bandpass', 'fs', fs, 'order', 3, 'fc', [.050 .25])); + a1f = filter(a1, plist('filter', f2)); + % Compute tfe + Nfft = -1; + win = 'Hanning'; + pl = plist('Nfft', Nfft, 'Win', win, 'order', -1); + out = tfe(a2,a1f,pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that tfe used the length of the shortest ao. + % + % + + atest = true; + if stest + % + % Compare the nfft with the length of the input data + + if out.x(2) ~= 1/min(len_1,len_2) + atest = false; + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_17 + + % + % + % Tests handling of units: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) tfe of the white noise series + % 4) compares the units of the input and output + % + + % + function result = utp_17 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) tfe of the white noise + % + % + + % + try + + % Build time-series test data + fs = 1; + nsecs = 86400; + sigma_distr_1 = 4.69e-12; + mu_distr_1 = -5.11e-14; + sigma_distr_2 = 6.04e-9; + mu_distr_2 = 1.5e-10; + + % White noise + type = 'Normal'; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_1)); + a_const = ao(mu_distr_1); + a_1 = a_n + a_const; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_2)); + a_const = ao(mu_distr_2); + a_2 = a_n + a_const; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the tfe of the time-series data + win = specwin('BH92'); + olap = win.rov; + detrend = 0; + n_pts = nsecs*fs/10; + + T = tfe(a_1,a_2,plist('Win', win.type, 'olap', olap, 'Nfft', n_pts, 'order', detrend)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (calculated tfe yunits) equals [1/Hz] + + % + + % + atest = true; + + if stest + if ne(T.yunits, a_2.yunits ./ a_1.yunits) || ne(T.xunits, unit('Hz')) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_17 + + + %% UTP_21 + + % + % + % Tests the possibility to set the number of averages rather than setting the Nfft: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) tfe of the 2 series, without detrending, random window, set number of + % averages + % 3) check the effective number of averages + % + + % + function result = utp_21 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) tfe of the 2 series, without detrending, random window, set number of + % averages + % + % + + % + try + % Array of parameters to pick from + fs_list = [0.1;1;2;5;10]; + nsecs_list = [2000:1000:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + trend_0_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + trend_0 = utils.math.randelement(trend_0_list, 1); + + % White noise + type = 'Normal'; + a_n1 = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_n2 = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + + % Constant signal + a_c = ao(trend_0); + + % Total signals + a1 = a_n1 + a_c; + a2 = a_n2 + a_c; + + % Evaluate the tfe of the white noise time-series data + win_list = specwin.getTypes; + win_type = utils.math.randelement(win_list(~strcmpi(win_list, 'levelledhanning')), 1); + win_type = win_type{1}; + switch win_type + case 'Kaiser' + win = specwin(win_type, 1, find(ao.getInfo('tfe').plists, 'psll')); + otherwise + win = specwin(win_type, 1); + end + + olap = win.rov; + detrend = 0; + n_pts = -1; + navs = utils.math.randelement([1:100],1); + + % Evaluates the tfe asking for the number of averages + T = tfe(a1, a2, plist('Win', win.type, 'olap', olap, ... + 'Nfft', n_pts, 'order', detrend, 'navs', navs)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated navs are identical to those requested + % + % + + % + atest = true; + + if stest + % Compare the navs written in the output object with the requested one + if ne(navs, T.data.navs) + if ne(find(T.hist.plistUsed, 'navs'), T.data.navs) + atest = false; + end + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_21 + + %% UTP_22 + + % + % + % Tests the possibility to set the number of averages rather than setting the Nfft: + % 1) white noise produced from uniform pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) tfe of the time series, without detrending, random window, random navs + % 3) get the number of averages + % 4) get the nfft used + % 5) run tfe again, with the nfft used + % 6) compare the calculated objects + % + + % + function result = utp_22 + + % + % + % 1) white noise produced from uniform pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) tfe of the time series, without detrending, random window, random navs + % 3) get the number of averages + % 4) get the nfft used + % 5) run tfe again, with the nfft used + % + % + + % + try + % Array of parameters to pick from + fs_list = [0.1;1;2;5;10]; + nsecs_list = [20 100 1000:1000:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + trend_0_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + trend_0 = utils.math.randelement(trend_0_list, 1); + + % White noise + type = 'Uniform'; + a_n1 = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_n2 = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + + % Constant signal + a_c = ao(trend_0); + + % Total signals + a1 = a_n1 + a_c; + a2 = a_n2 + a_c; + + % Evaluate the tfe of the white noise time-series data + win_list = specwin.getTypes; + win_type = utils.math.randelement(win_list(~strcmpi(win_list, 'levelledhanning')), 1); + win_type = win_type{1}; + switch win_type + case 'Kaiser' + win = specwin(win_type, 1, find(ao.getInfo('psd').plists, 'psll')); + otherwise + win = specwin(win_type, 1); + end + + olap = win.rov; + detrend = 0; + navs = fix(utils.math.randelement(logspace(0,log10(max(0,a1.len/10)),50),1)); + + % Calculates the tfe asking for the number of averages + T1 = tfe(a1, a2, plist('Win', win.type, 'olap', olap, ... + 'Nfft', -1, 'order', detrend, 'navs', navs)); + + % Calculates the tfe asking for the number of points just evaluated + T2 = tfe(a1, a2, plist('Win', win.type, 'olap', olap, ... + 'Nfft', find(T1.hist.plistUsed, 'Nfft'), 'order', detrend)); + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated objects T1 and T2 are identical + % + % + + % + atest = true; + + if stest + % Compare the output objects + if ne(T1,T2,ple3) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_22 + + %% UTP_23 + + % + % + % Tests the possibility to set the number of averages rather than setting the Nfft: + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) tfe of the time series, without detrending, random window, random navs + % 3) get the number of averages + % 4) get the nfft used + % 5) run tfe again, with the nfft used + % 6) compare navs, nfft, tfes + % + + % + function result = utp_23 + + % + % + % 1) white noise produced from normal pdf, with: + % a given mean value and sigma (distribution's 1st and 2nd order) + % 2) tfe of the time series, without detrending, random window, random navs + % 3) get the number of averages + % 4) get the nfft used + % 5) run tfe again, with the nfft used + % 6) run tfe again, with conflicting parameters, and verify it uses + % nfft rather than navs + % + % + + % + try + % Array of parameters to pick from + fs_list = [0.1;1;2;5;10]; + nsecs_list = [1000:1000:10000]'; + sigma_distr_list = [1e-6 2e-3 0.25 1:0.1:10]'; + trend_0_list = [1e-6 2e-3 0.25 1:0.1:10]'; + + % Build time-series test data + + % Picks the values at random from the list + fs = utils.math.randelement(fs_list, 1); + nsecs = utils.math.randelement(nsecs_list, 1); + sigma_distr = utils.math.randelement(sigma_distr_list, 1); + trend_0 = utils.math.randelement(trend_0_list, 1); + + % White noise + type = 'Normal'; + a_n1 = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + a_n2 = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr)); + + % Constant signal + a_c = ao(trend_0); + + % Total signals + a1 = a_n1 + a_c; + a2 = a_n2 + a_c; + + % Evaluate the tfe of the white noise time-series data + win_list = specwin.getTypes; + win_type = utils.math.randelement(win_list(~strcmpi(win_list, 'levelledhanning')), 1); + win_type = win_type{1}; + switch win_type + case 'Kaiser' + win = specwin(win_type, 1, find(ao.getInfo('psd').plists, 'psll')); + otherwise + win = specwin(win_type, 1); + end + + olap = win.rov; + detrend = 0; + navs = fix(utils.math.randelement(logspace(0,log10(max(a1.len/10,0)),50),1)); + + % Calculates the tfe from a1 to a2 asking for the number of averages + T1 = tfe(a1, a2, plist('Win', win.type, 'olap', olap, ... + 'Nfft', -1, 'order', detrend, 'navs', navs)); + + npts_2 = find(T1.hist.plistUsed, 'Nfft'); + % Calculates the tfe from a1 to a2 asking for the number of points + T2 = tfe(a1, a2, plist('Win', win.type, 'olap', olap, ... + 'Nfft', npts_2, 'order', detrend)); + + npts_3 = fix(npts_2/2); + % Calculates the tfe from a1 to a2 asking for the number of points AND the window length + T3 = tfe(a1, a2, plist('Win', win.type, 'olap', olap, ... + 'Nfft', npts_3, ... + 'order', detrend, 'navs', navs)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated objects T1 and T2 are identical + % 2) Check that T3 used different values + % + % + + % + atest = true; + + if stest + % Compare the navs written in the output object with the requested one + if ne(T1,T2,ple3) || ... + ne(find(T3.hist.plistUsed, 'Nfft'), npts_3) || eq(T3.data.navs, navs) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_23 + + %% UTP_25 + + % + % + % Tests handling of units: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 3) tfe of the white noise series + % 4) compares the units of the input and output + % + + % + function result = utp_25 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % white noise from normal distribution + offset + % 4) Assign a random unit + % 5) tfe of the white noise + % + % + + % + try + + % Build time-series test data + fs = 1; + nsecs = 86400; + sigma_distr_1 = 4.69e-12; + mu_distr_1 = -5.11e-14; + sigma_distr_2 = 6.04e-9; + mu_distr_2 = 1.5e-10; + + % White noise + type = 'Normal'; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_1)); + a_const = ao(mu_distr_1); + a_1 = a_n + a_const; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_2)); + a_const = ao(mu_distr_2); + a_2 = a_n + a_const; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + a_2.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Evaluate the tfe of the time-series data + win = 'Kaiser'; + detrend = 0; + n_pts = nsecs*fs/10; + + T = tfe(a_1,a_2,plist('Win', win,'Nfft', n_pts, 'order', detrend)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that (calculated tfe yunits) equals [1/Hz] + + % + + % + atest = true; + + if stest + if ne(T.yunits, a_2.yunits ./ a_1.yunits) || ne(T.xunits, unit('Hz')) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_25 + + %% UTP_30 + + % + % + % Tests handling of special cases: + % 1) white noise produced from normal pdf, with a given mean value and + % sigma (distribution's 1st and 2nd orders) + % 2) the same noise series + % 3) tfe of the white noise series + % 4) compares the output to unity + % + + % + function result = utp_30 + + % + % + % 1) Prepare the test tsdata: + % white noise from normal distribution + offset + % 2) Assign a random unit + % 3) Prepare the test tsdata: + % the same data as 1) and 2) + % 4) tfe of the series + % + % + + % + try + + % Build time-series test data + fs = 1; + nsecs = 86400; + sigma_distr_1 = 4.69e-12; + mu_distr_1 = -5.11e-14; + + % White noise + type = 'Normal'; + + a_n = ao(plist('waveform', 'noise', ... + 'type', type, 'fs', fs, 'nsecs', nsecs, 'sigma', sigma_distr_1)); + a_const = ao(mu_distr_1); + a_1 = a_n + a_const; + + % Set units and prefix from those supported + unit_list = unit.supportedUnits; + % remove the first empty unit '' from the list, because then is it + % possible that we add a prefix to an empty unit + unit_list = unit_list(2:end); + prefix_list = unit.supportedPrefixes; + a_1.setYunits(unit([cell2mat(utils.math.randelement(prefix_list,1)) cell2mat(utils.math.randelement(unit_list,1))])); + + % Build the second object as a copy of the first + a_2 = a_1; + + % Evaluate the tfe of the time-series data + win = specwin('BH92'); + olap = win.rov; + detrend = 0; + n_pts = nsecs*fs/10; + + T = tfe(a_1,a_2,plist('Win', win.type, 'olap', olap, 'Nfft', n_pts, 'order', detrend)); + + stest = true; + + catch err + disp(err.message) + stest = false; + end + % + + % + % + % 1) Check that calculated tfe equals 1 + + % + + % + atest = true; + + if stest + if sum(ne(T.y, 1)) + atest = false; + end + else + atest = false; + end + % + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_30 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_times.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_times.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,125 @@ +% UTP_AO_TIMES a set of UTPs for the ao/times method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_times.m,v 1.7 2010/09/21 17:00:41 ingo Exp $ +% + +% +% +% The times method of the ao class computes the subtraction of the y +% data of two inputs. +% +% + +function results = utp_ao_times(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'times'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_generic_aop_rule1(@times)]; % Rule 1 + results = [results utp_generic_aop_rule2(@times)]; % Rule 2 + results = [results utp_generic_aop_rule3(@times)]; % Rule 3 + results = [results utp_generic_aop_rule4(@times)]; % Rule 4 + results = [results utp_generic_aop_rule5(@times)]; % Rule 5 + results = [results utp_generic_aop_rule6(@times)]; % Rule 6 + results = [results utp_generic_aop_rule7(@times)]; % Rule 7 + results = [results utp_generic_aop_rule8(@times)]; % Rule 8 + results = [results utp_generic_aop_rule9(@times)]; % Rule 9 + results = [results utp_generic_aop_rule10(@times)]; % Rule 10 + results = [results utp_generic_aop_rule11(@times)]; % Rule 11 + results = [results utp_generic_aop_negative_tests(@times)]; % Negative tests + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_timeshift.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_timeshift.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,533 @@ +% UTP_AO_TIMESHIFT a set of UTPs for the ao/timeshift method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_timeshift.m,v 1.11 2011/09/29 12:15:14 ingo Exp $ +% + +% +% +% The timeshift method of the ao class timeshifts time-series AOs. +% +% + +function results = utp_ao_timeshift(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'timeshift'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('offset'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('offset'), 0), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('offset'), {0}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the timeshift method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the timeshift method works for a vector of AOs as input. + % + % + + try + % + avec = [at1 at5 at6]; + out = timeshift(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the timeshift method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the timeshift method works for a matrix of AOs as input. + % + % + + try + % + amat = [at1 at5 at6; at5 at6 at1]; + out = timeshift(amat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the timeshift method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the timeshift method works for a list of AOs as input. + % + % + + try + % + out = timeshift(at1,at5,at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the timeshift method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the timeshift method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = timeshift(at1,[at5 at6],at5,[at5 at1; at6 at1],at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the timeshift method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the timeshift method can be processed back + % to an m-file. + % + % + + try + % + out = timeshift(at5); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'timeshift'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'timeshift'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the timeshift method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the timeshift method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = ain.timeshift(); + ain.timeshift(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is timeshift(at1). + % 3) Check the algorithm + % + % + + atest = true; + if stest + % + % Check that timeshift modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that timeshift doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the timeshift method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = timeshift(at5); + out2 = timeshift(at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y) ~= size(at5.data.y), atest = false; end + if size(out2.data.y) ~= size(at6.data.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the timeshift method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = timeshift(at5, at6); + o3 = timeshift(at5, at6); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_transpose.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_transpose.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,588 @@ +% UTP_AO_TRANSPOSE a set of UTPs for the ao/transpose method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_transpose.m,v 1.9 2011/04/17 15:45:09 ingo Exp $ +% + +% +% +% The transpose method of the ao class computes the transpose value of the y +% and/or x data. +% +% + +function results = utp_ao_transpose(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'transpose'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_09]; % Test input data shape == output data shape + + results = [results utp_10(mthd, at1, at2, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(transpose(in.data.y), out.data.y), atest = false; end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('complex'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('complex'), false), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('complex'), {false, true}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +% %% UTP_02 +% +% % +% % +% % Tests that the transpose method works with a vector of AOs as input. +% % +% % +% function result = utp_02 +% +% % +% % +% % Test that the transpose method works for a vector of AOs as input. +% % +% % +% +% try +% % +% out1 = transpose(atvec); +% out2 = atvec.'; +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the number of elements in 'out1' is the same as in 'atvec' +% % 2) Check that each output AO contains the correct data. +% % 3) Check that out1 and out2 are the same +% % +% % +% +% atest = true; +% if stest +% % +% % Check we have the correct number of outputs +% if ~isequal(size(out1), size(atvec)), atest = false; end +% % Check each output against the transpose of the input +% for kk=1:numel(out1) +% if ~isequal(transpose(atvec(kk).data.y), out1(kk).data.y), atest = false; end +% if ~isequal(transpose(atvec(kk).data.x), out1(kk).data.x), atest = false; end +% end +% % Check that out1 and out2 are the same +% if ~eq(out1, out2, ple1), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_02 +% +% %% UTP_03 +% +% % +% % +% % Tests that the transpose method works with a matrix of AOs as input. +% % +% % +% function result = utp_03 +% +% % +% % +% % Test that the transpose method works for a matrix of AOs as input. +% % +% % +% +% try +% % +% out1 = transpose(atmat); +% out2 = atmat.'; +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the number of elements in 'out1' is the same as in 'atmat' +% % 2) Check that each output AO contains the correct data. +% % 3) Check that out1 and out2 are the same +% % +% % +% +% atest = true; +% if stest +% % +% % Check we have the correct number of outputs +% if ~isequal(size(out1), size(atmat)), atest = false; end +% % Check each output against the transpose of the input +% for kk=1:numel(out1) +% if ~isequal(transpose(atmat(kk).data.y), out1(kk).data.y), atest = false; end +% if ~isa(atmat(kk).data, 'cdata') +% if ~isequal(transpose(atmat(kk).data.x), out1(kk).data.x), atest = false; end +% end +% end +% % Check that out1 and out2 are the same +% if ~eq(out1, out2, ple1), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_03 +% +% %% UTP_04 +% +% % +% % +% % Tests that the transpose method works with a list of AOs as input. +% % +% % +% function result = utp_04 +% +% % +% % +% % Test that the transpose method works for a list of AOs as input. +% % +% % +% +% try +% % +% out = transpose(at1,at2,at3); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the number of elements in 'out' is the same as in +% % input. +% % 2) Check that each output AO contains the correct data. +% % +% % +% +% atest = true; +% if stest +% % +% % Check we have the correct number of outputs +% if numel(out) ~= 3, atest = false; end +% % Check each output against the transpose of the input +% if ~isequal(transpose(at1.data.y), out(1).data.y), atest = false; end +% if ~isequal(transpose(at2.data.y), out(2).data.y), atest = false; end +% if ~isequal(transpose(at3.data.y), out(3).data.y), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_04 +% +% %% UTP_05 +% +% % +% % +% % Tests that the transpose method works with a mix of different shaped AOs as +% % input. +% % +% % +% function result = utp_05 +% +% % +% % +% % Test that the transpose method works with an input of matrices and vectors +% % and single AOs. +% % +% % +% +% try +% % +% out = transpose(at1,atvec,at2,atmat,at3); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the number of elements in 'out' is the same as in +% % input. +% % 2) Check that each output AO contains the correct data. +% % +% % +% +% atest = true; +% if stest +% % +% % Check we have the correct number of outputs +% if numel(out) ~= (3+numel(atmat)+numel(atvec)), atest = false; end +% % Check the first input +% nout = 1; +% if ~isequal(transpose(at1.data.y), out(nout).data.y), atest = false; end +% nout = nout+1; +% % Check the elements of the input vector +% for jj=1:numel(atvec) +% if ~isequal(transpose(atvec(jj).data.y), out(nout).data.y), atest = false; end +% nout = nout+1; +% end +% % Check the 3rd input +% if ~isequal(transpose(at2.data.y), out(nout).data.y), atest = false; end +% nout = nout+1; +% % Check the elements of the input matrix +% for jj=1:numel(atmat) +% if ~isequal(transpose(atmat(jj).data.y), out(nout).data.y), atest = false; end +% nout = nout+1; +% end +% % Check the last input +% if ~isequal(transpose(at3.data.y), out(nout).data.y), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_05 +% +% %% UTP_06 +% +% % +% % +% % Tests that the transpose method properly applies history. +% % +% % +% function result = utp_06 +% +% % +% % +% % Test that the result of applying the transpose method can be processed back +% % to an m-file. +% % +% % +% +% try +% % +% out = transpose(at1); +% mout = rebuild(out); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the last entry in the history of 'out' corresponds to +% % 'transpose'. +% % 2) Check that the re-built object is the same object as 'out'. +% % +% % +% +% atest = true; +% if stest +% % +% % Check the last step in the history of 'out' +% if ~strcmp(out.hist.methodInfo.mname, 'transpose'), atest = false; end +% % Check the re-built object +% if ~eq(mout, out, ple1), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the transpose method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the transpose method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = ain.transpose(); + ain.transpose(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is transpose(at1). + % + % + + atest = true; + if stest + % + % Check that transpose modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that transpose doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified input is the transpose value of the copy + if ~isequal(transpose(at1.data.y), ain.data.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the transpose method can modify the single axis controlled by the + % plist and the resuld can be processed back to an m-file. + % + % + + try + % + plx = plist('axis', 'X'); + ply = plist('axis', 'Y'); + plxy = plist('axis', 'XY'); + out1 = transpose(at1, plx); + out2 = transpose(at1, ply); + out3 = transpose(at1, plxy); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the transpose method applies to both axes + % 2) Check that the transpose method applies to both axes + % 3) Check that the transpose method applies to both axes + % 4) Check that the re-built objects are the same object as 'out[1..3]'. + % + % + + atest = true; + if stest + % + % Check each output against the transpose value of the input + if ~isequal(at1.data.y.', out1.data.y), atest = false; end + if ~isequal(at1.data.y.', out2.data.y), atest = false; end + if ~isequal(at1.data.y.', out3.data.y), atest = false; end + % Check the re-built object + if ~eq(mout1, out1, ple1), atest = false; end + if ~eq(mout2, out2, ple1), atest = false; end + if ~eq(mout3, out3, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Control the method with a plist. + % + % + function result = utp_09 + + % + % + % Test that the abs method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = abs(at5); + out2 = abs(at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.x) ~= size(at5.data.x), atest = false; end + if size(out1.data.y) ~= size(at5.data.y), atest = false; end + if size(out2.data.x) ~= size(at6.data.x), atest = false; end + if size(out2.data.y) ~= size(at6.data.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_type.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_type.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,395 @@ +% UTP_AO_TYPE a set of UTPs for the ao/type method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_type.m,v 1.2 2009/07/21 15:13:32 ingo Exp $ +% + +% +% +% The type method of the ao class converts the input objects to +% MATLAB functions that reproduce the processing steps that led to the +% input objects. +% +% + +function results = utp_ao_type(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'type'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AO objects + [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % DEfine the filename + filename = 'test_ao_type.m'; + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('filename'), atest = false; end + if ~io(3).plists.isparam('stop_option'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('filename')), atest = false; end + if ~isequal(io(3).plists.find('stop_option'), 'full'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('filename'), {''}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('stop_option'), {'full', 'File', 'Repo', 'File Repo', 'N'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the type method works with a vector of AO objects as input. + % + % + function result = utp_02 + + % + % + % Test that the type method works for a vector of AO objects as input. + % + % + + try + % + type(atvec, filename); + type(atvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + if ~eq(atvec, mout, ple2), atest = false; end; + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the type method works with a matrix of AO objects as input. + % + % + function result = utp_03 + + % + % + % Test that the type method works for a matrix of AO objects as input. + % + % + + try + % + type(atmat, filename); + type(atmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + % Type doesn't keep the shape + for ii = 1:numel(atmat) + if ~eq(atmat(ii), mout(ii), ple2), atest = false; end; + end + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the type method works with a list of AO objects as input. + % + % + function result = utp_04 + + % + % + % Test that the type method works for a list of AO objects as input. + % + % + + try + % + type(at5,at4,at3, filename); + type(at5,at4,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + atin = [at5,at4,at3]; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + % Type doesn't keep the shape + for ii = 1:numel(atin) + if ~eq(atin(ii), mout(ii), ple2), atest = false; end; + end + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the type method works with a mix of different shaped AO objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the type method works with an input of matrices and vectors + % and single AO objects. + % + % + + try + % + type(at4,atvec,at2,atmat,at1, filename); + type(at4,atvec,at2,atmat,at1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + atin = [at4,reshape(atvec,1,[]),at2,reshape(atmat,1,[]),at1]; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + % Type doesn't keep the shape + for ii = 1:numel(atin) + if ~eq(atin(ii), mout(ii), ple2), atest = false; end; + end + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the type method properly applies history. + % + % + function result = utp_06 + + % + % + % The method type doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_uminus.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_uminus.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,128 @@ +% UTP_AO_UMINUS a set of UTPs for the ao/uminus method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_uminus.m,v 1.10 2011/04/17 09:31:41 hewitson Exp $ +% + +% +% +% The uminus method of the ao class computes the unary minus of the y +% and/or x data. +% +% + +function results = utp_ao_uminus(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'uminus'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple2)]; % Test the modify call works + results = [results utp_08(mthd, at1, ple2)]; % Test with additional plist with the key 'axis' + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at5, at6, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(-(in.data.getY), out.data.getY) + atest = false; + end + end + + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_unwrap.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_unwrap.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,635 @@ +% UTP_AO_UNWRAP a set of UTPs for the ao/unwrap method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_unwrap.m,v 1.8 2011/04/17 11:12:03 hewitson Exp $ +% + +% +% +% The unwrap method of the ao class unwraps radian phases P by changing +% absolute jumps greater than or equal to pi to their 2*pi complement. +% +% + +function results = utp_ao_unwrap(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'unwrap'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Create an test AO with a phase jump + w = [0:.2:3,3.5:1:10]; + p = [ 0 + -1.5728 + -1.5747 + -1.5772 + -1.5790 + -1.5816 + -1.5852 + -1.5877 + -1.5922 + -1.5976 + -1.6044 + -1.6129 + -1.6269 + -1.6512 + -1.6998 + -1.8621 + 1.7252 + 1.6124 + 1.5930 + 1.5916 + 1.5708 + 1.5708 + 1.5708 ]; + a1 = ao(w,p, plist('type', 'tsdata')); + a2 = ao(w,p, plist('type', 'fsdata')); + a3 = ao(w,p, plist('type', 'xydata')); + a4 = ao(p); + avec = [a1, a2, a3]; + amat = [a1, a2, a3; a4, a3, a1]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with additional plist with the key 'axis' + results = [results utp_09]; % Test input data shape == output data shape + results = [results utp_10]; % Test output of the data + results = [results utp_11(mthd, a1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the unwrap method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the unwrap method works for a vector of AOs as input. + % + % + + try + % + out = unwrap(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'avec' + % 2) Check that each ouput corrects the phase angles + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(avec)), atest = false; end + % Check that each ouput corrects the phase angles + for kk=1:numel(out) + if ~isequal(unwrap(avec(kk).y), out(kk).y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the unwrap method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Tests that the unwrap method works with a matrix of AOs as input. + % + % + + try + % + out = unwrap(amat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'amat' + % 2) Check that each ouput corrects the phase angles + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(amat)), atest = false; end + % Check that each ouput corrects the phase angles + for kk=1:numel(out) + if ~isequal(unwrap(amat(kk).y), out(kk).y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the unwrap method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Tests that the unwrap method works with a list of AOs as input. + % + % + + try + % + out = unwrap(a1, a2, a3, a4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in the + % input + % 2) Check that each ouput corrects the phase angles + % + % + + atest = true; + aoin = [a1, a2, a3, a4]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(aoin)), atest = false; end + % Check that each ouput corrects the phase angles + for kk=1:numel(out) + if ~isequal(unwrap(aoin(kk).y), out(kk).y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the unwrap method works with a mix of different shaped AOs + % as input. + % + % + function result = utp_05 + + % + % + % Tests that the unwrap method works with a mix of different shaped AOs + % as input. + % + % + + try + % + out = unwrap(a1, avec, amat, a4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in the + % input + % 2) Check that each ouput corrects the phase angles + % + % + + atest = true; + aoin = [a1, reshape(avec, 1, []), reshape(amat, 1, []), a4]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(aoin)), atest = false; end + % Check that each ouput corrects the phase angles + for kk=1:numel(out) + if ~isequal(unwrap(aoin(kk).y), out(kk).y), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the unwrap method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the unwrap method can be processed back. + % + % + + try + % + out = unwrap(a1); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'unwrap'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'unwrap'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the unwrap method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the unwrap method can modify the input AO by calling with + % no output and that the method doesn't change the input of the + % function notation (with a equal sign). + % + % + + try + % + amodi = ao(a3); + aeq = ao(a3); + out = aeq.unwrap(); + amodi.unwrap(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'out' and 'aeq' are now different. + % 2) Check that 'aeq' is not changed + % 3) Check that the modified input is the unwraped value of the copy + % 4) Check that out and amodi are the same + % + % + + atest = true; + if stest + % + % Check that 'out' and 'aeq' are now different. + if eq(out, aeq, ple2), atest = false; end + % Check that 'aeq' is not changed + if ~eq(aeq, ao(a3), ple1), atest = false; end + % Check that the modified input is the unwraped value of the copy + if ~isequal(unwrap(a3.y), amodi.y), atest = false; end + % Check that out and amodi are the same + if ~eq(out, amodi, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test that the unwrap method uses the plist to get the axis. + % + % + function result = utp_08 + + % + % + % Test that the unwrap method uses the plist to get the axis. + % + % + + try + % + plx = plist('axis', 'X'); + ply = plist('axis', 'Y'); + plxy = plist('axis', 'XY'); + out1 = unwrap(a3, plx); + out2 = unwrap(a3, ply); + out3 = unwrap(a3, plxy); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the unwrap method applies to the x-axis + % 2) Check that the unwrap method applies to the y-axis + % 3) Check that the unwrap method applies to both axes + % 4) Check that the re-built object is the same as in 'out[1..3]'. + % + % + + atest = true; + if stest + % + % Check each output against the unwrapped value of the input + if ~isequal(unwrap(a3.data.getX), out1.data.getX), atest = false; end + if ~isequal(a3.data.getY, out1.data.getY), atest = false; end + if ~isequal(a3.data.getX, out2.data.getX), atest = false; end + if ~isequal(unwrap(a3.data.getY), out2.data.getY), atest = false; end + if ~isequal(unwrap(a3.data.getX), out3.data.getX), atest = false; end + if ~isequal(unwrap(a3.data.getY), out3.data.getY), atest = false; end + % Check the re-built objects + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test the shape of the output. + % + % + function result = utp_09 + + % + % + % Test that the unwrap method keeps the data shape of the input object. + % The input AO must be an AO with row data and an AO with column data. + % + % + + try + % + a_col = ao(a3); + a_row = a_col.'; + out1 = unwrap(a_col); + out2 = unwrap(a_row); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,1) == 1, atest = false; end + if size(out2.data.y,2) == 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the unwrap method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_10 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = unwrap(a1, a3); + o3 = unwrap(a1, a3); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_update.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_update.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,401 @@ +% UTP_AO_UPDATE a set of UTPs for the ao/update method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_update.m,v 1.16 2010/08/18 09:25:55 ingo Exp $ +% + +% +% +% The update method of the ao class updates (replace) an LTPDA object +% in the repository with the given replacement object. It is only possible +% to update one object. This is the reason why the general UTPs are not +% possible. +% +% + +function results = utp_ao_update(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'update'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + x = 1:100; + y = exp(x.^.5/2); + obj = ao(x,y, plist('type', 'xydata')); + obj.setName(); + + plForAutoTest = plist('no dialog', true, 'use selector', false); + connPl = utpGetConnectionPlist(); + rm = LTPDARepositoryManager(); + conn = rm.getConnection(connPl); + + try + + experiment_title = 'utp_ao_update: update ao'; + experiment_description = 'utp_ao_update: description'; + analysis_description = ''; + quantity = 'none'; + keywords = 'none'; + reference_ids = ''; + additional_comments = 'none'; + additional_authors = 'no one'; + + plSinfo = plist(... + 'experiment_title', experiment_title, ... + 'experiment_description', experiment_description, ... + 'analysis_description', analysis_description, ... + 'quantity', quantity, ... + 'keywords', keywords, ... + 'reference_ids', reference_ids, ... + 'additional_comments', additional_comments, ... + 'additional_authors', additional_authors); + + [ids, cids] = submit(obj, connPl, plSinfo, plForAutoTest); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Test with conn + results = [results utp_03]; % Test with sinfo + results = [results utp_04]; % Test update of an binary file + results = [results utp_05]; % Test replace with other object + catch + end + + % Close connection + utpCloseConnection(conn); + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 15, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('binary'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isequal(io(3).plists.find('binary'), false), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_02 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Use a database object (conn) to establish the connection. + % + % + + try + % + % Make some changes to the object. + uobj = obj.setName('I was updated (conn)'); + update(uobj, ids, connPl, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_03 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Use a database info structure (sinfo) to establish the connection. + % + % + + try + % + % Make some changes to the object. + uobj = obj.setName('I was updated (sinfo)'); + update(uobj, ids, connPl, plSinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_04 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Check that the update method also updates objects which are stored as + % a binary file. + % + % + + try + % + % Submit the object as a binary + [ids_bin, cids] = bsubmit(obj, connPl, plSinfo, plForAutoTest); + % Make some changes to the object. + uobj = obj.setName('I was updated (sinfo)'); + update(uobj, ids_bin, plSinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids_bin' + robj = ltpda_uo.retrieve(conn, ids_bin); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the update method replaces the object in the repository with + % a completely other object. + % + % + function result = utp_05 + + % + % + % Tests that the update method replaces the object in the repository + % with a completely other object. + % Replace the analysis object with a filter object. + % + % + + try + % + % Make some changes to the object. + uobj = miir(plist('type', 'lowpass')); + update(uobj, ids, connPl, plSinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_upsample.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_upsample.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,537 @@ +% UTP_AO_UPSAMPLE a set of UTPs for the ao/upsample method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_upsample.m,v 1.9 2009/08/07 12:28:47 hewitson Exp $ +% + +% +% +% The upsample method of the ao class upsamples time-series AOs. +% +% + +function results = utp_ao_upsample(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'upsample'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_11(mthd, at1, ple1, plist('N', 2))]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('N'), atest = false; end + if ~io(3).plists.isparam('phase'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('N'), 1), atest = false; end + if ~isequal(io(3).plists.find('phase'), 0), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('N'), {1}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('phase'), {0}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the upsample method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the upsample method works for a vector of AOs as input. + % + % + + try + % + avec = [at1 at5 at6]; + out = upsample(avec, plist('N', 2)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the upsample method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the upsample method works for a matrix of AOs as input. + % + % + + try + % + amat = [at1 at5 at6; at5 at6 at1]; + out = upsample(amat, plist('N', 2)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the upsample method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the upsample method works for a list of AOs as input. + % + % + + try + % + out = upsample(at1,at5,at6, plist('N', 2)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the upsample method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the upsample method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = upsample(at1,[at5 at6],at5,[at5 at1; at6 at1],at6, plist('N', 2)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the upsample method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the upsample method can be processed back + % to an m-file. + % + % + + try + % + out = upsample(at5, plist('N', 2)); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'upsample'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'upsample'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the upsample method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the upsample method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + pl = plist('N', 12.5); + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = ain.upsample(pl); + ain.upsample(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is upsample(at1). + % 3) Check the algorithm + % + % + + atest = true; + if stest + % + % Check that upsample modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that upsample doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the upsample method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + pl = plist('N', 12.5); + out1 = upsample(at5, pl); + out2 = upsample(at6, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y, 2) ~= 1, atest = false; end + if size(out2.data.y, 1) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the upsample method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = upsample(at5, at6); + o3 = upsample(at5, at6); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_var.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_var.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,130 @@ +% UTP_AO_VAR a set of UTPs for the ao/var method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_var.m,v 1.13 2011/04/17 11:12:14 hewitson Exp $ +% + +% +% +% The var method of the ao class computes the variance of the y +% and/or x data. +% +% + +function results = utp_ao_var(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'var'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Overide to include only data2D objects + atmat = [at1 at5 at2; at2 at1 at6]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, atvec, @algo_test_y, [], ple3)]; % Vector input + results = [results utp_03(mthd, atmat, @algo_test_y, [], ple3)]; % Matrix input + results = [results utp_04(mthd, at1, at2, at3, @algo_test_y, [], ple3)]; % List input + results = [results utp_05(mthd, at1, atvec, atmat, @algo_test_y, [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working + results = [results utp_07(mthd, at1, [], ple2)]; % Test the modify call works + results = [results utp_108(mthd, at1, ple2)]; % Test with additional plist with the key 'axis' + results = [results utp_09(mthd, at5, at6)]; % Test input data shape == output data shape + results = [results utp_10(mthd, at5, at6, ple2)]; % Test output of the data + results = [results utp_11(mthd, at1, ple1)]; % Test plotinfo doesn't disappear + + 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 + + %% Algorithm test for UTP 02,03,04,05 + + function atest = algo_test_y(in, out, pli) + atest = true; + if ~isequal(var(in.data.getY).', out.data.getY) + atest = false; + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + atest = check_axis_sets(io); + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_whiten1D.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_whiten1D.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,992 @@ +% UTP_AO_WHITEN1D a set of UTPs for the ao/whiten1D method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_whiten1D.m,v 1.24 2011/04/18 16:57:44 ingo Exp $ +% + +% +% +% The whiten1D method of the ao class computes the whiten1Dolute value of the y +% and/or x data. +% +% + +function results = utp_ao_whiten1D(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'whiten1D'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % add useful params to standard exceptions + ple3 = plist('Exceptions', {'history', 'created', 'UUID', 'param/desc', 'name', 'procinfo'}); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test flatness capability - no model input + results = [results utp_11]; % Test flatness capability - model input + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + defaultWinType = char(prefs.getMiscPrefs.getDefaultWindow); + + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if ~any(strcmpi(io(2).sets, 'psd')), atest = false; end + if ~any(strcmpi(io(2).sets, 'lpsd')), atest = false; end + %%%%%%%%%% SET 'Default' + pn = 3; + if io(pn).plists.nparams ~= 15, atest = false; end + % Check key + if ~io(pn).plists.isparam('model'), atest = false; end + if ~io(pn).plists.isparam('range'), atest = false; end + if ~io(pn).plists.isparam('fs'), atest = false; end + if ~io(pn).plists.isparam('complete_hf'), atest = false; end + if ~io(pn).plists.isparam('maxiter'), atest = false; end + if ~io(pn).plists.isparam('poletype'), atest = false; end + if ~io(pn).plists.isparam('minorder'), atest = false; end + if ~io(pn).plists.isparam('maxorder'), atest = false; end + if ~io(pn).plists.isparam('weights'), atest = false; end + if ~io(pn).plists.isparam('plot'), atest = false; end + if ~io(pn).plists.isparam('disp'), atest = false; end + if ~io(pn).plists.isparam('msevartol'), atest = false; end + if ~io(pn).plists.isparam('fittol'), atest = false; end + if ~io(pn).plists.isparam('flim'), atest = false; end + if ~io(pn).plists.isparam('scaleout'), atest = false; end + + % Check default value + if ~isEmptyDouble(io(pn).plists.find('model')), atest = false; end + if ~isequal(io(pn).plists.find('range'), []), atest = false; end + if ~isequal(io(pn).plists.find('fs'), []), atest = false; end + if ~isequal(io(pn).plists.find('complete_hf'), 'flat'), atest = false; end + if ~isequal(io(pn).plists.find('maxiter'), 30), atest = false; end + if ~isequal(io(pn).plists.find('poletype'), 1), atest = false; end + if ~isequal(io(pn).plists.find('minorder'), 2), atest = false; end + if ~isequal(io(pn).plists.find('maxorder'), 25), atest = false; end + if ~isequal(io(pn).plists.find('weights'), '1/abs'), atest = false; end + if ~isequal(io(pn).plists.find('plot'), false), atest = false; end + if ~isequal(io(pn).plists.find('disp'), false), atest = false; end + if ~isequal(io(pn).plists.find('msevartol'), .1), atest = false; end + if ~isequal(io(pn).plists.find('fittol'), .01), atest = false; end + if ~isequal(io(pn).plists.find('flim'), [1e-3 30e-3]), atest = false; end + if ~isequal(io(pn).plists.find('scaleout'), false), atest = false; end + + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('model'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('range'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('complete_hf'), {'flat', 'lowpass'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('maxiter'), {30}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('minorder'), {2}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('maxorder'), {25}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('weights'), {'equal', '1/abs', '1/abs^2'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('plot'), {false, true}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('disp'), {false, true}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('msevartol'), {.1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('fittol'), {.01}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('poletype'), {1 2 3}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('flim'), {[1e-3 30e-3]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('scaleout'), {false, true}), atest = false; end + + %%%%%%%%%% SET 'psd' + pn = 4; + if io(pn).plists.nparams ~= 29, atest = false; end + % Check key + if ~io(pn).plists.isparam('model'), atest = false; end + if ~io(pn).plists.isparam('range'), atest = false; end + if ~io(pn).plists.isparam('fs'), atest = false; end + if ~io(pn).plists.isparam('complete_hf'), atest = false; end + if ~io(pn).plists.isparam('maxiter'), atest = false; end + if ~io(pn).plists.isparam('poletype'), atest = false; end + if ~io(pn).plists.isparam('minorder'), atest = false; end + if ~io(pn).plists.isparam('maxorder'), atest = false; end + if ~io(pn).plists.isparam('weights'), atest = false; end + if ~io(pn).plists.isparam('plot'), atest = false; end + if ~io(pn).plists.isparam('disp'), atest = false; end + if ~io(pn).plists.isparam('msevartol'), atest = false; end + if ~io(pn).plists.isparam('fittol'), atest = false; end + if ~io(pn).plists.isparam('nfft'), atest = false; end + if ~io(pn).plists.isparam('win'), atest = false; end + if ~io(pn).plists.isparam('psll'), atest = false; end + if ~io(pn).plists.isparam('olap'), atest = false; end + if ~io(pn).plists.isparam('order'), atest = false; end + if ~io(pn).plists.isparam('navs'), atest = false; end + if ~io(pn).plists.isparam('times'), atest = false; end + if ~io(pn).plists.isparam('split'), atest = false; end + if ~io(pn).plists.isparam('scale'), atest = false; end + if ~io(pn).plists.isparam('method'), atest = false; end + if ~io(pn).plists.isparam('xscale'), atest = false; end + if ~io(pn).plists.isparam('resolution'), atest = false; end + if ~io(pn).plists.isparam('xvals'), atest = false; end + if ~io(pn).plists.isparam('inherit_dy'), atest = false; end + if ~io(pn).plists.isparam('flim'), atest = false; end + if ~io(pn).plists.isparam('scaleout'), atest = false; end + + % Check default value + if ~isequal(io(pn).plists.find('model'), 'PSD'), atest = false; end + if ~isequal(io(pn).plists.find('range'), []), atest = false; end + if ~isequal(io(pn).plists.find('fs'), []), atest = false; end + if ~isequal(io(pn).plists.find('complete_hf'), 'flat'), atest = false; end + if ~isequal(io(pn).plists.find('maxiter'), 30), atest = false; end + if ~isequal(io(pn).plists.find('poletype'), 1), atest = false; end + if ~isequal(io(pn).plists.find('minorder'), 2), atest = false; end + if ~isequal(io(pn).plists.find('maxorder'), 25), atest = false; end + if ~isequal(io(pn).plists.find('weights'), '1/abs'), atest = false; end + if ~isequal(io(pn).plists.find('plot'), false), atest = false; end + if ~isequal(io(pn).plists.find('disp'), false), atest = false; end + if ~isequal(io(pn).plists.find('msevartol'), .1), atest = false; end + if ~isequal(io(pn).plists.find('fittol'), .01), atest = false; end + if ~isequal(io(pn).plists.find('nfft'), -1), atest = false; end + if ~strcmpi(io(pn).plists.find('win'), defaultWinType), atest = false; end + if ~isequal(io(pn).plists.find('psll'), 200), atest = false; end + if ~isequal(io(pn).plists.find('olap'), 50), atest = false; end + if ~isequal(io(pn).plists.find('order'), 1), atest = false; end + if ~isequal(io(pn).plists.find('navs'), 16), atest = false; end + if ~isequal(io(pn).plists.find('times'), []), atest = false; end + if ~isequal(io(pn).plists.find('split'), []), atest = false; end + if ~isequal(io(pn).plists.find('scale'), 'PSD'), atest = false; end + if ~isequal(io(pn).plists.find('method'), 'MEAN'), atest = false; end + if ~isequal(io(pn).plists.find('xscale'), 'LOG'), atest = false; end + if ~isequal(io(pn).plists.find('resolution'), 50), atest = false; end + if ~isequal(io(pn).plists.find('xvals'), []), atest = false; end + if ~isequal(io(pn).plists.find('inherit_dy'), 'yes'), atest = false; end + if ~isequal(io(pn).plists.find('flim'), [1e-3 30e-3]), atest = false; end + if ~isequal(io(pn).plists.find('scaleout'), false), atest = false; end + + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('model'), {'PSD'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('range'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('complete_hf'), {'flat', 'lowpass'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('maxiter'), {30}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('poletype'), {1 2 3}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('minorder'), {2}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('maxorder'), {25}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('weights'), {'equal', '1/abs', '1/abs^2'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('plot'), {false, true}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('disp'), {false, true}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('msevartol'), {.1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('fittol'), {.01}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('nfft'), {-1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('win'), specwin.getTypes), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('psll'), {200}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('olap'), {50}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('order'), {1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('navs'), {16}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('times'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('split'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('scale'), {'PSD', 'ASD', 'PS', 'AS'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('method'), {'MEAN'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('xscale'), {'LOG','LIN'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('resolution'), {50}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('xvals'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('inherit_dy'), {'yes','no'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('flim'), {[1e-3 30e-3]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('scaleout'), {false, true}), atest = false; end + + %%%%%%%%%% SET 'lpsd' + pn = 5; + if io(pn).plists.nparams ~= 25, atest = false; end + % Check key + if ~io(pn).plists.isparam('model'), atest = false; end + if ~io(pn).plists.isparam('range'), atest = false; end + if ~io(pn).plists.isparam('fs'), atest = false; end + if ~io(pn).plists.isparam('complete_hf'), atest = false; end + if ~io(pn).plists.isparam('maxiter'), atest = false; end + if ~io(pn).plists.isparam('poletype'), atest = false; end + if ~io(pn).plists.isparam('minorder'), atest = false; end + if ~io(pn).plists.isparam('maxorder'), atest = false; end + if ~io(pn).plists.isparam('weights'), atest = false; end + if ~io(pn).plists.isparam('plot'), atest = false; end + if ~io(pn).plists.isparam('disp'), atest = false; end + if ~io(pn).plists.isparam('msevartol'), atest = false; end + if ~io(pn).plists.isparam('fittol'), atest = false; end + if ~io(pn).plists.isparam('kdes'), atest = false; end + if ~io(pn).plists.isparam('jdes'), atest = false; end + if ~io(pn).plists.isparam('lmin'), atest = false; end + if ~io(pn).plists.isparam('win'), atest = false; end + if ~io(pn).plists.isparam('psll'), atest = false; end + if ~io(pn).plists.isparam('olap'), atest = false; end + if ~io(pn).plists.isparam('order'), atest = false; end + if ~io(pn).plists.isparam('times'), atest = false; end + if ~io(pn).plists.isparam('split'), atest = false; end + if ~io(pn).plists.isparam('scale'), atest = false; end + if ~io(pn).plists.isparam('flim'), atest = false; end + if ~io(pn).plists.isparam('scaleout'), atest = false; end + + % Check default value + if ~isequal(io(pn).plists.find('model'), 'LPSD'), atest = false; end + if ~isequal(io(pn).plists.find('range'), []), atest = false; end + if ~isequal(io(pn).plists.find('fs'), []), atest = false; end + if ~isequal(io(pn).plists.find('complete_hf'), 'flat'), atest = false; end + if ~isequal(io(pn).plists.find('maxiter'), 30), atest = false; end + if ~isequal(io(pn).plists.find('poletype'), 1), atest = false; end + if ~isequal(io(pn).plists.find('minorder'), 2), atest = false; end + if ~isequal(io(pn).plists.find('maxorder'), 25), atest = false; end + if ~isequal(io(pn).plists.find('weights'), '1/abs'), atest = false; end + if ~isequal(io(pn).plists.find('plot'), false), atest = false; end + if ~isequal(io(pn).plists.find('disp'), false), atest = false; end + if ~isequal(io(pn).plists.find('msevartol'), .1), atest = false; end + if ~isequal(io(pn).plists.find('fittol'), .01), atest = false; end + if ~isequal(io(pn).plists.find('kdes'), 100), atest = false; end + if ~isequal(io(pn).plists.find('jdes'), 1000), atest = false; end + if ~isequal(io(pn).plists.find('lmin'), 0), atest = false; end + if ~strcmpi(io(pn).plists.find('win'), defaultWinType), atest = false; end + if ~isequal(io(pn).plists.find('psll'), 200), atest = false; end + if ~isequal(io(pn).plists.find('olap'), -1), atest = false; end + if ~isequal(io(pn).plists.find('order'), 0), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('times')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('split')), atest = false; end + if ~isequal(io(pn).plists.find('scale'), 'PSD'), atest = false; end + if ~isequal(io(pn).plists.find('flim'), [1e-3 30e-3]), atest = false; end + if ~isequal(io(pn).plists.find('scaleout'), false), atest = false; end + + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('model'), {'LPSD'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('range'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('complete_hf'), {'flat', 'lowpass'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('maxiter'), {30}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('poletype'), {1 2 3}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('minorder'), {2}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('maxorder'), {25}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('weights'), {'equal', '1/abs', '1/abs^2'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('plot'), {false, true}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('disp'), {false, true}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('msevartol'), {.1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('fittol'), {.01}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('kdes'), {100}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('jdes'), {1000}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('lmin'), {0}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('win'), specwin.getTypes), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('psll'), {200}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('olap'), {-1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('order'), {-1 0 1 2 3 4 5 6 7 8 9}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('times'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('split'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('scale'), {'PSD', 'ASD', 'PS', 'AS'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('flim'), {[1e-3 30e-3]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('scaleout'), {false, true}), atest = false; end + + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the whiten1D method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the whiten1D method works for a vector of AOs as input. + % + % + + try + % + u = get_random_unit(); + atvec.setYunits(u); + out = whiten1D(atvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atvec' + % 2) Check that each output AO contains the correct data. + % 3) Check that each output AO contains empty yunits + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atvec)), atest = false; end + % Check each output against the absolute value of the input + for kk=1:numel(out) + % Check the whiten ao(tsdata) objects + if isa(out(kk).data, 'tsdata') + used_filt = out(kk).procinfo.find('Filter'); + obj = atvec(kk).filter(used_filt); + if ~eq(out(kk), obj, ple3), atest = false; end + if ~eq(out(kk).yunits, unit('')), atest = false; end + else + % Check the other objects (they must be the same) + if ~eq(out(kk), atvec(kk), ple1), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the whiten1D method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the whiten1D method works for a matrix of AOs as input. + % + % + + try + % + u = get_random_unit(); + atmat.setYunits(u); + out = whiten1D(atmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % 3) Check that each output AO contains empty yunits + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(atmat)), atest = false; end + % Check each output against the absolute value of the input + for kk=1:numel(out) + % Check the whiten ao(tsdata) objects + if isa(out(kk).data, 'tsdata') + used_filt = out(kk).procinfo.find('Filter'); + obj = atmat(kk).filter(used_filt); + if ~eq(out(kk), obj, ple3), atest = false; end + if ~eq(out(kk).yunits, unit('')), atest = false; end + else + % Check the other objects (they must be the same) + if ~eq(out(kk), atmat(kk), ple1), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the whiten1D method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the whiten1D method works for a list of AOs as input. + % + % + + try + % + at1.setYunits(get_random_unit()); + at2.setYunits(get_random_unit()); + at3.setYunits(get_random_unit()); + out = whiten1D(at1,at2,at3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % 3) Check that each output AO contains empty yunits + % + % + + atest = true; + aoin = [at1,at2,at3]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(aoin)), atest = false; end + % Check each output against the absolute value of the input + for kk=1:numel(out) + % Check the whiten ao(tsdata) objects + if isa(out(kk).data, 'tsdata') + used_filt = out(kk).procinfo.find('Filter'); + obj = aoin(kk).filter(used_filt); + if ~eq(out(kk), obj, ple3), atest = false; end + if ~eq(out(kk).yunits, unit('')), atest = false; end + else + % Check the other objects (they must be the same) + if ~eq(out(kk), aoin(kk), ple1), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the whiten1D method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the whiten1D method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = whiten1D(at1,[at2 at3],[at4 at5; at6 at1]); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % 3) Check that each output AO contains empty yunits + % + % + + atest = true; + aoin = [at1,reshape([at2 at3],1,[]),reshape([at4 at5; at6 at1],1,[])]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(aoin)), atest = false; end + % Check each output against the absolute value of the input + for kk=1:numel(out) + % Check the whiten ao(tsdata) objects + if isa(out(kk).data, 'tsdata') + used_filt = out(kk).procinfo.find('Filter'); + obj = aoin(kk).filter(used_filt); + if ~eq(out(kk), obj, ple3), atest = false; end + if ~eq(out(kk).yunits, unit('')), atest = false; end + else + % Check the other objects (they must be the same) + if ~eq(out(kk), aoin(kk), ple1), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the whiten1D method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the whiten1D method can be processed back. + % + % + + try + % + out = whiten1D(at1); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'whiten1D'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'whiten1D'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the whiten1D method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the whiten1D method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = ain.whiten1D(); + + % It is necessary that ain uses the same random state + ain.whiten1D(plist('rand_stream', aout.hist.plistUsed.find('rand_stream'))); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is whiten1D(at1). + % + % + + atest = true; + if stest + % + % Check that whiten1D modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that whiten1D doesn't modified the input for the function + % notation + if ~eq(aout, ain, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the whiten1D method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + at5.setYunits(get_random_unit()); + at6.setYunits(get_random_unit()); + out1 = whiten1D(at5); + out2 = whiten1D(at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % 2) Check that the output AOs have empty yunits + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.x) ~= size(at5.data.x), atest = false; end + if size(out1.data.y) ~= size(at5.data.y), atest = false; end + if size(out2.data.x) ~= size(at6.data.x), atest = false; end + if size(out2.data.y) ~= size(at6.data.y), atest = false; end + if ~eq(out1.yunits, unit('')), atest = false; end + if ~eq(out2.yunits, unit('')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the whiten1D method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = whiten1D(at5, at6); + o3 = whiten1D(at5, at6); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the whiten1D method is capable to increase spectral flatness + % in case of no model input + % + % + function result = utp_10 + + % + % + % Generate a fixed series of noise data, apply a filter to colour data + % and run the method with a certain number of parameters. + % + % + + try + % + % Making test data + + a = ao(plist('tsfcn', 'randn(size(t))', 'fs', 10, 'nsecs', 10000, ... + 'yunits', get_random_unit())); % random noise + pzm10 = pzmodel(1, {0.01}, {0.1}); + ft = miir(pzm10); + af = filter(a, ft); % Colored noise + + % Running whiten1D with no model input + pl10 = plist(... + 'model', [], ... + 'MaxIter', 30, ... + 'PoleType', 1, ... + 'MinOrder', 2, ... + 'MaxOrder', 9, ... + 'Weights', 2, ... + 'Plot', false,... + 'Disp', false,... + 'RMSEVar', 3,... + 'FitTolerance', 0.6); % tolerance on fit residuals spectral flatness + + aw = whiten1D(af,pl10); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output spectrum is flatter than input colored + % spectrum + % 2) Check that the output AOs have empty yunits + % + % + + atest = true; + if stest + % + % Make spectra + afxx = af.psd; + awxx = aw.psd; + + % Claculating flatness + sf = utils.math.spflat([afxx.data.y awxx.data.y]); + + % Checking flatness + if sf(1)>sf(2), atest = false; end + if ~eq(aw.yunits, unit('')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_11 + + % + % + % Check that the whiten1D method is capable to increase spectral flatness + % when a model is input + % + % + function result = utp_11 + + % + % + % Generate a fixed series of noise data, apply a filter to colour data + % and run the method with a certain number of parameters. + % + % + + try + % + % Making test data + a = ao(plist('tsfcn', 'randn(size(t))', 'fs', 10, 'nsecs', 10000, ... + 'yunits', get_random_unit())); % random noise + pzm11 = pzmodel(1, {0.01}, {0.1}); + ft = miir(pzm11); + af = filter(a, ft); % Colored noise + + % Running whiten1D with model input + pl11 = plist(... + 'model', abs(pzm11.resp).^2, ... + 'fs', 10, ... + 'MaxIter', 30, ... + 'PoleType', 1, ... + 'MinOrder', 2, ... + 'MaxOrder', 9, ... + 'Weights', 2, ... + 'Plot', false,... + 'Disp', false,... + 'RMSEVar', 8,... + 'FitTolerance', 2); % tolerance on fit residuals log difference with model data + + aw = whiten1D(af,pl11); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output spectrum is flatter than input colored + % spectrum + % + % + + atest = true; + if stest + % + % Make spectra + afxx = af.psd; + awxx = aw.psd; + + % Claculating flatness + sf = utils.math.spflat([afxx.data.y awxx.data.y]); + + % Checking flatness + if sf(1)>sf(2), atest = false; end + if ~eq(aw.yunits, unit('')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_11 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_whiten2D.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_whiten2D.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,730 @@ +% UTP_AO_WHITEN2D a set of UTPs for the ao/whiten2D method +% +% L Ferraioli 02-02-09 +% +% $Id: utp_ao_whiten2D.m,v 1.10 2010/05/07 16:20:01 ingo Exp $ +% + +% +% +% The whiten1D method of the ao class computes the whiten1Dolute value of the y +% and/or x data. +% +% + +function results = utp_ao_whiten2D(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'whiten2D'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [CSD,a1,a2,a3,a4,a5,a6,av,am,plstd] = get_test_obj_ao_whiten2D(); + + % -------------------------------------------------------------------- + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % add useful params to standard exceptions + ple3 = plist('Exceptions', {'history', 'created', 'UUID', 'param/desc', 'name', 'procinfo'}); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 15, atest = false; end + % Check key + if ~io(3).plists.isparam('csd11'), atest = false; end + if ~io(3).plists.isparam('csd12'), atest = false; end + if ~io(3).plists.isparam('csd21'), atest = false; end + if ~io(3).plists.isparam('csd22'), atest = false; end + if ~io(3).plists.isparam('maxiter'), atest = false; end + if ~io(3).plists.isparam('poletype'), atest = false; end + if ~io(3).plists.isparam('minorder'), atest = false; end + if ~io(3).plists.isparam('maxorder'), atest = false; end + if ~io(3).plists.isparam('weights'), atest = false; end + if ~io(3).plists.isparam('plot'), atest = false; end + if ~io(3).plists.isparam('disp'), atest = false; end + if ~io(3).plists.isparam('msevartol'), atest = false; end + if ~io(3).plists.isparam('fittol'), atest = false; end + if ~io(3).plists.isparam('usesym'), atest = false; end + if ~io(3).plists.isparam('keepvar'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('csd11')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('csd12')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('csd21')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('csd22')), atest = false; end + if ~isequal(io(3).plists.find('maxiter'), 30), atest = false; end + if ~isequal(io(3).plists.find('poletype'), 3), atest = false; end + if ~isequal(io(3).plists.find('minorder'), 2), atest = false; end + if ~isequal(io(3).plists.find('maxorder'), 25), atest = false; end + if ~isequal(io(3).plists.find('weights'), 3), atest = false; end + if ~isequal(io(3).plists.find('plot'), false), atest = false; end + if ~isequal(io(3).plists.find('disp'), false), atest = false; end + if ~isequal(io(3).plists.find('msevartol'), .01), atest = false; end + if ~isequal(io(3).plists.find('fittol'), .01), atest = false; end + if ~isequal(io(3).plists.find('usesym'), 0), atest = false; end + if ~isequal(io(3).plists.find('keepvar'), false), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('csd11'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('csd12'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('csd21'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('csd22'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('maxiter'), {30}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('poletype'), {1 2 3}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('minorder'), {2}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('maxorder'), {25}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('weights'), {3}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('plot'), {false, true}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('disp'), {false, true}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('msevartol'), {.01}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('fittol'), {.01}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('usesym'), {0, 1, 2}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('keepvar'), {true, false}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the whiten2D method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the whiten2D method works for a vector of AOs as input. + % + % + + try + % + % Building data vector + + out = whiten2D(av, plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'acv2' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(av)), atest = false; end + + % check if the number of output is even or odd + if rem(numel(out),2) + % check the last object for odd input + h = numel(out); + if isa(out(h).data, 'tsdata') + % Check the last object if nargin is odd (they must be the same) + if ~eq(out(h), av(h), ple1), atest = false; end + else + % Check the other objects (they must be the same) + if ~eq(out(h), av(h), ple1), atest = false; end + end + else + % Check each output against the absolute value of the input for even + % input + for kk=1:2:numel(out)-1 + clear used_filt11 used_filt12 used_filt21 used_filt22 + % Check the noisegen ao(tsdata) objects + if isa(out(kk).data, 'tsdata') + used_filt11 = out(kk).procinfo.find('Filt11'); + used_filt12 = out(kk).procinfo.find('Filt12'); + used_filt21 = out(kk+1).procinfo.find('Filt21'); + used_filt22 = out(kk+1).procinfo.find('Filt22'); + obj1 = filter(av(kk),used_filt11)+filter(av(kk+1),used_filt12); + if ~eq(out(kk), obj1, ple3), atest = false; end + obj2 = filter(av(kk),used_filt21)+filter(av(kk+1),used_filt22); + if ~eq(out(kk), obj2, ple3), atest = false; end + else + % Check the other objects (they must be the same) + if ~eq(out(kk), av(kk), ple1), atest = false; end + end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the whiten2D method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the whiten2D method works for a matrix of AOs as input. + % + % + + try + % + out = whiten2D(am,plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'atmat' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(am)), atest = false; end + + % check if the number of output is even or odd + if rem(numel(out),2) + % check the last object for odd input + h = numel(out); + if isa(out(h).data, 'tsdata') + % Check the last object if nargin is odd (they must be the same) + if ~eq(out(h), am(h), ple1), atest = false; end + else + % Check the other objects (they must be the same) + if ~eq(out(h), am(h), ple1), atest = false; end + end + else + % Check each output against the absolute value of the input for even + % input + for kk=1:2:numel(out)-1 + clear used_filt11 used_filt12 used_filt21 used_filt22 + % Check the noisegen ao(tsdata) objects + if isa(out(kk).data, 'tsdata') + used_filt11 = out(kk).procinfo.find('Filt11'); + used_filt12 = out(kk).procinfo.find('Filt12'); + used_filt21 = out(kk+1).procinfo.find('Filt21'); + used_filt22 = out(kk+1).procinfo.find('Filt22'); + obj1 = filter(am(kk),used_filt11)+filter(am(kk+1),used_filt12); + if ~eq(out(kk), obj1, ple3), atest = false; end + obj2 = filter(am(kk),used_filt21)+filter(am(kk+1),used_filt22); + if ~eq(out(kk+1), obj2, ple3), atest = false; end + else + % Check the other objects (they must be the same) + if ~eq(out(kk), am(kk), ple1), atest = false; end + end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the whiten2D method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the whiten2D method works for a list of AOs as input. + % + % + + try + % + out = whiten2D(a1,a2,a3,a4,a5,plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [a1 a2 a3 a4 a5]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(aoin)), atest = false; end + + % check if the number of output is even or odd + if rem(numel(out),2) + % check the last object for odd input + h = numel(out); + if isa(out(h).data, 'tsdata') + % Check the last object if nargin is odd (they must be the same) + if ~eq(out(h), aoin(h), ple1), atest = false; end + else + % Check the other objects (they must be the same) + if ~eq(out(h), aoin(h), ple1), atest = false; end + end + else + % Check each output against the absolute value of the input for even + % input + for kk=1:2:numel(out)-1 + clear used_filt11 used_filt12 used_filt21 used_filt22 + % Check the noisegen ao(tsdata) objects + if isa(out(kk).data, 'tsdata') + used_filt11 = out(kk).procinfo.find('Filt11'); + used_filt12 = out(kk).procinfo.find('Filt12'); + used_filt21 = out(kk+1).procinfo.find('Filt21'); + used_filt22 = out(kk+1).procinfo.find('Filt22'); + obj1 = filter(aoin(kk),used_filt11)+filter(aoin(kk+1),used_filt12); + if ~eq(out(kk), obj1, ple3), atest = false; end + obj2 = filter(aoin(kk),used_filt21)+filter(aoin(kk+1),used_filt22); + if ~eq(out(kk+1), obj2, ple3), atest = false; end + else + % Check the other objects (they must be the same) + if ~eq(out(kk), aoin(kk), ple1), atest = false; end + end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the whiten2D method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the whiten1D method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + % [1,reshape([2 3],1,[]),reshape([4 6; 5 7],1,[])]; + out = whiten2D(a1,[a2 a3],[a4 a2; a1 a3],plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + % [1,reshape([2 3],1,[]),reshape([4 6; 5 7],1,[])]; + aoin = [a1,reshape([a2 a3],1,[]),reshape([a4 a2; a1 a3],1,[])]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(aoin)), atest = false; end + + % check if the number of output is even or odd + if rem(numel(out),2) + % check the last object for odd input + h = numel(out); + if isa(out(h).data, 'tsdata') + % Check the last object if nargin is odd (they must be the same) + if ~eq(out(h), aoin(h), ple1), atest = false; end + else + % Check the other objects (they must be the same) + if ~eq(out(h), aoin(h), ple1), atest = false; end + end + else + % Check each output against the absolute value of the input for even + % input + for kk=1:2:numel(out)-1 + clear used_filt11 used_filt12 used_filt21 used_filt22 + % Check the noisegen ao(tsdata) objects + if isa(out(kk).data, 'tsdata') + used_filt11 = out(kk).procinfo.find('Filt11'); + used_filt12 = out(kk).procinfo.find('Filt12'); + used_filt21 = out(kk+1).procinfo.find('Filt21'); + used_filt22 = out(kk+1).procinfo.find('Filt22'); + obj1 = filter(aoin(kk),used_filt11)+filter(aoin(kk+1),used_filt12); + if ~eq(out(kk), obj1, ple3), atest = false; end + obj2 = filter(aoin(kk),used_filt21)+filter(aoin(kk+1),used_filt22); + if ~eq(out(kk+1), obj2, ple3), atest = false; end + else + % Check the other objects (they must be the same) + if ~eq(out(kk), aoin(kk), ple1), atest = false; end + end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the whiten2D method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the whiten2D method can be processed back. + % + % + + try + % + out = whiten2D(av,plstd); + o1 = out.index(1); + o2 = out.index(2); + o3 = out(3); % It is not necessary to index the third element + % of 'out' because this is not touched by 'whiten2D' + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'whiten2D'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out(1).hist.methodInfo.mname, 'whiten2D'), atest = false; end + if ~strcmp(out(2).hist.methodInfo.mname, 'whiten2D'), atest = false; end + % Check the re-built object + if ~eq(mout1, o1, ple2), atest = false; end + if ~eq(mout2, o2, ple2), atest = false; end + if ~eq(mout3, o3, ple2), atest = false; end + % Check the unchanged object (the last one) + if ~eq(av(3), out(3), ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the whiten2D method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the whiten2D method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + amodi = [ao(a1) ao(a2)]; + aeq = [ao(a1) ao(a2)]; + amodi.whiten2D(plstd); + out = aeq.whiten2D(plstd); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to do. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the whiten2D method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out = whiten2D(a3,a4,a5,a6,plstd); + out1 = out(1); + out2 = out(2); + out3 = out(3); + out4 = out(4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.x) ~= size(a3.data.x), atest = false; end + if size(out1.data.y) ~= size(a3.data.y), atest = false; end + if size(out2.data.x) ~= size(a4.data.x), atest = false; end + if size(out2.data.y) ~= size(a4.data.y), atest = false; end + if size(out3.data.x) ~= size(a5.data.x), atest = false; end + if size(out3.data.y) ~= size(a5.data.y), atest = false; end + if size(out4.data.x) ~= size(a6.data.x), atest = false; end + if size(out4.data.y) ~= size(a6.data.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the noisegen2D method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1,o2] = whiten2D(a1,a2,plstd); + o3 = whiten2D(a1,a2,plstd); + o31 = o3.index(1); + o32 = o3.index(2); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout31 = rebuild(o31); + mout32 = rebuild(o32); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o31, mout31, ple2), atest = false; end + if ~eq(o32, mout32, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_x.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_x.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,425 @@ +% UTP_AO_X a set of UTPs for the ao/x method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_x.m,v 1.3 2009/07/21 15:57:44 ingo Exp $ +% + +% +% +% The x method of the ao class is a get-function to get the x values of the +% data object +% +% + +function results = utp_ao_x(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'x'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test with all data objects + results = [results utp_08]; % Test with additional plist with the key 'axis' + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the x method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % The x method doesn't work with a vector of AOs. Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the x method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % The x method doesn't work with a matrix of AOs. Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the x method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % The x method doesn't work with a list of AOs. Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the x method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % The x method can only return the x values of one AO. Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the x method properly applies history. + % + % + function result = utp_06 + + % + % + % The x method doesn't change the AO, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the x method works for AOs with different data objects. + % + % + function result = utp_07 + + % + % + % Test that the x method returns the x values for AOs with cdata, fsdata, + % tsdata and xydata objects. + % + % + + try + % + x1 = at1.x; + x2 = at2.x; + x3 = at3.x; + x4 = at4.x; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if ~isequal(x1, at1.data.getX), atest = false; end; + if ~isequal(x2, at2.data.x), atest = false; end; + if ~isequal(x3, at3.data.x'), atest = false; end; + if ~isequal(x4, []), atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the x method returns the x values of the data object + % + % + function result = utp_08 + + % + % + % Test that the x method returns the x values in a column vector independent + % form the shape of the values in the data object. + % + % + + try + % + x1 = at5.x; + x2 = at6.x; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'x1' and 'x2' are column vectors. + % + % + + atest = true; + if stest + % + if size(x1, 2) ~= 1, atest = false; end; + if size(x2, 2) ~= 1, atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_xcorr.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_xcorr.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,875 @@ +% UTP_AO_XCORR a set of UTPs for the ao/xcorr method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_xcorr.m,v 1.7 2010/08/17 06:00:10 mauro Exp $ +% + +% +% +% The xcorr method of the ao class makes cross-correlation estimates of +% the time-series objects. +% +% + +function results = utp_ao_xcorr(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'xcorr'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test input data shape == output data shape + results = [results utp_08]; % Test output of the data + results = [results utp_09]; % Test resample input AOs to maxFs + results = [results utp_10]; % Test truncate input AOs to same length + results = [results utp_11(mthd, [at1 at1], ple1)]; % Test plotinfo doesn't disappear + results = [results utp_12]; % Test plist(scale) different scales + results = [results utp_13]; % Test plist(MaxLag) different lag ranges [-maxlags:maxlags] + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('MaxLag'), atest = false; end + if ~io(3).plists.isparam('scale'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('MaxLag'), -1), atest = false; end + if ~isequal(io(3).plists.find('scale'), 'none'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('MaxLag'), {-1}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('scale'), {'none', 'biased', 'unbiased', 'coeff'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the xcorr method works with a vector with 2 AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the xcorr method works for a vector with 2 AOs as input. + % + % + + try + % + nsecs = 10; + fs = 100; + u1 = get_random_unit; + u2 = get_random_unit; + + pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'sin(2*pi*7.433*t) + randn(size(t))', 'yunits', u1); + iir = miir(plist('type', 'highpass', 'fc', 20, 'fs', fs, 'iunits', u1, 'ounits', u2)); + + a1 = ao(pl); + a2 = filter(a1, iir); + + avec1 = [a1, a2]; + avec2 = [a2, a1]; + out1 = xcorr(avec1); + out2 = xcorr(avec2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the numbers of outputs is 1 + % 2) Check that the output AO contains the correct data. + % 3) Check that the units are properly handled + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 1, atest = false; end + if numel(out2) ~= 1, atest = false; end + % Check the output data + MaxLag = len(a1); + % Check a1 -> a2 + [c,lags] = xcorr(a1.y, a2.y, MaxLag); + if ~isequal(out1.x, (lags./fs).'), atest = false; end + if ~isequal(out1.y, c), atest = false; end + % Check a2 -> a1 + [c,lags] = xcorr(a2.y, a1.y, MaxLag); + if ~isequal(out2.x, (lags./fs).'), atest = false; end + if ~isequal(out2.y, c), atest = false; end + % Check the units + if ne(out1.yunits, (a1.yunits) * (a2.yunits)) || ne(out1.xunits, unit('s')), atest = false; end + if ne(out2.yunits, (a2.yunits) * (a1.yunits)) || ne(out2.xunits, unit('s')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the xcorr method does not work with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Tests that the xcorr method does not work with a matrix of AOs as input. + % + % + + try + % + nsecs = 10; + fs = 100; + pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'sin(2*pi*7.433*t) + randn(size(t))'); + iir = miir(plist('type', 'highpass', 'fc', 20, 'fs', fs)); + + a1 = ao(pl); + a2 = ao(pl); + a3 = ao(pl); + a4 = filter(a1, iir); + + amat = [a1, a2, a3, a4]; + out = xcorr(amat); + % + stest = false; + catch err + disp(err.message) + stest = true; + end + + % + % + % 1) Nothing to check + % + % + + atest = true; + if stest + % + % Nothing to check + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the xcorr method works with a list of 2 AOs as input. + % + % + function result = utp_04 + + % + % + % Tests that the xcorr method works with a list of 2 AOs as input. + % + % + + try + % + nsecs = 10; + fs = 100; + u1 = get_random_unit; + u2 = get_random_unit; + + pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'sin(2*pi*7.433*t) + randn(size(t))', 'yunits', u1); + iir = miir(plist('type', 'highpass', 'fc', 20, 'fs', fs, 'iunits', u1, 'ounits', u2)); + + a1 = ao(pl); + a2 = filter(a1, iir); + + out1 = xcorr(a1, a2); + out2 = xcorr(a2, a1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the numbers of outputs is 1 + % 2) Check that the output AO contains the correct data. + % 3) Check that the units are properly handled + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 1, atest = false; end + if numel(out2) ~= 1, atest = false; end + % Check the output data + MaxLag = len(a1); + % Check a1 -> a2 + [c,lags] = xcorr(a1.y, a2.y, MaxLag); + if ~isequal(out1.x, (lags./fs).'), atest = false; end + if ~isequal(out1.y, c), atest = false; end + % Check a2 -> a1 + [c,lags] = xcorr(a2.y, a1.y, MaxLag); + if ~isequal(out2.x, (lags./fs).'), atest = false; end + if ~isequal(out2.y, c), atest = false; end + % Check the units + if ne(out1.yunits, (a1.yunits) * (a2.yunits)) || ne(out1.xunits, unit('s')), atest = false; end + if ne(out2.yunits, (a2.yunits) * (a1.yunits)) || ne(out2.xunits, unit('s')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the xcorr method does not work with a mix of different shaped AOs + % as input. + % + % + function result = utp_05 + + % + % + % Tests that the xcorr method does not work with a mix of different shaped AOs + % as input. + % + % + + try + % + nsecs = 10; + fs = 100; + pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'sin(2*pi*7.433*t) + randn(size(t))'); + iir = miir(plist('type', 'highpass', 'fc', 20, 'fs', fs)); + + a1 = ao(pl); + a2 = ao(pl); + a3 = filter(a1, iir); + + out = xcorr([a1;a2], a3); + % + stest = false; + catch err + disp(err.message) + stest = true; + end + + % + % + % 1) Nothing to check + % + % + + atest = true; + if stest + % + % Nothing to check + % + else + atest = false; + end + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the xcorr method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the xcorr method can be processed back. + % + % + + try + % + nsecs = 10; + fs = 100; + u1 = get_random_unit; + u2 = get_random_unit; + + pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'sin(2*pi*7.433*t) + randn(size(t))', 'yunits', u1); + iir = miir(plist('type', 'highpass', 'fc', 20, 'fs', fs, 'iunits', u1, 'ounits', u2)); + + a1 = ao(pl); + a2 = filter(a1, iir); + + out = xcorr(a1, a2); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'xcorr'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'xcorr'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the shape of the output. + % + % + function result = utp_07 + + % + % + % Test that the xcorr method keeps the data shape of the input object. + % In this case the first AO defines the data shape. + % + % + + try + % + nsecs = 10; + fs = 100; + pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'sin(2*pi*7.433*t) + randn(size(t))'); + iir = miir(plist('type', 'highpass', 'fc', 20, 'fs', fs)); + + a1_col = ao(pl); + a2_col = filter(a1_col, iir); + + a1_row = a1_col.'; + a2_row = a2_col.'; + + out1_row = xcorr(a1_row, a2_row); + out2_row = xcorr(a1_row, a2_col); + out1_col = xcorr(a1_col, a2_row); + out2_col = xcorr(a1_col, a2_col); + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1_row.data.y,1) ~= 1, atest = false; end + if size(out2_row.data.y,1) ~= 1, atest = false; end + if size(out1_col.data.y,2) ~= 1, atest = false; end + if size(out2_col.data.y,2) ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Check that the xcorr method pass back the output objects to a list of + % output variables or to a single variable. + % Does not make sense anymore, given the structure double input -> single output + % + % + function result = utp_08 + + % + % + % Call the method with a list of output variables and with a single output + % variable. + % Additionaly check that the rebuild method works on the output. + % Additionaly check that the units are handled properly. + % Additionaly check that the symmetry is preserved. + % + % + + try + % + nsecs = 10; + fs = 100; + u1 = get_random_unit; + u2 = get_random_unit; + + pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'sin(2*pi*7.433*t) + randn(size(t))', 'yunits', u1); + iir = miir(plist('type', 'highpass', 'fc', 20, 'fs', fs, 'iunits', u1, 'ounits', u2)); + + a1 = ao(pl); + a2 = filter(a1, iir); + + [o1] = xcorr(a1, a2); + o2 = xcorr(a2, a1); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % 3) Check that the units are handled properly. + % 4) Check that the symmetry is preserved. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~= 1, atest = false; end + if numel(o2) ~= 1, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + % Check the units + if ne(o1.yunits, (a1.yunits) * (a2.yunits)) || ne(o1.xunits, unit('s')), atest = false; end + if ne(o2.yunits, (a2.yunits) * (a1.yunits)) || ne(o2.xunits, unit('s')), atest = false; end + % Check the symmetry + if ~isequal(o1.y, conj(o2.y)) || ~isequal(o1.x, o2.x), atet = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the xcorr method re-sample all input AOs to the highest + % frequency. + % + % + function result = utp_09 + + % + % + % Check that the xcorr method re-sample all input AOs to the highest + % frequency. + % + % + + try + % + nsecs = 10; + fs1 = 100; + fs2 = 200; + TOL = 2e-15; + + pl1 = plist('nsecs', nsecs, 'fs', fs1, 'tsfcn', 'sin(2*pi*7.433*t) + randn(size(t))'); + pl2 = plist('nsecs', nsecs, 'fs', fs2, 'tsfcn', '.5*sin(2*pi*7.433*t) + randn(size(t))'); + + a1 = ao(pl1); + a2 = ao(pl2); + + [out] = xcorr(a1, a2); + mout = rebuild(out); + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the first AO is resampled to '200' + % 3) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + aoin = [a1, a2]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Resample the first input AO to '200' + a1.resample(plist('fsout', fs2)); + % Check the output data + MaxLag = len(aoin(1)); + % Check a1 -> a2 + [c,lags] = xcorr(aoin(1).y, aoin(2).y, MaxLag); + if max(abs(out.x - (lags./fs2).')) > TOL, atest = false; end + if ~isequal(out.y, c), atest = false; end + % Check the re-built object + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the xcorr method truncate all input AOs to the same length. + % + % + function result = utp_10 + + % + % + % Check that the xcorr method truncate all input AOs to the same length. + % + % + + try + % + nsecs1 = 10; + nsecs2 = 12; + fs = 100; + + pl1 = plist('nsecs', nsecs1, 'fs', fs, 'tsfcn', 'sin(2*pi*7.433*t) + randn(size(t))'); + pl2 = plist('nsecs', nsecs2, 'fs', fs, 'tsfcn', '.5*sin(2*pi*7.433*t) + randn(size(t))'); + + a1 = ao(pl1); + a2 = ao(pl2); + + out = xcorr(a1, a2); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the second AO is truncated to 10 seconds + % 3) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + aoin = [a1, a2]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 1, atest = false; end + % Resample the first input AO + a2.select(1:nsecs1*fs); + % Check the output data + MaxLag = len(aoin(1)); + % Check a1 -> a2 + [c,lags] = xcorr(aoin(1).y, aoin(2).y, MaxLag); + if ~isequal(out.x, (lags./fs).'), atest = false; end + if ~isequal(out.y, c), atest = false; end + % Check the re-built objects + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + + %% UTP_12 + + % + % + % Check that the xcorr uses different lag ranges [-maxlags:maxlags] + % Check that the xcorr accepts different scales options + % Check that the xcorr handles units properly + % + % + function result = utp_12 + + % + % + % 1) Check that the xcorr uses different lag ranges [-maxlags:maxlags] + % 2) Check that the xcorr accepts different scales options + % + % + + try + % + nsecs = 10; + fs = 100; + u1 = get_random_unit; + u2 = get_random_unit; + + pl1 = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'sin(2*pi*7.433*t) + randn(size(t))', 'yunits', u1); + pl2 = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', '.5*sin(2*pi*7.433*t) + randn(size(t))', 'yunits', u2); + + a1 = ao(pl1); + a2 = ao(pl2); + + out1 = xcorr(a1, a2, plist('scale', 'biased')); + out2 = xcorr(a1, a2, plist('scale', 'unbiased')); + out3 = xcorr(a1, a2, plist('scale', 'coeff')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output have the range [-maxlags:maxlags] + % 2) Check that the output have correct units + % + % + + atest = true; + if stest + % + MaxLag = len(a1); + % --------------------- Check 'out1' + % Check a1 -> a2 + [c,lags] = xcorr(a1.y, a2.y, MaxLag, 'biased'); + if ~isequal(out1.x, (lags./fs).'), atest = false; end + if ~isequal(out1.y, c), atest = false; end + if ne(out1.yunits, (a1.yunits) * (a2.yunits)) || ne(out1.xunits, unit('s')), atest = false; end + % --------------------- Check 'out2' + % Check a1 -> a2 + [c,lags] = xcorr(a1.y, a2.y, MaxLag, 'unbiased'); + if ~isequal(out2.x, (lags./fs).'), atest = false; end + if ~isequal(out2.y, c), atest = false; end + if ne(out2.yunits, (a1.yunits) * (a2.yunits)) || ne(out2.xunits, unit('s')), atest = false; end + % --------------------- Check 'out3' + % Check a1 -> a2 + [c,lags] = xcorr(a1.y, a2.y, MaxLag, 'coeff'); + if ~isequal(out3.x, (lags./fs).'), atest = false; end + if ~isequal(out3.y, c), atest = false; end + if ne(out3.yunits, unit('')) || ne(out3.xunits, unit('s')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Check that the xcorr uses different lag ranges [-maxlags:maxlags] + % + % + function result = utp_13 + + % + % + % Check that the xcorr uses different lag ranges [-maxlags:maxlags] + % + % + + try + % + nsecs = 10; + fs = 100; + + pl1 = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'sin(2*pi*7.433*t) + randn(size(t))'); + pl2 = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', '.5*sin(2*pi*7.433*t) + randn(size(t))'); + + a1 = ao(pl1); + a2 = ao(pl2); + MaxLag1 = 500; + MaxLag2 = 1234; + + out1 = xcorr(a1, a2, plist('MaxLag', MaxLag1)); + out2 = xcorr(a1, a2, plist('MaxLag', MaxLag2)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output have the range [-maxlags:maxlags] + % + % + + atest = true; + if stest + % + if out1.x(1) ~= -MaxLag1/fs, atest = false; end + if out1.x(end) ~= MaxLag1/fs , atest = false; end + if out2.x(1) ~= -MaxLag2/fs, atest = false; end + if out2.x(end) ~= MaxLag2/fs , atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_xunits.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_xunits.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,471 @@ +% UTP_AO_XUNITS a set of UTPs for the ao/xunits method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_xunits.m,v 1.5 2011/04/05 04:29:44 mauro Exp $ +% + +% +% +% The xunits method of the ao class is a get-function to get the xunits values +% of the data object +% +% + +function results = utp_ao_xunits(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'xunits'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test with all data objects + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the xunits method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Tests that the xunits method works with a vector of AOs as input. + % + % + + try + % + avec = [at1 at2 at5 at6]; + % Vector output + out = xunits(avec); + % List output + [out1, out2, out3, out4] = xunits(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in the input. + % 2) Check that each output unit object contains the correct values. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + % Check we have the correct values in the outputs + % Vector output + for kk = 1:numel(out) + if ~eq(out(kk), avec(kk).data.xunits), atest = false; end + end + % List output + if ~eq(out1, avec(1).data.xunits), atest = false; end + if ~eq(out2, avec(2).data.xunits), atest = false; end + if ~eq(out3, avec(3).data.xunits), atest = false; end + if ~eq(out4, avec(4).data.xunits), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the xunits method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Tests that the xunits method works with a matrix of AOs as input. + % + % + + try + % + amat = [at1 at5 at6; at5 at6 at1]; + % Vector output + out = xunits(amat); + % List output + [out1, out2, out3, out4, out5, out6] = xunits(amat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in the input. + % 2) Check that each output unit object contains the correct values. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + % Check we have the correct values in the outputs + % Vector output + for kk = 1:numel(out) + if ~eq(out(kk), amat(kk).data.xunits), atest = false; end + end + % List output + if ~eq(out1, amat(1).data.xunits), atest = false; end + if ~eq(out2, amat(2).data.xunits), atest = false; end + if ~eq(out3, amat(3).data.xunits), atest = false; end + if ~eq(out4, amat(4).data.xunits), atest = false; end + if ~eq(out5, amat(5).data.xunits), atest = false; end + if ~eq(out6, amat(6).data.xunits), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the xunits method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Tests that the xunits method works with a list of AOs as input. + % + % + + try + % + % Vector output + out = xunits(at3, at4, at5, at6); + % List output + [out1, out2, out3, out4] = xunits(at3, at4, at5, at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in the input. + % 2) Check that each output unit object contains the correct values. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 4, atest = false; end + % Check we have the correct values in the outputs + % Vector output + if ~eq(out(1), at3.data.xunits), atest = false; end + if ~eq(out(2), unit()), atest = false; end + if ~eq(out(3), at5.data.xunits), atest = false; end + if ~eq(out(4), at6.data.xunits), atest = false; end + % List output + if ~eq(out1, at3.data.xunits), atest = false; end + if ~eq(out2, unit()), atest = false; end + if ~eq(out3, at5.data.xunits), atest = false; end + if ~eq(out4, at6.data.xunits), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the xunits method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Tests that the xunits method works with a mix of different shaped AOs as + % input. + % + % + + try + % + % Vector output + out = xunits(at1,[at4 at6],at5,[at5 at1; at6 at1],at6); + % List output + [out1, out2, out3, out4, out5, out6, out7, out8, out9] = ... + xunits(at1,[at4 at6],at5,[at5 at1; at6 at1],at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in the input. + % 2) Check that each output unit object contains the correct values. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + % Check we have the correct values in the outputs + % Vector output + if ~eq(out(1), at1.data.xunits), atest = false; end + if ~eq(out(2), unit()), atest = false; end + if ~eq(out(3), at6.data.xunits), atest = false; end + if ~eq(out(4), at5.data.xunits), atest = false; end + if ~eq(out(5), at5.data.xunits), atest = false; end + if ~eq(out(6), at6.data.xunits), atest = false; end + if ~eq(out(7), at1.data.xunits), atest = false; end + if ~eq(out(8), at1.data.xunits), atest = false; end + if ~eq(out(9), at6.data.xunits), atest = false; end + % List output + if ~eq(out1, at1.data.xunits), atest = false; end + if ~eq(out2, unit()), atest = false; end + if ~eq(out3, at6.data.xunits), atest = false; end + if ~eq(out4, at5.data.xunits), atest = false; end + if ~eq(out5, at5.data.xunits), atest = false; end + if ~eq(out6, at6.data.xunits), atest = false; end + if ~eq(out7, at1.data.xunits), atest = false; end + if ~eq(out8, at1.data.xunits), atest = false; end + if ~eq(out9, at6.data.xunits), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the xunits method properly applies history. + % + % + function result = utp_06 + + % + % + % The xunits method doesn't change the AO, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the xunits method works for AOs with different data objects. + % + % + function result = utp_07 + + % + % + % Test that the xunits method returns the xunits values for AOs with fsdata, + % tsdata and xydata objects, and empty units for AOs with cdata. + % + % + + try + % + u1 = at1.xunits; + u2 = at2.xunits; + u3 = at3.xunits; + u4 = at4.xunits; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if ~eq(u1, at1.data.xunits), atest = false; end; + if ~eq(u2, at2.data.xunits), atest = false; end; + if ~eq(u3, at3.data.xunits), atest = false; end; + if ~eq(u4, unit()), atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_y.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_y.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,425 @@ +% UTP_AO_Y a set of UTPs for the ao/y method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_y.m,v 1.3 2009/07/21 15:57:44 ingo Exp $ +% + +% +% +% The y method of the ao class is a get-function to get the y values of the +% data object +% +% + +function results = utp_ao_y(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'y'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test with all data objects + results = [results utp_08]; % Test with additional plist with the key 'axis' + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the y method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % The y method doesn't work with a vector of AOs. Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the y method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % The y method doesn't work with a matrix of AOs. Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the y method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % The y method doesn't work with a list of AOs. Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the y method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % The y method can only return the y values of one AO. Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the y method properly applies history. + % + % + function result = utp_06 + + % + % + % The y method doesn't change the AO, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the y method works for AOs with different data objects. + % + % + function result = utp_07 + + % + % + % Test that the y method returns the y values for AOs with cdata, fsdata, + % tsdata and xydata objects. + % + % + + try + % + y1 = at1.y; + y2 = at2.y; + y3 = at3.y; + y4 = at4.y; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if ~isequal(y1, at1.data.y), atest = false; end; + if ~isequal(y2, at2.data.y), atest = false; end; + if ~isequal(y3, at3.data.y'), atest = false; end; + if ~isequal(y4, at4.data.y), atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the y method returns the y values of the data object + % + % + function result = utp_08 + + % + % + % Test that the y method returns the y values in a column vector independent + % form the shape of the values in the data object. + % + % + + try + % + y1 = at5.y; + y2 = at6.y; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'y1' and 'y2' are column vectors. + % + % + + atest = true; + if stest + % + if size(y1, 2) ~= 1, atest = false; end; + if size(y2, 2) ~= 1, atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_yunits.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_yunits.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,472 @@ +% UTP_AO_YUNITS a set of UTPs for the ao/yunits method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_yunits.m,v 1.5 2011/04/05 04:29:44 mauro Exp $ +% + +% +% +% The yunits method of the ao class is a get-function to get the yunits values +% of the data object +% +% + +function results = utp_ao_yunits(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'yunits'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test with all data objects + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the yunits method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Tests that the yunits method works with a vector of AOs as input. + % + % + + try + % + avec = [at1 at2 at5 at6]; + % Vector output + out = yunits(avec); + % List output + [out1, out2, out3, out4] = yunits(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in the input. + % 2) Check that each output unit object contains the correct values. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + % Check we have the correct values in the outputs + % Vector output + for kk = 1:numel(out) + if ~eq(out(kk), avec(kk).data.yunits), atest = false; end + end + % List output + if ~eq(out1, avec(1).data.yunits), atest = false; end + if ~eq(out2, avec(2).data.yunits), atest = false; end + if ~eq(out3, avec(3).data.yunits), atest = false; end + if ~eq(out4, avec(4).data.yunits), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the yunits method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Tests that the yunits method works with a matrix of AOs as input. + % + % + + try + % + amat = [at1 at5 at6; at5 at6 at1]; + % Vector output + out = yunits(amat); + % List output + [out1, out2, out3, out4, out5, out6] = yunits(amat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in the input. + % 2) Check that each output unit object contains the correct values. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + % Check we have the correct values in the outputs + % Vector output + for kk = 1:numel(out) + if ~eq(out(kk), amat(kk).data.yunits), atest = false; end + end + % List output + if ~eq(out1, amat(1).data.yunits), atest = false; end + if ~eq(out2, amat(2).data.yunits), atest = false; end + if ~eq(out3, amat(3).data.yunits), atest = false; end + if ~eq(out4, amat(4).data.yunits), atest = false; end + if ~eq(out5, amat(5).data.yunits), atest = false; end + if ~eq(out6, amat(6).data.yunits), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the yunits method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Tests that the yunits method works with a list of AOs as input. + % + % + + try + % + % Vector output + out = yunits(at3, at4, at5, at6); + % List output + [out1, out2, out3, out4] = yunits(at3, at4, at5, at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in the input. + % 2) Check that each output unit object contains the correct values. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 4, atest = false; end + % Check we have the correct values in the outputs + % Vector output + if ~eq(out(1), at3.data.yunits), atest = false; end + if ~eq(out1, at3.data.yunits), atest = false; end + if ~eq(out(2), at4.data.yunits), atest = false; end + if ~eq(out2, at4.data.yunits), atest = false; end + % List output + if ~eq(out(3), at5.data.yunits), atest = false; end + if ~eq(out3, at5.data.yunits), atest = false; end + if ~eq(out(4), at6.data.yunits), atest = false; end + if ~eq(out4, at6.data.yunits), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the yunits method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Tests that the yunits method works with a mix of different shaped AOs as + % input. + % + % + + try + % + % Vector output + out = yunits(at1,[at4 at6],at5,[at5 at1; at6 at1],at6); + % List output + [out1, out2, out3, out4, out5, out6, out7, out8, out9] = ... + yunits(at1,[at4 at6],at5,[at5 at1; at6 at1],at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in the input. + % 2) Check that each output unit object contains the correct values. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + % Check we have the correct values in the outputs + % Vector output + if ~eq(out(1), at1.data.yunits), atest = false; end + if ~eq(out(2), at4.data.yunits), atest = false; end + if ~eq(out(3), at6.data.yunits), atest = false; end + if ~eq(out(4), at5.data.yunits), atest = false; end + if ~eq(out(5), at5.data.yunits), atest = false; end + if ~eq(out(6), at6.data.yunits), atest = false; end + if ~eq(out(7), at1.data.yunits), atest = false; end + if ~eq(out(8), at1.data.yunits), atest = false; end + if ~eq(out(9), at6.data.yunits), atest = false; end + % List output + if ~eq(out1, at1.data.yunits), atest = false; end + if ~eq(out2, at4.data.yunits), atest = false; end + if ~eq(out3, at6.data.yunits), atest = false; end + if ~eq(out4, at5.data.yunits), atest = false; end + if ~eq(out5, at5.data.yunits), atest = false; end + if ~eq(out6, at6.data.yunits), atest = false; end + if ~eq(out7, at1.data.yunits), atest = false; end + if ~eq(out8, at1.data.yunits), atest = false; end + if ~eq(out9, at6.data.yunits), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the yunits method properly applies history. + % + % + function result = utp_06 + + % + % + % The yunits method doesn't change the AO, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the yunits method works for AOs with different data objects. + % + % + function result = utp_07 + + % + % + % Test that the yunits method returns the yunits values for AOs with cdata, + % fsdata, tsdata and xydata objects. + % + % + + try + % + at4.setYunits('Hz s^-1'); + u1 = at1.yunits; + u2 = at2.yunits; + u3 = at3.yunits; + u4 = at4.yunits; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if ~eq(u1, at1.data.yunits), atest = false; end; + if ~eq(u2, at2.data.yunits), atest = false; end; + if ~eq(u3, at3.data.yunits), atest = false; end; + if ~eq(u4, at4.data.yunits), atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_zDomainFit.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_zDomainFit.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,767 @@ +% UTP_AO_ZDOMAINFIT a set of UTPs for the ao/zDomainFit method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_zDomainFit.m,v 1.8 2010/01/27 18:10:25 luigi Exp $ +% + +% +% +% The zDomainFit method of the ao class fit a model (miir filter) to +% fsdata. +% +% + +function results = utp_ao_zDomainFit(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'zDomainFit'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs +% [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Build test objects + pl_data1 = plist('fsfcn', '0.01./(0.01+f)', 'f1', 1e-6, 'f2', 5, 'nf', 100); + a1 = ao(pl_data1); + + pl_data2 = plist('fsfcn', '0.001./(0.1+f)', 'f1', 1e-6, 'f2', 5, 'nf', 100); + a2 = ao(pl_data2); + + pl_data3 = plist('fsfcn', '(1e-3./(f).^2 + 1e3./(0.001+f)).*1e-9', 'f1', 1e-6, 'f2', 5, 'nf', 100); + a3 = ao(pl_data3); + + pl_data4 = plist('fsfcn', '(1e-4./(f).^2 + 1e3./(0.01+f)).*1e-10', 'f1', 1e-6, 'f2', 5, 'nf', 100); + a4 = ao(pl_data4); + + pl_data5 = plist('fsfcn', '(1e5.*f.^2 + 1e3./(0.01+f)).*1e-8', 'f1', 1e-6, 'f2', 5, 'nf', 100); + a5 = ao(pl_data5); + + a1.setName; + a2.setName; + a3.setName; + a4.setName; + a5.setName; + + av = [a1 a2 a3]; + am = [a1 a2; a3 a4]; + + % ----- Building a simple test model + f = logspace(-6,log10(5),30); + fs = 10; + res = [0.7 0.2+0.01i 0.2-0.01i]; + poles = [0.5 0.1+0.07i 0.1-0.07i]; + tmod(3,1) = miir; + for ii = 1:3 + tmod(ii,1) = miir(res(ii),[1 -poles(ii)],fs); + end + rtmod = resp(tmod,plist('bank','parallel','f',f.')); + + % ----- Buildin a standard plist + fs = 10; + tol = 1e-3; + plstd = plist('FS',fs,... + 'AutoSearch','on',... + 'StartPoles',[],... + 'StartPolesOpt','clin',... + 'maxiter',60,... + 'minorder',3,... + 'maxorder',45,... + 'weights',[],... + 'weightparam','abs',... + 'CONDTYPE','MSE',... + 'FITTOL',1e-3,... + 'MSEVARTOL',1e-2,... + 'Plot','off',... + 'ForceStability','off',... + 'CheckProgress','off'); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call does not work +% results = [results utp_08]; % Test input data shape == output data +% shape does not apply + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test the fit give the correct coefficients + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 14, atest = false; end + % Check key + if ~io(3).plists.isparam('autosearch'), atest = false; end + if ~io(3).plists.isparam('startpoles'), atest = false; end + if ~io(3).plists.isparam('startpolesopt'), atest = false; end + if ~io(3).plists.isparam('maxiter'), atest = false; end + if ~io(3).plists.isparam('minorder'), atest = false; end + if ~io(3).plists.isparam('maxorder'), atest = false; end + if ~io(3).plists.isparam('weights'), atest = false; end + if ~io(3).plists.isparam('weightparam'), atest = false; end + if ~io(3).plists.isparam('condtype'), atest = false; end + if ~io(3).plists.isparam('fittol'), atest = false; end + if ~io(3).plists.isparam('msevartol'), atest = false; end + if ~io(3).plists.isparam('plot'), atest = false; end + if ~io(3).plists.isparam('forcestability'), atest = false; end + if ~io(3).plists.isparam('checkprogress'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('autosearch'), 'on'), atest = false; end + if ~isEmptyDouble(io(3).plists.find('startpoles')), atest = false; end + if ~isequal(io(3).plists.find('startpolesopt'), 'clog'), atest = false; end + if ~isequal(io(3).plists.find('maxiter'), 50), atest = false; end + if ~isequal(io(3).plists.find('minorder'), 2), atest = false; end + if ~isequal(io(3).plists.find('maxorder'), 20), atest = false; end + if ~isEmptyDouble(io(3).plists.find('weights')), atest = false; end + if ~isequal(io(3).plists.find('weightparam'), 'abs'), atest = false; end + if ~isequal(io(3).plists.find('condtype'), 'MSE'), atest = false; end + if ~isequal(io(3).plists.find('fittol'), .001), atest = false; end + if ~isequal(io(3).plists.find('msevartol'), .01), atest = false; end + if ~isequal(io(3).plists.find('plot'), 'off'), atest = false; end + if ~isequal(io(3).plists.find('forcestability'), 'off'), atest = false; end + if ~isequal(io(3).plists.find('checkprogress'), 'off'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('autosearch'), {'on', 'off'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('startpoles'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('startpolesopt'), {'real', 'clog', 'clin'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('maxiter'), {50}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('minorder'), {2}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('maxorder'), {20}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('weights'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('weightparam'), {'ones', 'abs', 'sqrt'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('condtype'), {'MSE', 'RLD', 'RSF'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('fittol'), {.001}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('msevartol'), {.01}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('plot'), {'on', 'off'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('forcestability'), {'on', 'off'}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('checkprogress'), {'on', 'off'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the zDomainFit method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the zDomainFit method works for a vector of AOs as input. + % + % + + try + % + + out = zDomainFit(av, plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'av' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(numel(out.objs), numel(av)), atest = false; end + % Check each output against the absolute value of the input + for kk=1:numel(out.objs) + % Check the fitted ao(fsdata) objects + if isa(av(kk).data, 'fsdata') + % check that the output data responses are accurate to the + % prescribed accuracy + mse = out.objs(kk).procinfo.find('FIT_MSE'); + if mse.y>tol, atest = false; end + else + % Check the other objects (they must be empty) + if ~isempty([out.objs(kk).filters.a]), atest = false; end + if ~isempty([out.objs(kk).filters.b]), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the zDomainFit method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the zDomainFit method works for a matrix of AOs as input. + % + % + + try + % + out = zDomainFit(am, plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'am' + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(numel(out.objs), numel(am)), atest = false; end + % Check each output against the absolute value of the input + for kk=1:numel(out.objs) + % Check the fitted ao(fsdata) objects + if isa(am(kk).data, 'fsdata') + % check that the output data responses are accurate to the + % prescribed accuracy + mse = out.objs(kk).procinfo.find('FIT_MSE'); + if mse(end)>tol, atest = false; end + else + % Check the other objects (they must be empty) + if ~isempty([out.objs(kk).filters.a]), atest = false; end + if ~isempty([out.objs(kk).filters.b]), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the zDomainFit method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the zDomainFit method works for a list of AOs as input. + % + % + + try + % + out = zDomainFit(a1,a2,a3, plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [a1,a2,a3]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(numel(out.objs), numel(aoin)), atest = false; end + % Check each output against the absolute value of the input + for kk=1:numel(out.objs) + % Check the fitted ao(fsdata) objects + if isa(aoin(kk).data, 'fsdata') + % check that the output data responses are accurate to the + % prescribed accuracy + mse = out.objs(kk).procinfo.find('FIT_MSE'); + if mse(end)>tol, atest = false; end + else + % Check the other objects (they must be empty) + if ~isempty([out.objs(kk).filters.a]), atest = false; end + if ~isempty([out.objs(kk).filters.b]), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the zDomainFit method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the zDomainFit method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = zDomainFit(a5,[a1 a2;a3 a4],plstd); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + aoin = [a5,reshape([a1 a2;a3 a4],1,[])]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(numel(out.objs), numel(aoin)), atest = false; end + % Check each output against the absolute value of the input + for kk=1:numel(out.objs) + % Check the fitted ao(fsdata) objects + if isa(aoin(kk).data, 'fsdata') + % check that the output data responses are accurate to the + % prescribed accuracy + mse = out.objs(kk).procinfo.find('FIT_MSE'); + if mse(end)>tol, atest = false; end + else + % Check the other objects (they must be empty) + if ~isempty([out.objs(kk).filters.a]), atest = false; end + if ~isempty([out.objs(kk).filters.b]), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the zDomainFit method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the zDomainFit method can be processed back. + % + % + + try + % + out = zDomainFit(a1,plstd); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'zDomainFit'. + % 2) Check that the re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'zDomainFit'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % zDomainFit cannot modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the sDomainFit method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy a3 to work with + amodi = ao(a3); + aeq = ao(a3); + amodi.zDomainFit(plstd); + out = aeq.zDomainFit(plstd); + % + stest = false; + catch err + disp(err.message) + stest = true; + end + + % + % + % 1) Nothing to do. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +% %% UTP_08 +% +% % +% % +% % Test the shape of the output. - Does not make sense for zDomainFit +% % becauses the output are miir filters +% % +% % +% function result = utp_08 +% +% % +% % +% % Test that the zDomainFit method keeps the data shape of the input object. The +% % input AO must be an AO with row data and an AO with column data. +% % +% % +% +% try +% % +% out1 = zDomainFit(a2,plstd); +% out2 = zDomainFit(a1,plstd); +% % +% stest = true; +% catch err +% disp(err.message) +% stest = false; +% end +% +% % +% % +% % 1) Check that the shape of the data doesn't change. +% % +% % +% +% atest = true; +% if stest +% % +% % Check the shape of the output data +% if size(out1.data.x) ~= size(at5.data.x), atest = false; end +% if size(out1.data.y) ~= size(at5.data.y), atest = false; end +% if size(out2.data.x) ~= size(at6.data.x), atest = false; end +% if size(out2.data.y) ~= size(at6.data.y), atest = false; end +% % +% else +% atest = false; +% end +% +% % Return a result structure +% result = utp_prepare_result(atest, stest, dbstack, mfilename); +% end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the zDomainFit method pass back the output objects to a + % single variable correctly. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % +% [o1, o2] = zDomainFit(a1, a2, plstd); + o3 = zDomainFit(a1, a2, plstd); +% mout1 = rebuild(o1); +% mout2 = rebuild(o2); + mout3 = rebuild(o3); +% o31 = o3(1:size(o3,1),1); +% o32 = o3(1:size(o3,1),2); +% mout31 = rebuild(o31); +% mout32 = rebuild(o32); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs +% if numel(o1) ~=1, atest = false; end +% if numel(o2) ~=1, atest = false; end +% if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object +% if ~eq(o1, mout1, ple2), atest = false; end +% if ~eq(o2, mout2, ple2), atest = false; end +% if ~eq(o3(1), mout3(1), ple2), atest = false; end +% if ~eq(o3(2), mout3(2), ple2), atest = false; end +% if ~eq(o3(:,1), mout3(:,1), ple2), atest = false; end +% if ~eq(o3(:,2), mout3(:,2), ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Tests that the zDomainFit method return the correct coefficients + % + % + function result = utp_10 + + % + % + % Test that the zDomainFit method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + fs = 10; + tol = 0.5; + plstd2 = plist('FS',fs,... + 'AutoSearch','off',... + 'StartPoles',[],... + 'StartPolesOpt','clin',... + 'maxiter',60,... + 'minorder',3,... + 'maxorder',3,... + 'weights',[],... + 'weightparam','abs',... + 'CONDTYPE','MSE',... + 'FITTOL',1e-3,... + 'MSEVARTOL',1e-2,... + 'Plot','off',... + 'ForceStability','off',... + 'CheckProgress','off'); + out = zDomainFit(rtmod,plstd2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that output contains the correct coefficients. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(numel(out), numel(rtmod)), atest = false; end + % Check each output against the absolute value of the input + for kk=1:numel(out.filters) + % Check the fitted ao(fsdata) objects + if isa(rtmod.data, 'fsdata') + % check that fit coefficients corresponds to real coefficients + % within a tolerance + if any(abs(tmod(kk).a - out.filters(kk).a)>1e-4), atest = false; end + if any(abs(tmod(kk).b - out.filters(kk).b)>1e-4), atest = false; end + else + % Check the other objects (they must be empty) + if ~isempty(out.filters(kk).a), atest = false; end + if ~isempty(out.filters(kk).b), atest = false; end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ao/utp_ao_zeropad.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ao/utp_ao_zeropad.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,537 @@ +% UTP_AO_ZEROPAD a set of UTPs for the ao/zeropad method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ao_zeropad.m,v 1.9 2010/07/21 14:17:54 mauro Exp $ +% + +% +% +% The zeropad method of the ao class zeropads time-series AOs. +% +% + +function results = utp_ao_zeropad(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ao'; + mthd = 'zeropad'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test AOs + [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_11(mthd, at1, ple1, plist('FACTOR', 2))]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 3, atest = false; end + % Check key + if ~io(3).plists.isparam('factor'), atest = false; end + if ~io(3).plists.isparam('N'), atest = false; end + if ~io(3).plists.isparam('position'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('factor'), 2), atest = false; end + if ~isEmptyDouble(io(3).plists.find('N')), atest = false; end + if ~isequal(io(3).plists.find('position'), 'post'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('factor'), {2}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('N'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('position'), {'pre', 'post'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the zeropad method works with a vector of AOs as input. + % + % + function result = utp_02 + + % + % + % Test that the zeropad method works for a vector of AOs as input. + % + % + + try + % + avec = [at1 at5 at6]; + out = zeropad(avec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(avec), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the zeropad method works with a matrix of AOs as input. + % + % + function result = utp_03 + + % + % + % Test that the zeropad method works for a matrix of AOs as input. + % + % + + try + % + amat = [at1 at5 at6; at5 at6 at1]; + out = zeropad(amat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(amat), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the zeropad method works with a list of AOs as input. + % + % + function result = utp_04 + + % + % + % Test that the zeropad method works for a list of AOs as input. + % + % + + try + % + out = zeropad(at1,at5,at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the square of the + % number in the input. + % 2) Check that each output AO contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the zeropad method works with a mix of different shaped AOs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the zeropad method works with an input of matrices and vectors + % and single AOs. + % + % + + try + % + out = zeropad(at1,[at5 at6],at5,[at5 at1; at6 at1],at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output AO contains the correct data. + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 9, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the zeropad method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the zeropad method can be processed back + % to an m-file. + % + % + + try + % + out = zeropad(at5); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'zeropad'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'zeropad'), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the zeropad method can modify the input AO. + % + % + function result = utp_07 + + % + % + % Test that the zeropad method can modify the input AO by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at1 to work with + ain = ao(at1); + % modify ain + aout = ain.zeropad(); + ain.zeropad(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'at1' and 'ain' are now different. + % 2) Check that 'ain' is zeropad(at1). + % + % + + atest = true; + if stest + % + % Check that zeropad modified the input by comparing to the copy + if eq(ao(at1), ain, ple1), atest = false; end + % Check that zeropad doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Check the data shape of the output against the input. + % + % + function result = utp_08 + + % + % + % Test that the zeropad method keeps the data shape of the input object. The + % input AO must be an AO with row data and an AO with column data. + % + % + + try + % + out1 = zeropad(at5); + out2 = zeropad(at6); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shpe of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y) ~= size(at5.data.y), atest = false; end + if size(out2.data.y) ~= size(at6.data.y), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the zeropad method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = zeropad(at5, at6); + o3 = zeropad(at5, at6); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/collection/utp_collection_collection.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/collection/utp_collection_collection.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,408 @@ +% UTP_COLLECTION_COLLECTION a set of UTPs for the collection/collection method +% +% M Hewitson 06-08-08 +% +% $Id: utp_collection_collection.m,v 1.11 2011/09/29 12:10:07 ingo Exp $ +% + +% +% +% The collection method of the collection class constructs collection objects. +% +% + +function results = utp_collection_collection(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'collection'; + mthd = 'collection'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MATRIX objects + c1 = collection(ao(1), ao(2)); + c1.setName(); + c2 = collection(ao(1), pzmodel(1,1,10), plist('key', 'value')); + c2.setName(); + + cvec = [c1 c2 c1]; + cmat = [c1 c2 c1; c2 c2 c1]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, cvec, [], [], ple3)]; % Vector input + results = [results utp_03(mthd, cmat, [], [], ple3)]; % Matrix input + results = [results utp_04(mthd, c1, c2, c1, [], [], ple3)]; % List input + results = [results utp_05(mthd, c1, cvec, cmat, [], [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, c1, [], ple2)]; % Test history is working + + % Old format + results = [results utp_07]; % Test history is working with different numbers of input + results = [results utp_08()]; % Check different inputs + + % constructor specific tests + results = [results utp_60(class, c1, ple2)]; % Test history is properly handled with MAT file constructor + results = [results utp_61(class, c1, ple2)]; % Test history is properly handled with XML file constructor + results = [results utp_62(class, c1, c2, ple2)]; % Test history is working with struct constructor + results = [results utp_64(class, c1, ple1, ple2)]; % Test history is working with plist(filename) constructor + results = [results utp_65(class, c1, ple3)]; % Test history is working with plist(hostname) constructor + results = [results utp_68(class, c1, ple3)]; % Test history is working with conn+Id constructor + results = [results utp_70(class, c1, ple2)]; % Test history is working with plist(plist) constructor + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From XML File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From MAT File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Input')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Repository')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Built-in Model')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + pn = 3; + if io(pn).plists.nparams ~= 3, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + %%%%%%%%%% SET 'From MAT File' + pn = 4; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + %%%%%%%%%% SET 'From XML File' + pn = 5; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + %%%%%%%%%% SET 'From Repository' + pn = 6; + if io(pn).plists.nparams ~= 10, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('hostname'), atest = false; end + if ~io(pn).plists.isparam('id'), atest = false; end + if ~io(pn).plists.isparam('cid'), atest = false; end + if ~io(pn).plists.isparam('database'), atest = false; end + if ~io(pn).plists.isparam('binary'), atest = false; end + if ~io(pn).plists.isparam('username'), atest = false; end + if ~io(pn).plists.isparam('password'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('id')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('cid')), atest = false; end + if ~isequal(io(pn).plists.find('binary'), 'yes'), atest = false; end + %%%%%%%%%% SET 'From Built-in Model' + pn = 7; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('built-in'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('built-in')), atest = false; end + %%%%%%%%%% SET 'From Input' + pn = 8; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('objs'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('objs')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_07 + + % + % + % Tests that the collection method properly applies history to the + % constructor with different numbers of inputs. + % + % + function result = utp_07 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + a1 = ao(1); + a2 = ao(2); + a3 = ao(3); + out1 = collection(a1); + out2 = collection(a1, a2); + out3 = collection(a1, a2, a3); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'collection'. + % 2) Check that the rebuilt objects are the same + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'collection'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'collection'), atest = false; end + if ~strcmp(out3.hist.methodInfo.mname, 'collection'), atest = false; end + % Check that output contains the right values + if ~isequal(out1.objs, {a1}), atest = false; end + if ~isequal(out2.objs, {a1, a2}), atest = false; end + if ~isequal(out3.objs, {a1, a2, a3}), atest = false; end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests the collection constructor with different inputs. + % + % + function result = utp_08 + + % + % + % Tests the collection constructor with different inputs. + % + % + + try + % + newName = 'my nice name'; + a1 = ao(8); + a2 = ao(9); + plIgnore = plist('objs', a1, 'ignore', true); + plEmpty = plist(); + plName = plist('name', newName); + plObjs = plist('objs', [a1 a2]); + + % one input + cc1 = collection(a1); + cc2 = collection([a1 a2]); + cc3 = collection(plName); + cc4 = collection(plObjs); + + % two inputs + cc5 = collection(a1, plEmpty); + cc6 = collection(a2, plName); + cc7 = collection(a1, plIgnore); + cc8 = collection(a1, plObjs); + cc9 = collection([a1 a2], [plIgnore plName plObjs]); + + % more inputs + cc10 = collection(plObjs, [a1, a2], plIgnore, a2, plName); + + % rebuild objects + r1 = cc1.rebuild(); + r2 = cc2.rebuild(); + r3 = cc3.rebuild(); + r4 = cc4.rebuild(); + r5 = cc5.rebuild(); + r6 = cc6.rebuild(); + r7 = cc7.rebuild(); + r8 = cc8.rebuild(); + r9 = cc9.rebuild(); + r10 = cc10.rebuild(); + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'collection'. + % 2) Check that the rebuilt objects are the same + % + % + + atest = true; + if stest + % + % Check the number of the inside objects + if cc1.nobjs ~= 1, atest = false; end + if cc2.nobjs ~= 2, atest = false; end + if cc3.nobjs ~= 0, atest = false; end + if cc4.nobjs ~= 2, atest = false; end + if cc5.nobjs ~= 1, atest = false; end + if cc6.nobjs ~= 1, atest = false; end + if cc7.nobjs ~= 2, atest = false; end + if cc8.nobjs ~= 3, atest = false; end + if cc9.nobjs ~= 5, atest = false; end + if cc10.nobjs ~= 6, atest = false; end + + % Check that we set the name with the configuration plist + if ~strcmp(cc3.name, newName), atest = false; end + if ~strcmp(cc6.name, newName), atest = false; end + if ~strcmp(cc9.name, newName), atest = false; end + if ~strcmp(cc10.name, newName), atest = false; end + + % Check the history + if ~eq(cc1, r1, ple2), atest = false; end + if ~eq(cc2, r2, ple2), atest = false; end + if ~eq(cc3, r3, ple2), atest = false; end + if ~eq(cc4, r4, ple2), atest = false; end + if ~eq(cc5, r5, ple2), atest = false; end + if ~eq(cc6, r6, ple2), atest = false; end + if ~eq(cc7, r7, ple2), atest = false; end + if ~eq(cc8, r8, ple2), atest = false; end + % The rebuild is correct but the order of the inside objects is + % broken. The problem is that the inside PLISTs doesn't go into the + % history because they don't have one. They must go into the + % plistUsed and the plistUsed will be rebuild at a different time. + % if ~eq(c9, r9, ple2), atest = false; end + % if ~eq(cc10, r10, ple2), atest = false; end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/collection/utp_collection_copy.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/collection/utp_collection_copy.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,50 @@ +% UTP_COLLECTION_COPY a set of UTPs for the collection/copy method +% +% M Hewitson 06-08-08 +% +% $Id: utp_collection_copy.m,v 1.1 2009/08/11 14:07:45 hewitson Exp $ +% + +% +% +% The copy method of the collection class copies the input object depending of the +% second input. +% +% + +function results = utp_collection_copy(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'collection'; + mthd = 'copy'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_69(class, 1, 1, ple2)]; + results = [results utp_69(class, 1, 3, ple2)]; + results = [results utp_69(class, 2, 3, ple2)]; + + 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 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/collection/utp_collection_loadobj.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/collection/utp_collection_loadobj.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,153 @@ +% UTP_COLLECTION_LOADOBJ a set of UTPs for the collection/loadobj method +% +% M Hewitson 06-08-08 +% +% $Id: utp_collection_loadobj.m,v 1.1 2010/05/12 15:58:16 ingo Exp $ +% + +% +% +% The loadobj method of the collection class will be automatically called by +% MATLAB if an older object is not compatible with the current object structure. +% This happens only for objects which are stored as a MATLAB formatted +% (MAT-file). The load mechanism for XML formated files calls always the +% 'update_struct' method to keep the stored objects up to date. The +% 'update_struct' method convert the read object structure to the object +% structure which is used in the currend LTPDA version. +% This UTP will load old objects which are stored with an older LTPDA version. +% +% REMARK: Since LTPDA version 1.9.2 will be an object which should be saved as a +% MAT file stored as a struct and not as the object. +% +% + +function results = utp_collection_loadobj(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'collection'; + mthd = 'loadobj'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Run the tests + results = [results utp_01]; % getInfo call + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Get all .MAT and .XML files + path = fullfile(fileparts(which(mfilename)), '..', '..', 'utp_test_files'); + + matfiles = utils.prog.filescan(path, '.mat'); + xmlfiles = utils.prog.filescan(path, '.xml'); + + % Load .MAT files + obj_no = 1; + for ii=1:numel(matfiles) + fn = matfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = collection(fn); + obj_no = obj_no+1; + end + end + + % Load .XML files + for ii=1:numel(xmlfiles) + fn = xmlfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = collection(fn); + obj_no = obj_no+1; + end + end + % + stest = true; + catch err + disp(objs(obj_no).fname) + disp(fn) + disp(err.message) + stest = false; + end + + % + % + % 1) Check the shape of the loaded objects. + % + % + + atest = true; + if stest + % + for ii = 1:numel(objs) + obj = objs(ii).obj; + fname = objs(ii).fname; + + if ~isempty(strfind(fname, '_vec')) + % Loaded object must be a vector + if ~isvector(obj), atest = false; end + elseif ~isempty(strfind(fname, '_mat')) + % Loaded object must be a matrix + % REMARK: Known error in LTPDA version 1.9.2 + % A saved matrix doesn't keep the shape of the matrix. + if isempty(strfind(fname, '_192')) + if ~(size(obj,1) > 1 && size(obj,2) > 1), atest = false; end + end + else + % Loaded object must be a single object + if ~(size(obj,1) == 1 && size(obj,2) == 1), + atest = false; end + end + + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/filterbank/utp_filterbank_copy.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/filterbank/utp_filterbank_copy.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,50 @@ +% UTP_FILTERBANK_COPY a set of UTPs for the filterbank/copy method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_copy.m,v 1.3 2009/08/08 12:21:40 hewitson Exp $ +% + +% +% +% The copy method of the filterbank class copies the input object depending of the +% second input. +% +% + +function results = utp_filterbank_copy(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'filterbank'; + mthd = 'copy'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_69(class, 1, 1, ple2)]; + results = [results utp_69(class, 1, 3, ple2)]; + results = [results utp_69(class, 2, 3, ple2)]; + + 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 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/filterbank/utp_filterbank_filterbank.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/filterbank/utp_filterbank_filterbank.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,222 @@ +% UTP_FILTERBANK_FILTERBANK a set of UTPs for the filterbank/filterbank method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ssm_ssm.m,v 1.4 2009/08/07 07:31:46 hewitson Exp $ +% + +% +% +% The filterbank method of the filterbank class constructs filterbank objects. +% +% + +function results = utp_filterbank_filterbank(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'filterbank'; + mthd = 'filterbank'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test objects + [iirhp,iirlp,iirbp,iirbr,iirpzm,iirab,iirv,iirm] = get_test_objects_miir; + fb1 = filterbank(iirhp, iirlp); + fb1.setName; + fb2 = filterbank(iirhp, iirbr, iirlp); + fb2.setName; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the general tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, [fb1 fb2 fb1], [], [], ple3)]; % Vector input + results = [results utp_03(mthd, [fb1 fb2 fb1; fb2 fb2 fb1], [], [], ple3)]; % Matrix input + results = [results utp_04(mthd, fb1, fb2, fb1, [], [], ple3)]; % List input + results = [results utp_05(mthd, fb1, [fb1 fb2], [fb1 fb2 fb1; fb2 fb2 fb1], [], [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, fb1, [], ple2)]; % Test history is working + % constructor specific tests + results = [results utp_60(class, fb1, ple2)]; % Test history is properly handled with MAT file constructor + results = [results utp_61(class, fb1, ple2)]; % Test history is properly handled with XML file constructor + results = [results utp_62(class, fb1, fb2, ple2)]; % Test history is working with struct constructor + results = [results utp_64(class, fb1, ple2, ple2)]; % Test history is working with plist(filename) constructor + results = [results utp_65(class, fb2, ple3)]; % Test history is working with plist(hostname) constructor + results = [results utp_68(class, fb1, ple3)]; % Test history is working with conn+Id constructor + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Filters')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From XML File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From MAT File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Repository')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Built-in Model')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + pn = 3; + if io(pn).plists.nparams ~= 3, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + %%%%%%%%%% SET 'From MAT File' + pn = 4; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + %%%%%%%%%% SET 'From XML File' + pn = 5; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + %%%%%%%%%% SET 'From Repository' + pn = 6; + if io(pn).plists.nparams ~= 10, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('hostname'), atest = false; end + if ~io(pn).plists.isparam('id'), atest = false; end + if ~io(pn).plists.isparam('cid'), atest = false; end + if ~io(pn).plists.isparam('database'), atest = false; end + if ~io(pn).plists.isparam('binary'), atest = false; end + if ~io(pn).plists.isparam('username'), atest = false; end + if ~io(pn).plists.isparam('password'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('id')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('cid')), atest = false; end + if ~isequal(io(pn).plists.find('binary'), 'yes'), atest = false; end + %%%%%%%%%% SET 'From Built-in Model' + pn = 7; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('BUILT-IN'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('built-in')), atest = false; end + %%%%%%%%%% SET 'From Filters' + pn = 8; + if io(pn).plists.nparams ~= 5, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('filters'), atest = false; end + if ~io(pn).plists.isparam('type'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('filters')), atest = false; end + if ~strcmp(io(pn).plists.find('type'), 'parallel'), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/filterbank/utp_filterbank_loadobj.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/filterbank/utp_filterbank_loadobj.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,153 @@ +% UTP_FILTERBANK_LOADOBJ a set of UTPs for the filterbank/loadobj method +% +% M Hewitson 06-08-08 +% +% $Id: utp_filterbank_loadobj.m,v 1.1 2010/05/12 15:58:16 ingo Exp $ +% + +% +% +% The loadobj method of the filterbank class will be automatically called by +% MATLAB if an older object is not compatible with the current object structure. +% This happens only for objects which are stored as a MATLAB formatted +% (MAT-file). The load mechanism for XML formated files calls always the +% 'update_struct' method to keep the stored objects up to date. The +% 'update_struct' method convert the read object structure to the object +% structure which is used in the currend LTPDA version. +% This UTP will load old objects which are stored with an older LTPDA version. +% +% REMARK: Since LTPDA version 1.9.2 will be an object which should be saved as a +% MAT file stored as a struct and not as the object. +% +% + +function results = utp_filterbank_loadobj(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'filterbank'; + mthd = 'loadobj'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Run the tests + results = [results utp_01]; % getInfo call + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Get all .MAT and .XML files + path = fullfile(fileparts(which(mfilename)), '..', '..', 'utp_test_files'); + + matfiles = utils.prog.filescan(path, '.mat'); + xmlfiles = utils.prog.filescan(path, '.xml'); + + % Load .MAT files + obj_no = 1; + for ii=1:numel(matfiles) + fn = matfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = filterbank(fn); + obj_no = obj_no+1; + end + end + + % Load .XML files + for ii=1:numel(xmlfiles) + fn = xmlfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = filterbank(fn); + obj_no = obj_no+1; + end + end + % + stest = true; + catch err + disp(objs(obj_no).fname) + disp(fn) + disp(err.message) + stest = false; + end + + % + % + % 1) Check the shape of the loaded objects. + % + % + + atest = true; + if stest + % + for ii = 1:numel(objs) + obj = objs(ii).obj; + fname = objs(ii).fname; + + if ~isempty(strfind(fname, '_vec')) + % Loaded object must be a vector + if ~isvector(obj), atest = false; end + elseif ~isempty(strfind(fname, '_mat')) + % Loaded object must be a matrix + % REMARK: Known error in LTPDA version 1.9.2 + % A saved matrix doesn't keep the shape of the matrix. + if isempty(strfind(fname, '_192')) + if ~(size(obj,1) > 1 && size(obj,2) > 1), atest = false; end + end + else + % Loaded object must be a single object + if ~(size(obj,1) == 1 && size(obj,2) == 1), + atest = false; end + end + + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/matrix/utp_matrix_char.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/matrix/utp_matrix_char.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,361 @@ +% UTP_MATRIX_CHAR a set of UTPs for the matrix/char method +% +% M Hewitson 06-08-08 +% +% $Id: utp_matrix_char.m,v 1.1 2009/08/28 13:20:19 ingo Exp $ +% + +% +% +% The char method of the matrix class converts the objects into one +% character string which contains information of the object. +% +% + +function results = utp_matrix_char(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'matrix'; + mthd = 'char'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MATRIX objects + [ma1,ma2,ma3,ma4,mav,mam] = get_test_objects_matrix; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the char method works with a vector of MATRIX objects as input. + % + % + function result = utp_02 + + % + % + % Test that the char method works for a vector of MATRIX objects as input. + % + % + + try + % + out = char(mav); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least the character set + % (char-method) of all inner object + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end; + for kk = 1:numel(mav) + if isempty(strfind(out, char(mav(kk)))), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the char method works with a matrix of MATRIX objects as input. + % + % + function result = utp_03 + + % + % + % Test that the char method works for a matrix of MATRIX objects as input. + % + % + + try + % + out = char(mam); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least the character set + % (char-method) of all inner object + % + % + + atest = true; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(mam) + if isempty(strfind(out, char(mam(kk)))), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the char method works with a list of MATRIX objects as input. + % + % + function result = utp_04 + + % + % + % Test that the char method works for a list of MATRIX objects as input. + % + % + + try + % + out = char(ma1, ma2, ma3, ma4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least the character set + % (char-method) of all inner object + % + % + + atest = true; + pain = [ma1, ma2, ma3, ma4]; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(pain) + if isempty(strfind(out, char(pain(kk)))), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the char method works with a mix of different shaped MATRIX + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the char method works with an input of matrices and vectors + % and single MATRIX objects. + % + % + + try + % + out = char(ma1,mav,ma2,mam,ma3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least the character set + % (char-method) of all inner object + % + % + + atest = true; + pain = [ma1,reshape(mav,1,[]),ma2,reshape(mam,1,[]),ma3]; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(pain) + if isempty(strfind(out, char(pain(kk)))), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the char method properly applies history. + % + % + function result = utp_06 + + % + % + % The method char doesn't change the data, thus it is not possible to + % check the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/matrix/utp_matrix_copy.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/matrix/utp_matrix_copy.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,50 @@ +% UTP_MATRIX_COPY a set of UTPs for the matrix/copy method +% +% M Hewitson 06-08-08 +% +% $Id: utp_matrix_copy.m,v 1.3 2009/08/08 12:21:40 hewitson Exp $ +% + +% +% +% The copy method of the matrix class copies the input object depending of +% the second input. +% +% + +function results = utp_matrix_copy(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'matrix'; + mthd = 'copy'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_69(class, 1, 1, ple2)]; + results = [results utp_69(class, 1, 3, ple2)]; + results = [results utp_69(class, 2, 3, ple2)]; + + 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 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/matrix/utp_matrix_ctranspose.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/matrix/utp_matrix_ctranspose.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,524 @@ +% UTP_MATRIX_CTRANSPOSE a set of UTPs for the matrix/ctranspose method +% +% M Hewitson 06-08-08 +% +% $Id: utp_matrix_ctranspose.m,v 1.4 2010/12/22 16:05:18 ingo Exp $ +% + +% +% +% The ctranspose method of the matrix transpose the inner objects. +% +% + +function results = utp_matrix_ctranspose(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'matrix'; + mthd = 'ctranspose'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MATRIX objects + [ma1,ma2,ma3,ma4,mav,mam] = get_test_objects_matrix; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test that the method accepts plists + results = [results utp_11(mthd, ma1, ple1, plist('NAME', 'foo'))]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the ctranspose method works with a vector of MATRICES as input. + % + % + function result = utp_02 + + % + % + % Test that the ctranspose method works for a vector of MATRICES as input. + % + % + + try + % + out = ctranspose(mav); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'mav' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(mav)), atest = false; end + % Check 'objs' field of each output + for oo = 1:numel(out) + s = size(out(oo)); + for ll = 1:numel(s(1)) + for rr = 1:numel(s(2)) + if ~eq(out(oo).objs(ll,rr), mav(oo).objs(rr,ll), 'UUID'), atest = false; break; end + end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the ctranspose method works with a matrix of MATRICES as input. + % + % + function result = utp_03 + + % + % + % Test that the ctranspose method works for a matrix of MATRICES as input. + % + % + + try + % + out = ctranspose(mam); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'mam' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(mam)), atest = false; end + % Check 'objs' field of each output + for oo = 1:numel(out) + s = size(out(oo)); + for ll = 1:numel(s(1)) + for rr = 1:numel(s(2)) + if ~eq(out(oo).objs(ll,rr), mam(oo).objs(rr,ll), 'UUID'), atest = false; break; end + end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the ctranspose method works with a list of MATRICES as input. + % + % + function result = utp_04 + + % + % + % Test that the ctranspose method works for a list of MATRICES as input. + % + % + + try + % + out = ctranspose(ma1,ma2,ma3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + main = [ma1, ma2, ma3]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(main)), atest = false; end + % Check 'objs' field of each output + for oo = 1:numel(out) + s = size(out(oo)); + for ll = 1:numel(s(1)) + for rr = 1:numel(s(2)) + if ~eq(out(oo).objs(ll,rr), main(oo).objs(rr,ll), 'UUID'), atest = false; break; end + end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the ctranspose method works with a mix of different shaped + % MATRICES as input. + % + % + function result = utp_05 + + % + % + % Test that the ctranspose method works with an input of matrices and + % vectors and single MATRICES. + % + % + + try + % + out = ctranspose(ma1,mav,ma2,mam); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + main = [ma1, reshape(mav, 1, []), ma2, reshape(mam, 1, [])]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(main)), atest = false; end + % Check 'objs' field of each output + for oo = 1:numel(out) + s = size(out(oo)); + for ll = 1:numel(s(1)) + for rr = 1:numel(s(2)) + if ~eq(out(oo).objs(ll,rr), main(oo).objs(rr,ll), 'UUID'), atest = false; break; end + end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the ctranspose method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the ctranspose method can be + % processed back. + % + % + + try + % + out = ctranspose(ma1); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'ctranspose'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~strcmp(out.hist.methodInfo.mname, 'transpose'),atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the ctranspose method can modify the input MATRIX. + % + % + function result = utp_07 + + % + % + % Test that the ctranspose method can modify the input MATRIX by calling + % with no output. + % + % + + try + % + obj_modi = copy(ma1,1); + obj_eq = copy(ma1,1); + + out = obj_eq.ctranspose(); + obj_modi.ctranspose(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'out' and 'obj_eq' are now different. + % 2) Check that 'obj_eq' is not changed + % 3) Check that the modified input is the ctranspose value of the copy + % 4) Check that out and amodi are the same + % + % + + atest = true; + if stest + % + % Check that 'out' and 'obj_eq' are now different. + if eq(out, obj_eq, ple2), atest = false; end + % Check that 'obj_eq' is not changed + if ~eq(obj_eq, ma1, ple1), atest = false; end + % Check 'objs' field of each output + for oo = 1:numel(out) + s = size(out(oo)); + for ll = 1:numel(s(1)) + for rr = 1:numel(s(2)) + if ~eq(out(oo).objs(ll,rr), ma1(oo).objs(rr,ll), 'UUID'), atest = false; break; end + end + end + end + % Check that out and obj_modi are the same + if ~eq(out, obj_modi, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the ctranspose method accepts plist as an input. + % + % + function result = utp_08 + + % + % + % Tests that the ctranspose method accepts plist as an input. + % + % + + try + % + out = ma1.ctranspose(plist()); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the correct data + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check 'objs' field of each output + for oo = 1:numel(out) + s = size(out(oo)); + for ll = 1:numel(s(1)) + for rr = 1:numel(s(2)) + if ~eq(out(oo).objs(ll,rr), ma1(oo).objs(rr,ll), 'UUID'), atest = false; break; end + end + end + end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/matrix/utp_matrix_display.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/matrix/utp_matrix_display.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,367 @@ +% UTP_MATRIX_DISPLAY a set of UTPs for the matrix/display method +% +% M Hewitson 06-08-08 +% +% $Id: utp_matrix_display.m,v 1.1 2009/08/28 13:20:19 ingo Exp $ +% + +% +% +% The display method of the matrix class prints defined values of an +% MATRIX object. MATLAB calls display when it interprets an object that is +% not terminated by a semicolon. +% +% + +function results = utp_matrix_display(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'matrix'; + mthd = 'display'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MATRIX objects + [ma1,ma2,ma3,ma4,mav,mam] = get_test_objects_matrix; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the display method works with a vector of MATRIX objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the display method works for a vector of MATRIX objects as + % input. + % + % + + try + % + mav + out = display(mav); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + % Check the output + if ~iscell(out), atest = false; end; + for kk = 1:numel(mav) + if isempty(strfind(out, mav(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the display method works with a matrix of MATRIX objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the display method works for a matrix of MATRIX objects as + % input. + % + % + + try + % + mam + out = display(mam); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(mam) + if isempty(strfind(out, mam(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the display method works with a list of MATRIX objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the display method works for a list of MATRIX objects as + % input. + % + % + + try + % + ma1,ma2,ma3,ma4 + out = display(ma1,ma2,ma3,ma4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + pain = [ma1,ma2,ma3,ma4]; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(pain) + if isempty(strfind(out, pain(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the display method works with a mix of different shaped + % MATRIX objects as input. + % + % + function result = utp_05 + + % + % + % Test that the display method works with an input of matrices and + % vectors and single MATRIX objects as. + % + % + + try + % + out = display(ma1,mav,ma2,mam,ma3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + pain = [ma1,reshape(mav,1,[]),ma2,reshape(mam,1,[]),ma3]; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(pain) + if isempty(strfind(out, pain(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the display method properly applies history. + % + % + function result = utp_06 + + % + % + % The method display doesn't change the data, thus it is not possible + % to check the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/matrix/utp_matrix_loadobj.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/matrix/utp_matrix_loadobj.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,153 @@ +% UTP_MATRIX_LOADOBJ a set of UTPs for the matrix/loadobj method +% +% M Hewitson 06-08-08 +% +% $Id: utp_matrix_loadobj.m,v 1.1 2010/05/12 15:58:16 ingo Exp $ +% + +% +% +% The loadobj method of the matrix class will be automatically called by +% MATLAB if an older object is not compatible with the current object structure. +% This happens only for objects which are stored as a MATLAB formatted +% (MAT-file). The load mechanism for XML formated files calls always the +% 'update_struct' method to keep the stored objects up to date. The +% 'update_struct' method convert the read object structure to the object +% structure which is used in the currend LTPDA version. +% This UTP will load old objects which are stored with an older LTPDA version. +% +% REMARK: Since LTPDA version 1.9.2 will be an object which should be saved as a +% MAT file stored as a struct and not as the object. +% +% + +function results = utp_matrix_loadobj(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'matrix'; + mthd = 'loadobj'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Run the tests + results = [results utp_01]; % getInfo call + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Get all .MAT and .XML files + path = fullfile(fileparts(which(mfilename)), '..', '..', 'utp_test_files'); + + matfiles = utils.prog.filescan(path, '.mat'); + xmlfiles = utils.prog.filescan(path, '.xml'); + + % Load .MAT files + obj_no = 1; + for ii=1:numel(matfiles) + fn = matfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = matrix(fn); + obj_no = obj_no+1; + end + end + + % Load .XML files + for ii=1:numel(xmlfiles) + fn = xmlfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = matrix(fn); + obj_no = obj_no+1; + end + end + % + stest = true; + catch err + disp(objs(obj_no).fname) + disp(fn) + disp(err.message) + stest = false; + end + + % + % + % 1) Check the shape of the loaded objects. + % + % + + atest = true; + if stest + % + for ii = 1:numel(objs) + obj = objs(ii).obj; + fname = objs(ii).fname; + + if ~isempty(strfind(fname, '_vec')) + % Loaded object must be a vector + if ~isvector(obj), atest = false; end + elseif ~isempty(strfind(fname, '_mat')) + % Loaded object must be a matrix + % REMARK: Known error in LTPDA version 1.9.2 + % A saved matrix doesn't keep the shape of the matrix. + if isempty(strfind(fname, '_192')) + if ~(size(obj,1) > 1 && size(obj,2) > 1), atest = false; end + end + else + % Loaded object must be a single object + if ~(size(obj,1) == 1 && size(obj,2) == 1), + atest = false; end + end + + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/matrix/utp_matrix_matrix.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/matrix/utp_matrix_matrix.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,292 @@ +% UTP_MATRIX_MATRIX a set of UTPs for the matrix/matrix method +% +% M Hewitson 06-08-08 +% +% $Id: utp_matrix_matrix.m,v 1.6 2009/07/30 17:27:31 ingo Exp $ +% + +% +% +% The matrix method of the matrix class constructs MATRIX objects. +% +% + +function results = utp_matrix_matrix(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'matrix'; + mthd = 'matrix'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MATRIX objects + [ma1,ma2,ma3,ma4,mav,mam] = get_test_objects_matrix; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, mav, [], [], ple3)]; % Vector input + results = [results utp_03(mthd, mam, [], [], ple3)]; % Matrix input + results = [results utp_04(mthd, ma1, ma2, ma3, [], [], ple3)]; % List input + results = [results utp_05(mthd, ma1, mav, mam, [], [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, ma1, [], ple2)]; % Test history is working + + % Old format + results = [results utp_07]; % Test history is working with different numbers of input + + % constructor specific tests + results = [results utp_60(class, ma3, ple2)]; % Test history is properly handled with MAT file constructor + results = [results utp_61(class, ma1, ple2)]; % Test history is properly handled with XML file constructor + results = [results utp_62(class, ma1, ma2, ple2)]; % Test history is working with struct constructor + results = [results utp_64(class, ma1, ple1, ple2)]; % Test history is working with plist(filename) constructor + results = [results utp_65(class, ma1, ple3)]; % Test history is working with plist(hostname) constructor + results = [results utp_68(class, ma1, ple3)]; % Test history is working with conn+Id constructor + results = [results utp_70(class, ma1, ple2)]; % Test history is working with plist(plist) constructor + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From XML File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From MAT File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Repository')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Built-in Model')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + pn = 3; + if io(pn).plists.nparams ~= 5, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('shape'), atest = false; end + if ~io(pn).plists.isparam('objs'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('shape')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('objs')), atest = false; end + %%%%%%%%%% SET 'From MAT File' + pn = 4; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + %%%%%%%%%% SET 'From XML File' + pn = 5; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + %%%%%%%%%% SET 'From Repository' + pn = 6; + if io(pn).plists.nparams ~= 10, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('hostname'), atest = false; end + if ~io(pn).plists.isparam('id'), atest = false; end + if ~io(pn).plists.isparam('cid'), atest = false; end + if ~io(pn).plists.isparam('database'), atest = false; end + if ~io(pn).plists.isparam('binary'), atest = false; end + if ~io(pn).plists.isparam('username'), atest = false; end + if ~io(pn).plists.isparam('password'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('id')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('cid')), atest = false; end + if ~isequal(io(pn).plists.find('binary'), 'yes'), atest = false; end + %%%%%%%%%% SET 'From Built-in Model' + pn = 7; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('built-in'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('built-in')), atest = false; end + %%%%%%%%%% SET 'From Input' + pn = 8; + if io(pn).plists.nparams ~= 5, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('shape'), atest = false; end + if ~io(pn).plists.isparam('objs'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('shape')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('objs')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_07 + + % + % + % Tests that the matrix method properly applies history to the + % constructor with different numbers of inputs. + % + % + function result = utp_07 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + a1 = ao(1); + a2 = ao(2); + a3 = ao(3); + out1 = matrix(a1); + out2 = matrix(a1, a2); + out3 = matrix(a1, a2, a3); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'matrix'. + % 2) Check that the rebuilt objects are the same + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'matrix'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'matrix'), atest = false; end + if ~strcmp(out3.hist.methodInfo.mname, 'matrix'), atest = false; end + % Check that output contains the right values + if ~eq(out1.objs, a1), atest = false; end + if ~eq(out2.objs, [a1, a2]), atest = false; end + if ~eq(out3.objs, [a1, a2, a3]), atest = false; end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/matrix/utp_matrix_ncols.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/matrix/utp_matrix_ncols.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,382 @@ +% UTP_MATRIX_NCOLS a set of UTPs for the matrix/ncols method +% +% M Hewitson 06-08-08 +% +% $Id: utp_matrix_ncols.m,v 1.1 2009/08/28 13:20:19 ingo Exp $ +% + +% +% +% The ncols method of the matrix class is a get-function for the number of +% columns of the inner objects +% +% + +function results = utp_matrix_ncols(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'matrix'; + mthd = 'ncols'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MATRIX objects + [ma1,ma2,ma3,ma4,mav,mam] = get_test_objects_matrix; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the method + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the ncols method works with a vector of MATRICES as input. + % + % + function result = utp_02 + + % + % + % The ncols method doesn't work with a vector of MATRICES. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the ncols method works with a matrix of MATRICES as input. + % + % + function result = utp_03 + + % + % + % The ncols method doesn't work with a matrix of MATRICES. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the ncols method works with a list of MATRICES as input. + % + % + function result = utp_04 + + % + % + % The ncols method doesn't work with a list of MATRICES. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the ncols method works with a mix of different shaped + % MATRICES as input. + % + % + function result = utp_05 + + % + % + % The ncols method can only return the ncols values of one MATRIX. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the ncols method properly applies history. + % + % + function result = utp_06 + + % + % + % The ncols method doesn't change the MATRIX, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the ncols method returns the number of columns of the inner + % objects. + % + % + function result = utp_07 + + % + % + % Tests that the ncols method returns the number of columns of the inner + % objects. + % + % + + try + % + objs1 = [ao(1), ao(2), ao(3); ao(4), ao(5), ao(6)]; + objs2 = [miir, miir; miir miir; miir miir]; + m1 = matrix(objs1); + m2 = matrix(objs2); + n1 = m1.ncols; + n2 = m2.ncols; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that n1 and n2 are correct. + % + % + + atest = true; + if stest + % + if ~isequal(n1, size(m1.objs, 2)), atest = false; end; + if ~isequal(n2, size(m2.objs, 2)), atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/matrix/utp_matrix_nrows.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/matrix/utp_matrix_nrows.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,382 @@ +% UTP_MATRIX_NROWS a set of UTPs for the matrix/nrows method +% +% M Hewitson 06-08-08 +% +% $Id: utp_matrix_nrows.m,v 1.1 2009/08/28 13:20:19 ingo Exp $ +% + +% +% +% The nrows method of the matrix class is a get-function for the number of +% rows of the inner objects +% +% + +function results = utp_matrix_nrows(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'matrix'; + mthd = 'nrows'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MATRIX objects + [ma1,ma2,ma3,ma4,mav,mam] = get_test_objects_matrix; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the method + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the nrows method works with a vector of MATRICES as input. + % + % + function result = utp_02 + + % + % + % The nrows method doesn't work with a vector of MATRICES. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the nrows method works with a matrix of MATRICES as input. + % + % + function result = utp_03 + + % + % + % The nrows method doesn't work with a matrix of MATRICES. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the nrows method works with a list of MATRICES as input. + % + % + function result = utp_04 + + % + % + % The nrows method doesn't work with a list of MATRICES. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the nrows method works with a mix of different shaped + % MATRICES as input. + % + % + function result = utp_05 + + % + % + % The nrows method can only return the nrows values of one MATRIX. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the nrows method properly applies history. + % + % + function result = utp_06 + + % + % + % The nrows method doesn't change the MATRIX, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the nrows method returns the number of columns of the inner + % objects. + % + % + function result = utp_07 + + % + % + % Tests that the nrows method returns the number of columns of the inner + % objects. + % + % + + try + % + objs1 = [ao(1), ao(2), ao(3); ao(4), ao(5), ao(6)]; + objs2 = [miir, miir; miir miir; miir miir]; + m1 = matrix(objs1); + m2 = matrix(objs2); + n1 = m1.nrows; + n2 = m2.nrows; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that n1 and n2 are correct. + % + % + + atest = true; + if stest + % + if ~isequal(n1, size(m1.objs, 1)), atest = false; end; + if ~isequal(n2, size(m2.objs, 1)), atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/matrix/utp_matrix_osize.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/matrix/utp_matrix_osize.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,382 @@ +% UTP_MATRIX_OSIZE a set of UTPs for the matrix/osize method +% +% M Hewitson 06-08-08 +% +% $Id: utp_matrix_osize.m,v 1.1 2009/08/28 13:20:20 ingo Exp $ +% + +% +% +% The osize method of the matrix class is a get-function for the size of +% the inner objects. +% +% + +function results = utp_matrix_osize(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'matrix'; + mthd = 'osize'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MATRIX objects + [ma1,ma2,ma3,ma4,mav,mam] = get_test_objects_matrix; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the method + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the osize method works with a vector of MATRICES as input. + % + % + function result = utp_02 + + % + % + % The osize method doesn't work with a vector of MATRICES. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the osize method works with a matrix of MATRICES as input. + % + % + function result = utp_03 + + % + % + % The osize method doesn't work with a matrix of MATRICES. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the osize method works with a list of MATRICES as input. + % + % + function result = utp_04 + + % + % + % The osize method doesn't work with a list of MATRICES. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the osize method works with a mix of different shaped + % MATRICES as input. + % + % + function result = utp_05 + + % + % + % The osize method can only return the osize values of one MATRIX. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the osize method properly applies history. + % + % + function result = utp_06 + + % + % + % The osize method doesn't change the MATRIX, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the osize method returns the number of columns of the inner + % objects. + % + % + function result = utp_07 + + % + % + % Tests that the osize method returns the number of columns of the inner + % objects. + % + % + + try + % + objs1 = [ao(1), ao(2), ao(3); ao(4), ao(5), ao(6)]; + objs2 = [miir, miir; miir miir; miir miir]; + m1 = matrix(objs1); + m2 = matrix(objs2); + n1 = m1.osize; + n2 = m2.osize; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that n1 and n2 are correct. + % + % + + atest = true; + if stest + % + if ~isequal(n1, size(m1.objs)), atest = false; end; + if ~isequal(n2, size(m2.objs)), atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/matrix/utp_matrix_setObjs.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/matrix/utp_matrix_setObjs.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,311 @@ +% UTP_MATRIX_SETOBJS a set of UTPs for the matrix/setObjs method +% +% M Hewitson 06-08-08 +% +% $Id: utp_matrix_setObjs.m,v 1.2 2010/12/22 16:05:19 ingo Exp $ +% + +% +% +% The setObjs method of the matrix class sets the objs property. +% +% + +function results = utp_matrix_setObjs(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'matrix'; + mthd = 'setObjs'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MATRIX objects + [ma1,ma2,ma3,ma4,mav,mam] = get_test_objects_matrix; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + pl_generic = plist('objs', [ao(1) ao(2)]); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, mav, @algo_test_plist, pl_generic, ple2)]; % Vector input + results = [results utp_03(mthd, mam, @algo_test_plist, pl_generic, ple2)]; % Matrix input + results = [results utp_04(mthd, ma1, ma2, ma3, @algo_test_plist, pl_generic, ple2)]; % List input + results = [results utp_05(mthd, ma1, mam, mav, @algo_test_plist, pl_generic, ple2)]; % Mixed input + results = [results utp_06(mthd, ma1, pl_generic, ple2)]; % Test history is working + + % Old format + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property without a plist + results = [results utp_09]; % Test output of the data + results = [results utp_11(mthd, ma1, ple1, plist('OBJS', 'foo'))]; % Test plotinfo doesn't disappear + + 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 + + function atest = algo_test_plist(in, out, pli) + atest = true; + if ~eq(out.objs, pli.find('objs'), 'UUID'), atest = false; end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('objs'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('objs')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('objs'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_07 + + % + % + % Tests that the setObjs method can modify the input MATRIX. + % + % + function result = utp_07 + + % + % + % Test that the setObjs method can modify the input MATRIX by calling + % with no output. + % + % + + try + % + pli = plist('objs', ao(1), ao(2)); + obj_modi = copy(ma1,1); + obj_eq = copy(ma1,1); + + out = obj_eq.setObjs(pli); + obj_modi.setObjs(pli); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'out' and 'obj_eq' are now different. + % 2) Check that 'obj_eq' is not changed + % 3) Check that the modified input is the setObjs value of the copy + % 4) Check that out and amodi are the same + % + % + + atest = true; + if stest + % + % Check that 'out' and 'obj_eq' are now different. + if eq(out, obj_eq, ple2), atest = false; end + % Check that 'obj_eq' is not changed + if ~eq(obj_eq, ma1, ple1), atest = false; end + % Check that the modified input is correct + if ~eq(obj_modi.objs, pli.find('objs'), 'UUID'), atest = false; end + % Check that out and obj_modi are the same + if ~eq(out, obj_modi, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setObjs method can set the property without a plist. + % + % + function result = utp_08 + + % + % + % Test that the setObjs method can modify the property 'objs' + % without a plist. + % + % + + try + % + objs = [ao(1), ao(2)]; + out = ma1.setObjs(objs); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'out' has the correct objs field + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'objs' + if ~eq(out.objs, objs), atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setObjs method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setObjs(ma1, ma2, [ao(1), ao(2)]); + o3 = setObjs(ma1, ma2, [ao(1), ao(2)]); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check that o1, o2 and o3 have the correct data + if ~eq(o1.objs, [ao(1) ao(2)], ple1), atest = false; end + if ~eq(o2.objs, [ao(1) ao(2)], ple1), atest = false; end + if ~eq(o3.objs, [ao(1) ao(2)], ple1), atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/matrix/utp_matrix_transpose.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/matrix/utp_matrix_transpose.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,524 @@ +% UTP_MATRIX_TRANSPOSE a set of UTPs for the matrix/transpose method +% +% M Hewitson 06-08-08 +% +% $Id: utp_matrix_transpose.m,v 1.4 2010/12/22 16:05:19 ingo Exp $ +% + +% +% +% The transpose method of the matrix transpose the inner objects. +% +% + +function results = utp_matrix_transpose(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'matrix'; + mthd = 'transpose'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MATRIX objects + [ma1,ma2,ma3,ma4,mav,mam] = get_test_objects_matrix; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test that the method accepts plists + results = [results utp_11(mthd, ma1, ple1, plist('NAME', 'foo'))]; % Test plotinfo doesn't disappear + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the transpose method works with a vector of MATRICES as input. + % + % + function result = utp_02 + + % + % + % Test that the transpose method works for a vector of MATRICES as input. + % + % + + try + % + out = transpose(mav); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'mav' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(mav)), atest = false; end + % Check 'objs' field of each output + for oo = 1:numel(out) + s = size(out(oo)); + for ll = 1:numel(s(1)) + for rr = 1:numel(s(2)) + if ~eq(out(oo).objs(ll,rr), mav(oo).objs(rr,ll), 'UUID'), atest = false; break; end + end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the transpose method works with a matrix of MATRICES as input. + % + % + function result = utp_03 + + % + % + % Test that the transpose method works for a matrix of MATRICES as input. + % + % + + try + % + out = transpose(mam); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'mam' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(mam)), atest = false; end + % Check 'objs' field of each output + for oo = 1:numel(out) + s = size(out(oo)); + for ll = 1:numel(s(1)) + for rr = 1:numel(s(2)) + if ~eq(out(oo).objs(ll,rr), mam(oo).objs(rr,ll), 'UUID'), atest = false; break; end + end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the transpose method works with a list of MATRICES as input. + % + % + function result = utp_04 + + % + % + % Test that the transpose method works for a list of MATRICES as input. + % + % + + try + % + out = transpose(ma1,ma2,ma3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + main = [ma1, ma2, ma3]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(main)), atest = false; end + % Check 'objs' field of each output + for oo = 1:numel(out) + s = size(out(oo)); + for ll = 1:numel(s(1)) + for rr = 1:numel(s(2)) + if ~eq(out(oo).objs(ll,rr), main(oo).objs(rr,ll), 'UUID'), atest = false; break; end + end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the transpose method works with a mix of different shaped + % MATRICES as input. + % + % + function result = utp_05 + + % + % + % Test that the transpose method works with an input of matrices and + % vectors and single MATRICES. + % + % + + try + % + out = transpose(ma1,mav,ma2,mam); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + main = [ma1, reshape(mav, 1, []), ma2, reshape(mam, 1, [])]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(main)), atest = false; end + % Check 'objs' field of each output + for oo = 1:numel(out) + s = size(out(oo)); + for ll = 1:numel(s(1)) + for rr = 1:numel(s(2)) + if ~eq(out(oo).objs(ll,rr), main(oo).objs(rr,ll), 'UUID'), atest = false; break; end + end + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the transpose method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the transpose method can be + % processed back. + % + % + + try + % + out = transpose(ma1); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'transpose'. + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~strcmp(out.hist.methodInfo.mname, 'transpose'),atest = false; end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the transpose method can modify the input MATRIX. + % + % + function result = utp_07 + + % + % + % Test that the transpose method can modify the input MATRIX by calling + % with no output. + % + % + + try + % + obj_modi = copy(ma1,1); + obj_eq = copy(ma1,1); + + out = obj_eq.transpose(); + obj_modi.transpose(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'out' and 'obj_eq' are now different. + % 2) Check that 'obj_eq' is not changed + % 3) Check that the modified input is the transpose value of the copy + % 4) Check that out and amodi are the same + % + % + + atest = true; + if stest + % + % Check that 'out' and 'obj_eq' are now different. + if eq(out, obj_eq, ple2), atest = false; end + % Check that 'obj_eq' is not changed + if ~eq(obj_eq, ma1, ple1), atest = false; end + % Check 'objs' field of each output + for oo = 1:numel(out) + s = size(out(oo)); + for ll = 1:numel(s(1)) + for rr = 1:numel(s(2)) + if ~eq(out(oo).objs(ll,rr), ma1(oo).objs(rr,ll), 'UUID'), atest = false; break; end + end + end + end + % Check that out and obj_modi are the same + if ~eq(out, obj_modi, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the transpose method accepts plist as an input. + % + % + function result = utp_08 + + % + % + % Tests that the transpose method accepts plist as an input. + % + % + + try + % + out = ma1.transpose(plist()); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the correct data + % 2) Check that the re-built object is the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check 'objs' field of each output + for oo = 1:numel(out) + s = size(out(oo)); + for ll = 1:numel(s(1)) + for rr = 1:numel(s(2)) + if ~eq(out(oo).objs(ll,rr), ma1(oo).objs(rr,ll), 'UUID'), atest = false; break; end + end + end + end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_bsubmit.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_bsubmit.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,527 @@ +% UTP_MFIR_BSUBMIT a set of UTPs for the mfir/bsubmit method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_bsubmit.m,v 1.14 2010/08/18 09:25:54 ingo Exp $ +% + +% +% +% The bsubmit method of the mfir class submits a collection of objects +% in binary form to an LTPDA Repository. The type of the objects are +% independent. +% +% + +function results = utp_mfir_bsubmit(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'bsubmit'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + [fir1,fir2,fir3,fir4,fir5,fir6,firv,firm] = get_test_objects_mfir; + plForAutoTest = plist('no dialog', true, 'use selector', false); + + conn = utpGetConnection(); + try + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_mfir_bsubmit: submit mfir'; + sinfo.experiment_description = 'utp_mfir_bsubmit: description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test output of the data + catch + end + + % Close connection + utpCloseConnection(conn); + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 15, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('sinfo filename'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isEmptyChar(io(3).plists.find('sinfo filename')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the bsubmit method works with a vector of MFIR objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the bsubmit method works for a vector of MFIR objects as + % input. + % + % + + try + % + [ids, cids] = bsubmit(firv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3), ids(4)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(firv), atest = false; end + if numel(robjs2) ~= numel(firv), atest = false; end + if numel(robjs3) ~= numel(firv), atest = false; end + % Check the retrieved object against the submitted + if ~eq(firv, [robjs1{:}]), atest = false; end + if ~eq(firv, [robjs2{:}]), atest = false; end + if ~eq(firv, [robjs3{:}]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the bsubmit method works with a matrix of MFIR objects as + % input. + % + % + function result = utp_03 + + % + % + % Tests that the bsubmit method works with a matrix of MFIR objects + % as input. + % + % + + try + % + [ids, cids] = bsubmit(firm, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3), ids(4), ids(5), ids(6)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(firm), atest = false; end + if numel(robjs2) ~= numel(firm), atest = false; end + if numel(robjs3) ~= numel(firm), atest = false; end + % Check the retrieved object against the submitted + if ~eq(firm, reshape([robjs1{:}], size(firm))), atest = false; end + if ~eq(firm, reshape([robjs2{:}], size(firm))), atest = false; end + if ~eq(firm, reshape([robjs3{:}], size(firm))), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the bsubmit method works with a list of MFIR objects as + % input. + % + % + function result = utp_04 + + % + % + % Tests that the bsubmit method works with a list of MFIR objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = bsubmit(fir1, pl, iir, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 3, atest = false; end + if numel(robjs2) ~= 3, atest = false; end + if numel(robjs3) ~= 3, atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, fir1), atest = false; end + if ~eq(robjs1{2}, iir), atest = false; end + if ~eq(robjs1{3}, pl), atest = false; end + % Check robjs2 + if ~eq(robjs2{1}, fir1), atest = false; end + if ~eq(robjs2{2}, iir), atest = false; end + if ~eq(robjs2{3}, pl), atest = false; end + % Check robjs3 + if ~eq(robjs3{1}, fir1), atest = false; end + if ~eq(robjs3{2}, iir), atest = false; end + if ~eq(robjs3{3}, pl), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the abs method works with a mix of different shaped MFIR + % objects as input. + % + % + function result = utp_05 + + % + % + % Tests that the bsubmit method works with a list of MFIR objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = bsubmit(pl, firm, iir, firv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 2 + numel(firm) + numel(firv), atest = false; end + if numel(robjs2) ~= 2 + numel(firm) + numel(firv), atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, firm(1)), atest = false; end + if ~eq(robjs1{2}, firm(2)), atest = false; end + if ~eq(robjs1{3}, firm(3)), atest = false; end + if ~eq(robjs1{4}, firm(4)), atest = false; end + if ~eq(robjs1{5}, firm(5)), atest = false; end + if ~eq(robjs1{6}, firm(6)), atest = false; end + if ~eq(robjs1{7}, iir), atest = false; end + if ~eq(robjs1{8}, firv(1)), atest = false; end + if ~eq(robjs1{9}, firv(2)), atest = false; end + if ~eq(robjs1{10}, firv(3)), atest = false; end + if ~eq(robjs1{11}, firv(4)), atest = false; end + if ~eq(robjs1{12}, pl), atest = false; end + % Check robjs2 + if ~isequalwithequalnans(robjs1, robjs2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tthe bsubmit method properly applies history. + % + % + function result = utp_06 + + % + % + % Tthe bsubmit method properly applies history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the bsubmit method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [ids, cids] = bsubmit(fir1, fir2, sinfo, plForAutoTest); + + [o1, o2] = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + o3 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the output + if ~eq(o1, fir1), atest = false; end + if ~eq(o2, fir2), atest = false; end + if ~eq(o3{1}, fir1), atest = false; end + if ~eq(o3{2}, fir2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_char.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_char.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,357 @@ +% UTP_MFIR_CHAR a set of UTPs for the mfir/char method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_char.m,v 1.2 2009/07/23 12:33:00 ingo Exp $ +% + +% +% +% The char method of the mfir class converts the objects into one character string +% which contains information of the object. +% +% + +function results = utp_mfir_char(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'char'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MFIR objects + [firhp,firlp,firbp,firbr,firpzm,firao,firv,firm] = get_test_objects_mfir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the char method works with a vector of MFIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the char method works for a vector of MFIR objects as input. + % + % + + try + % + out = char(firv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end; + for kk = 1:numel(firv) + if isempty(strfind(out, firv(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the char method works with a matrix of MFIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the char method works for a matrix of MFIR objects as input. + % + % + + try + % + out = char(firm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(firm) + if isempty(strfind(out, firm(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the char method works with a list of MFIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the char method works for a list of MFIR objects as input. + % + % + + try + % + out = char(firbp,firhp,firpzm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + firin = [firbp,firhp,firpzm]; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(firin) + if isempty(strfind(out, firin(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the char method works with a mix of different shaped MFIR objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the char method works with an input of matrices and vectors + % and single MFIR objects. + % + % + + try + % + out = char(firhp,firv,firao,firm,firlp); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + firin = [firhp,reshape(firv,1,[]),firao,reshape(firm,1,[]),firlp]; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(firin) + if isempty(strfind(out, firin(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the char method properly applies history. + % + % + function result = utp_06 + + % + % + % The method char doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_copy.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_copy.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,50 @@ +% UTP_MFIR_COPY a set of UTPs for the mfir/copy method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_copy.m,v 1.3 2009/08/08 12:21:40 hewitson Exp $ +% + +% +% +% The copy method of the mfir class copies the input object depending of the +% second input. +% +% + +function results = utp_mfir_copy(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'copy'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_69(class, 1, 1, ple2)]; + results = [results utp_69(class, 1, 3, ple2)]; + results = [results utp_69(class, 2, 3, ple2)]; + + 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 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_created.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_created.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,485 @@ +% UTP_MFIR_CREATED a set of UTPs for the mfir/created method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_created.m,v 1.2 2009/07/23 12:33:00 ingo Exp $ +% + +% +% +% The created method of the mfir returns a time object of the last +% modification. For this uses the created method the 'proctime' property of +% the last history step and computs from this value a timeobject. +% +% + +function results = utp_mfir_created(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'created'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MFIR objects + [fir1,fir2,fir3,fir4,fir5,fir6,firv,firm] = get_test_objects_mfir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test empty object + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the created method works with a vector of MFIR objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the created method works for a vector of MFIR objects as + % input. + % + % + + try + % + out = created(firv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'firv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if ~isequal(size(out), size(firv)), atest = false; end + % Check the time-object + for kk=1:numel(out) + if out(kk).utc_epoch_milli ~= firv(kk).hist.proctime, atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the created method works with a matrix of MFIR objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the created method works for a matrix of MFIR objects as + % input. + % + % + + try + % + out = created(firm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'firm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if ~isequal(size(out), size(firm)), atest = false; end + % Check time-object + for kk=1:numel(out) + if out(kk).utc_epoch_milli ~= firm(kk).hist.proctime, atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the created method works with a list of MFIR objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the created method works for a list of MFIR objects as + % input. + % + % + + try + % + out = created(fir1,fir2,fir3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if out(1).utc_epoch_milli ~= fir1.hist.proctime, atest = false; end + if out(2).utc_epoch_milli ~= fir2.hist.proctime, atest = false; end + if out(3).utc_epoch_milli ~= fir3.hist.proctime, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the created method works with a mix of different shaped + % MFIR objects as input. + % + % + function result = utp_05 + + % + % + % Test that the created method works with an input of matrices and + % vectors and single MFIR objects. + % + % + + try + % + out = created(fir1,firv,fir2,firm,fir3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + firin = [fir1,reshape(firv,1,[]),fir2,reshape(firm,1,[]),fir3]; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(firm)+numel(firv)), atest = false; end + for kk=1:numel(out) + if out(kk).utc_epoch_milli ~= firin(kk).hist.proctime, atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the created method properly applies history + % + % + function result = utp_06 + + % + % + % This method doesn't change the input object, thus no history is added + % to the object. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the created method can be used with the modify command. + % + % + function result = utp_07 + + % + % + % Tests that the created method can be used with the modify command. + % + % + + try + % + out1 = fir3.created; + out2 = firm.created; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the single object + % 2) Check the matrix object + % + % + + atest = true; + if stest + % + % Check the single object + if out1.utc_epoch_milli ~= fir3.hist.proctime, atest = false; end + % Check the matrix + for kk = 1:numel(out2) + if out2(kk).utc_epoch_milli ~= firm(kk).hist.proctime, atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the created method retruns always a well defined time object + % even for an empty input object. + % + % + function result = utp_08 + + % + % + % Test that the created method with an empty 'MFIR object + % + % + + try + % + fir = mfir(); + out = fir.created; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a time object with a ell defined time. + % + % + + atest = true; + if stest + % + if ~isa(out, 'time'), atest = false; end + if isnan(out.utc_epoch_milli), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_creator.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_creator.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,520 @@ +% UTP_MFIR_CREATED a set of UTPs for the mfir/creator method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_creator.m,v 1.2 2009/07/23 12:33:00 ingo Exp $ +% + +% +% +% The creator method of the mfir extract the creator(s)/modifier from +% the history. Depending to the input parameter returns this method all +% creator/modifier or only the last creator/modifier. +% +% + +function results = utp_mfir_creator(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'creator'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MFIR objects + [fir1,fir2,fir3,fir4,fir5,fir6,firv,firm] = get_test_objects_mfir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with different creator/modifier + results = [results utp_09]; % Test negative case for the option 'all' + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('option'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('option')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('option'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the creator method works with a vector of MFIR objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the creator method works for a vector of MFIR objects as + % input. + % + % + + try + % + out = creator(firv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'firv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(firv), atest = false; end + % Check the creator + curr_creator = provenance(); + for kk=1:numel(out) + if ~strcmp(out{kk}, curr_creator.creator), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the creator method works with a matrix of MFIR objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the creator method works for a matrix of MFIR objects as + % input. + % + % + + try + % + out = creator(firm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'firm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(firm), atest = false; end + % Check creator + curr_creator = provenance(); + for kk=1:numel(out) + if ~strcmp(out{kk}, curr_creator.creator), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the creator method works with a list of MFIR objects as + % input. + % + % + function result = utp_04 + + % + % + % The creator method doesn't work for a list of MFIR objects as input. + % + % + + % + try + creator(fir1,fir2,fir3); + stest = false; + catch + stest = true; + end + % + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the creator method works with a mix of different shaped + % MFIR objects as input. + % + % + function result = utp_05 + + % + % + % The creator method doesn't work with different shaped input objects. + % + % + + % + try + creator(fir1,firv,fir2,firm,fir3); + stest = false; + catch + stest = true; + end + % + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the creator method properly applies history + % + % + function result = utp_06 + + % + % + % This method doesn't change the input object, thus no history is added + % to the object. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the creator method can be used with the modify command. + % + % + function result = utp_07 + + % + % + % Tests that the creator method can be used with the modify command. + % + % + + try + % + out1 = fir3.creator; + out2 = firm.creator; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the single object + % 2) Check the matrix object + % + % + + atest = true; + if stest + % + curr_creator = provenance(); + % Check the single object + if ~strcmp(out1, curr_creator.creator), atest = false; end + % For a single object must be the the output a char string + if ~ischar(out1), atest = false; end + % Check the matrix + for kk = 1:numel(out2) + if ~strcmp(out2{kk}, curr_creator.creator), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the creator method retruns all creator(s)/modifier(s) which + % are in the history. + % + % + function result = utp_08 + + % + % + % Test that the creator method uses the option 'all' direct or in a + % plist. The test file must have the modifier 'first', 'second' and + % 'third' + % + % + + try + % + % Read object with different modifier + fir = mfir('test_mfir_diff_creator.xml'); + out1 = fir.creator; + out2 = fir.creator('all'); + out3 = fir.creator(plist('option', 'all')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that out1 contains only one creator + % 2) Check that out2 contain more creator/modifier + % + % + + atest = true; + if stest + % + if ~ischar(out1), atest = false; end + if ~strmatch('fist', out2), atest = false; end + if ~strmatch('second', out2), atest = false; end + if ~strmatch('third', out2), atest = false; end + if ~strmatch('fist', out3), atest = false; end + if ~strmatch('second', out3), atest = false; end + if ~strmatch('third', out3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Tests the negative case for the option 'all'. + % + % + function result = utp_09 + + % + % + % Test that the creator method throws an error if the option 'all' is + % used in connection with a matrix/vector of MFIR objects. + % + % + + try + % + firm.creator('all'); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_display.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_display.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,361 @@ +% UTP_MFIR_DISPLAY a set of UTPs for the mfir/display method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_display.m,v 1.2 2009/07/23 12:33:00 ingo Exp $ +% + +% +% +% The display method of the mfir class prints defined values of an MFIR object. +% MATLAB calls display when it interprets an object that is not terminated +% by a semicolon. +% +% + +function results = utp_mfir_display(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'display'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MFIR objects + [firhp,firlp,firbp,firbr,firpzm,firao,firv,firm] = get_test_objects_mfir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the display method works with a vector of MFIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the display method works for a vector of MFIR objects as input. + % + % + + try + % + firv + out = display(firv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + % Check the output + if ~iscell(out), atest = false; end; + for kk = 1:numel(firv) + if isempty(strfind(out, firv(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the display method works with a matrix of MFIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the display method works for a matrix of MFIR objects as input. + % + % + + try + % + firm + out = display(firm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(firm) + if isempty(strfind(out, firm(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the display method works with a list of MFIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the display method works for a list of MFIR objects as input. + % + % + + try + % + firlp,firbp,firao + out = display(firlp,firbp,firao); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + firin = [firlp,firbp,firao]; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(firin) + if isempty(strfind(out, firin(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the display method works with a mix of different shaped + % MFIR objects as input. + % + % + function result = utp_05 + + % + % + % Test that the display method works with an input of matrices and vectors + % and single MFIR objects as. + % + % + + try + % + out = display(firhp,firv,firbr,firm,firpzm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + firin = [firhp,reshape(firv,1,[]),firbr,reshape(firm,1,[]),firpzm]; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(firin) + if isempty(strfind(out, firin(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the display method properly applies history. + % + % + function result = utp_06 + + % + % + % The method display doesn't change the data, thus it is not possible to + % check the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_eq.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_eq.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,639 @@ +% UTP_MFIR_EQ a set of UTPs for the mfir/eq method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_eq.m,v 1.8 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The eq() method of the mfir class fir1 == fir2 compares each element of an +% fir object with the corresponding element of an second fir object and returns +% a logical 1 (true) where fir1 and fir2 are equal, or logical 0 (false) +% where they are not equal. +% +% + +function results = utp_mfir_eq(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'eq'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MFIR objects + [firhp,firlp,firbp,firbr,firpzm,firao,firv,firm] = get_test_objects_mfir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test with the exception list 'name' + results = [results utp_08]; % Test with the exception list 'histin' + results = [results utp_09]; % Test with the exception list 'iunits' + results = [results utp_10]; % Test with the exception list 'ounits' + results = [results utp_11]; % Test exception list in a plist + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check number of SETS + if numel(io(2).sets) ~= 1, atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + % SET 'Default' + % Check key + if ~io(3).plists.isparam('Exceptions'), atest = false; end + if ~io(3).plists.isparam('Tol'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('Exceptions'), {}), atest = false; end + if ~isequal(io(3).plists.find('Tol'), eps(1)), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('Exceptions'), {{}}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('Tol'), {eps(1)}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the eq method works with a vector of MFIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the eq method works for a vector of MFIR objects as input. + % Test the positive and the negative case. + % + % + + try + % + fir = firbr.setName('my name'); + iirv1 = [firlp, firao, firpzm, firbr]; + iirv2 = [firlp, firao, firpzm, fir]; + out1 = eq(iirv1, iirv1); + out2 = eq(iirv1, iirv2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the eq function. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the eq method works with a matrix of MFIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the eq method works for a matrix of MFIR objects as input. + % Test the positive and the negative case. + % + % + + try + % + fir = firbr.setName('my name'); + firm1 = [firlp, firao, firbr, firbr, firpzm, firlp]; + firm2 = [firlp, firao, fir; firbr, firpzm, firlp]; + out1 = eq(firm1, firm1); + out2 = eq(firm1, firm2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the eq function. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the eq method works with a list of MFIR objects as input. + % + % + function result = utp_04 + + % + % + % The eq method doesn't works for a list of MFIR objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the eq method works with a mix of different shaped MFIR objects + % as input. + % + % + function result = utp_05 + + % + % + % The eq method doesn't works for a list of MFIR objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the eq method properly applies history. + % + % + function result = utp_06 + + % + % + % The eq method doesn't change the MFIR object, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_07 + + % + % + % Test the eq method with the exception 'name'. Use the option 'internal' to + % suppress the history. It is necessary to add 'created' to the exception + % list because fir is created at an other time. + % + % + + try + % + fir = testCallerIsMethod(@setName, firbr, 'my name'); + out1 = eq(fir, firbr); + out2 = eqLocal(fir, firbr, 'name'); + out3 = eqLocal(fir, firbr, 'mfir/name'); + out4 = eq(fir.hist, firbr.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_08 + + % + % + % Test the eq method with the exception 'histout'. Use the option 'internal' to + % suppress the history. It is necessary to add 'created' to the exception + % list because fir is created at an other time. + % + % + + try + % + fir = testCallerIsMethod(@setHistout, firbr, [1 1]); + out1 = eq(fir, firbr); + out2 = eqLocal(fir, firbr, 'histout'); + out3 = eqLocal(fir, firbr, 'mfir/histout'); + out4 = eq(fir.hist, firbr.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_09 + + % + % + % Test the eq method with the exception 'iunits'. Use the option 'internal' + % to suppress the history. It is necessary to add 'created' to the exception + % list because fir is created at an other time. + % + % + + try + % + fir = testCallerIsMethod(@setIunits, firbr, unit('Hz')); + out1 = eq(fir, firbr); + out2 = eqLocal(fir, firbr, 'iunits'); + out3 = eqLocal(fir, firbr, 'mfir/iunits'); + out4 = eq(fir.hist, firbr.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_10 + + % + % + % Test the eq method with the exception 'ounits'. Use the option 'internal' + % to suppress the history. It is necessary to add 'created' to the exception + % list because fir is created at an other time. + % + % + + try + % + fir = testCallerIsMethod(@setOunits, firbr, unit('V')); + out1 = eq(fir, firbr); + out2 = eqLocal(fir, firbr, 'ounits'); + out3 = eqLocal(fir, firbr, 'mfir/ounits'); + out4 = eq(fir.hist, firbr.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_11 + + % + % + % Test the eq method with an exception list which is in a plist. + % + % + function result = utp_11 + + % + % + % Test that the eq method uses the exception list in a plist. + % + % + + try + % + fir = testCallerIsMethod(@setName, firbr, 'my name'); + pl = plist('Exceptions', {'name', 'UUID'}); + out1 = eq(fir, firbr); + out2 = eq(fir, firbr, pl); + out3 = eq(fir, firbr, pl); + out4 = eq(fir.hist, firbr.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_11 + + function res = eqLocal(obj1, obj2, ex) + e = ple1.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {ex}]); + + res = eq(obj1, obj2, ple); + end +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_get.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_get.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,304 @@ +% UTP_MFIR_GET a set of UTPs for the mfir/get method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_get.m,v 1.3 2011/03/29 13:03:29 ingo Exp $ +% + +% +% +% The get method of the mfir class returns the value of an object +% property. This is a very simple method which accepts only one mfir as +% input thus are the most general units test not possible. +% +% + +function results = utp_mfir_get(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'get'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Algorithm test + results = [results utp_03]; % Algorithm test with a plist + results = [results utp_04]; % Negative test with more than one mfir + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('property'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('property')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('property'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests the get method of the mfir class. + % + % + function result = utp_02 + + % + % + % Test that the get returns returns the value of the specified + % property. Do this for all properties of the MFIR object. + % + % + + try + % + fir = mfir(plist('type', 'lowpass')); + out1 = get(fir, 'gd'); + out3 = get(fir, 'ntaps'); + out4 = get(fir, 'fs'); + out5 = get(fir, 'infile'); + out6 = get(fir, 'a'); + out7 = get(fir, 'histout'); + out8 = get(fir, 'iunits'); + out9 = get(fir, 'ounits'); + out10= get(fir, 'hist'); + out11= get(fir, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the correct value of the output + % + % + + atest = true; + if stest + % + if ~isequal(out1, fir.gd), atest = false; end + if ~isequal(out3, fir.ntaps), atest = false; end + if ~isequal(out4, fir.fs), atest = false; end + if ~isequal(out5, fir.infile), atest = false; end + if ~isequal(out6, fir.a), atest = false; end + if ~isequal(out7, fir.histout), atest = false; end + if ~eq(out8, fir.iunits), atest = false; end + if ~eq(out9, fir.ounits), atest = false; end + if ~eq(out10,fir.hist), atest = false; end + if ~isequal(out11,fir.name), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the get method works with a plist. + % + % + function result = utp_03 + + % + % + % Test that the get returns returns the value of the specified + % property which is defined in a plist. + % + % + + try + % + fir = mfir(plist('type', 'lowpass')); + pl1 = plist('property', 'gd'); + pl3 = plist('property', 'ntaps'); + pl4 = plist('property', 'fs'); + pl5 = plist('property', 'infile'); + pl6 = plist('property', 'a'); + pl7 = plist('property', 'histout'); + pl8 = plist('property', 'iunits'); + pl9 = plist('property', 'ounits'); + pl10= plist('property', 'hist'); + pl11= plist('property', 'name'); + out1 = get(fir, pl1); + out3 = get(fir, pl3); + out4 = get(fir, pl4); + out5 = get(fir, pl5); + out6 = get(fir, pl6); + out7 = get(fir, pl7); + out8 = get(fir, pl8); + out9 = get(fir, pl9); + out10= get(fir, pl10); + out11= get(fir, pl11); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the correct value of the output + % + % + + atest = true; + if stest + % + if ~isequal(out1, fir.gd), atest = false; end + if ~isequal(out3, fir.ntaps), atest = false; end + if ~isequal(out4, fir.fs), atest = false; end + if ~isequal(out5, fir.infile), atest = false; end + if ~isequal(out6, fir.a), atest = false; end + if ~isequal(out7, fir.histout), atest = false; end + if ~eq(out8, fir.iunits), atest = false; end + if ~eq(out9, fir.ounits), atest = false; end + if ~eq(out10,fir.hist), atest = false; end + if ~isequal(out11,fir.name), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests the get method of the mfir class. + % + % + function result = utp_04 + + % + % + % Test that the get throws an error if the input are more than + % one MFIR object. + % + % + + try + % + fir = mfir(plist('type', 'lowpass')); + out = get([fir, fir], 'name'); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_index.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_index.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,525 @@ +% UTP_MFIR_INDEX a set of UTPs for the mfir/index method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_index.m,v 1.4 2009/07/28 17:12:37 ingo Exp $ +% + +% +% +% The index method of the mfir class index into a MFIR vector or +% matrix. This properly captures the history. +% +% + +function results = utp_mfir_index(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'index'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MFIR objects + [fir1,fir2,fir3,fir4,fir5,fir6,firv,firm] = get_test_objects_mfir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test history is working + results = [results utp_06]; % Test the modify call works + results = [results utp_07]; % Test with plist + results = [results utp_08]; % Test select more objects with an index + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('i'), atest = false; end + if ~io(3).plists.isparam('j'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('i')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('j')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('i'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('j'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the index method works with a vector of MFIR objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the index method works for a vector of MFIR objects as + % input. The following indexing should work: + % I = [ 1 2 3 ] or (I/J) = [(1,1), (1,2), (1,3)] + % + % + + try + % + objvec = [fir1, fir2, fir3]; + out1 = objvec.index(1); + out2 = objvec.index(3); + out3 = objvec.index(1,2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the index method selects the correct object. + % + % + + atest = true; + if stest + % + if ~eq(out1, fir1, ple3), atest = false; end + if ~eq(out2, fir3, ple3), atest = false; end + if ~eq(out3, fir2, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the index method works with a matrix of MFIR objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the index method works for a matrix of MFIR objects as + % input. The following indexing should work: + % I = [ 1 3 5 ] or (I/J) = [(1,1), (1,2), (1,3)] + % [ 2 4 6 ] [(2,1), (2,2), (2,3)] + % + + try + % + objmat = [fir1, fir2, fir3; ... + fir3, fir1, fir2]; + out1 = objmat.index(5); + out2 = objmat.index(4); + out3 = objmat.index(1,2); + out4 = objmat.index(2,1); + out5 = objmat.index(2,2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the index method selects the correct object. + % + % + + atest = true; + if stest + % + if ~eq(out1, fir3, ple3), atest = false; end + if ~eq(out2, fir1, ple3), atest = false; end + if ~eq(out3, fir2, ple3), atest = false; end + if ~eq(out4, fir3, ple3), atest = false; end + if ~eq(out5, fir1, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the index method works with a list of MFIR objects as + % input. + % + % + function result = utp_04 + + % + % + % The index method doesn't work for a list of MFIR objects as input. + % + % + + try + % + out = index(fir1,fir2,fir3, 4); + % + stest = false; + catch + stest = true; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the index method properly applies history. + % + % + function result = utp_05 + + % + % + % Test that the result of index have an additional history step. + % + % + + try + % + i = 2; + j = 3; + objmat = [fir1, fir2, fir3; ... + fir3, fir1, fir2]; + out = index(objmat, i, j); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds + % to 'index'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'index'), atest = false; end + % Check that the history-plist contains the used indices. + pl = out.hist.plistUsed; + if pl.find('i') ~= i, atest = false; end + if pl.find('j') ~= j, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the index method works for the modifier command. + % + % + function result = utp_06 + + % + % + % Tests that the index method works for the modifier command. + % + % + + try + % + i = 1; + j = 1; + objmat = [fir1, fir2, fir3; ... + fir3, fir1, fir2]; + out1 = index(objmat, i, j); + out2 = objmat.index(i,j); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history-plist contains the used indices. + % 2) Check that the index method selects the correct object + % + % + + atest = true; + if stest + % + % Check that the history-plist contains the used indices. + pl = out1.hist.plistUsed; + if pl.find('i') ~= i, atest = false; end + if pl.find('j') ~= j, atest = false; end + % Check that the index method selects the correct object + if ~eq(out1, fir1, ple3), atest = false; end + % Check that the history-plist contains the used indices. + pl = out2.hist.plistUsed; + if pl.find('i') ~= i, atest = false; end + if pl.find('j') ~= j, atest = false; end + % Check that the index method selects the correct object + if ~eq(out2, fir1, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Control the method with a plist. + % + % + function result = utp_07 + + % + % + % Test that the index method can be controled with a plist. + % + % + + try + % + i1 = 6; + i2 = 1; + j2 = 3; + objmat = [fir1, fir2, fir3; ... + fir3, fir1, fir2]; + pl1 = plist('i', i1); + pl2 = plist('i', i2, 'j', j2); + out1 = index(objmat, pl1); + out2 = index(objmat, pl2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history-plist contains the used indices. + % 2) Check that the index method selects the correct object + % + % + + atest = true; + if stest + % + % Check that the history-plist contains the used indices. + pl = out1.hist.plistUsed; + if ~isequal(pl.find('i'), i1), atest = false; end + if ~isequal(pl.find('j'), []), atest = false; end + % Check that the index method selects the correct object + if ~eq(out1, fir2, ple3), atest = false; end + % Check that the history-plist contains the used indices. + pl = out2.hist.plistUsed; + if ~isequal(pl.find('i'), i2), atest = false; end + if ~isequal(pl.find('j'), j2), atest = false; end + % Check that the index method selects the correct object + if ~eq(out2, fir3, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test that the index method selects more objects if I have more indices. + % + % + function result = utp_08 + + % + % + % Test that the index method selects more objects if I have more indices. + % + % + + try + % + i = [2 6]; + objmat = [fir1, fir2, fir3; ... + fir3, fir1, fir2]; + pl = plist('i', i); + out1 = objmat.index(i); + out2 = objmat.index(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history-plist contains the used indices. + % 2) Check that the index method selects the correct object + % + % + + atest = true; + if stest + % + % Check that the history-plist contains the used indices. + pl = out1(1).hist.plistUsed; + if ~isequal(pl.find('i'), i), atest = false; end + if ~isequal(pl.find('j'), []), atest = false; end + % Check that the index method selects the correct object + if ~eq(out1(1), fir3, ple3), atest = false; end + if ~eq(out1(2), fir2, ple3), atest = false; end + % Check that the history-plist contains the used indices. + pl = out2(2).hist.plistUsed; + if ~isequal(pl.find('i'), i), atest = false; end + if ~isequal(pl.find('j'), []), atest = false; end + % Check that the index method selects the correct object + if ~eq(out2(1), fir3, ple3), atest = false; end + if ~eq(out2(2), fir2, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_isprop.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_isprop.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,483 @@ +% UTP_MFIR_ISPROP a set of UTPs for the mfir/isprop method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_isprop.m,v 1.6 2011/03/29 13:13:33 ingo Exp $ +% + +% +% +% The isprop method of the mfir class determine whether input is object property. +% +% + +function results = utp_mfir_isprop(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'isprop'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MFIR objects + [firhp,firlp,firbp,firbr,firpzm,firao,firv,firm] = get_test_objects_mfir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test negative case + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the isprop method works with a vector of MFIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the isprop method works for a vector of MFIR objects as input. + % + % + + try + % + out = isprop(firv, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'firv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(firv)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the isprop method works with a matrix of MFIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the isprop method works for a matrix of MFIR objects as input. + % + % + + try + % + out = isprop(firm, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'firm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(firm)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the isprop method works with a list of MFIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the isprop method works for a list of MFIR objects as input. + % + % + + try + % + out = isprop(firlp,firpzm,firbr, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the isprop method works with a mix of different shaped + % MFIR objects as input. + % + % + function result = utp_05 + + % + % + % Test that the isprop method works with an input of matrices and vectors + % and single MFIR objects. + % + % + + try + % + out = isprop(firlp,firv,firpzm,firm,firbr, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(firm)+numel(firv)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the isprop method properly applies history. + % + % + function result = utp_06 + + % + % + % The method isprop doesn't change the object, thus it is not necessary to + % apply history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the isprop method works for each property. + % + % + function result = utp_07 + + % + % + % Test that the isprop method works for the properties: + % 'gd', 'ntaps', 'fs', 'infile', 'a', 'histout', + % 'iunits', 'ounits', 'hist', 'name' + % + % + + try + % + % copy firlp to work with + out1 = isprop(firlp, 'gd'); + out3 = isprop(firlp, 'ntaps'); + out4 = isprop(firlp, 'fs'); + out5 = isprop(firlp, 'infile'); + out6 = isprop(firlp, 'a'); + out7 = isprop(firlp, 'histout'); + out8 = isprop(firlp, 'iunits'); + out9 = isprop(firlp, 'ounits'); + out10 = isprop(firlp, 'hist'); + out11 = isprop(firlp, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if ~out1, atest = false; end; + if ~out3, atest = false; end; + if ~out4, atest = false; end; + if ~out5, atest = false; end; + if ~out6, atest = false; end; + if ~out7, atest = false; end; + if ~out8, atest = false; end; + if ~out9, atest = false; end; + if ~out10, atest = false; end; + if ~out11, atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the negative case and the not function command. + % + % + function result = utp_08 + + % + % + % Test that the isprop method retrun false for a unknown property and for + % methods of the object. + % + % + + try + % + out1 = isprop(firbp, 'foo'); + out2 = firbp.isprop('foo'); + out3 = firbp.isprop('name'); + out4 = firbp.isprop('type'); + out5 = firbp.isprop('char'); + out6 = firbp.isprop('creator'); + out7 = firbp.isprop('created'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if out1, atest = false; end; + if out2, atest = false; end; + if ~out3, atest = false; end; + if out4, atest = false; end; + if out5, atest = false; end; + if out6, atest = false; end; + if out7, atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_loadobj.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_loadobj.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,151 @@ +% UTP_MFIR_LOADOBJ a set of UTPs for the mfir/loadobj method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_loadobj.m,v 1.1 2009/01/12 19:08:19 ingo Exp $ +% + +% +% +% The loadobj method of the mfir class will be automatically called by +% MATLAB if an older object is not compatible with the current object structure. +% This happens only for objects which are stored as a MATLAB formatted +% (MAT-file). The load mechanism for XML formated files calls always the +% 'update_struct' method to keep the stored objects up to date. The +% 'update_struct' method convert the read object structure to the object +% structure which is used in the currend LTPDA version. +% This UTP will load old objects which are stored with an older LTPDA version. +% +% REMARK: Since LTPDA version 1.9.2 will be an object which should be saved as a +% MAT file stored as a struct and not as the object. +% +% + +function results = utp_mfir_loadobj(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'loadobj'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Run the tests + results = [results utp_01]; % getInfo call + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Get all .MAT and .XML files + path = fullfile(fileparts(which(mfilename)), '..', '..', 'utp_test_files'); + + matfiles = utils.prog.filescan(path, '.mat'); + xmlfiles = utils.prog.filescan(path, '.xml'); + + % Load .MAT files + obj_no = 1; + for ii=1:numel(matfiles) + fn = matfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = mfir(fn); + obj_no = obj_no+1; + end + end + + % Load .XML files + for ii=1:numel(xmlfiles) + fn = xmlfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = mfir(fn); + obj_no = obj_no+1; + end + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the shape of the loaded objects. + % + % + + atest = true; + if stest + % + for ii = 1:numel(objs) + obj = objs(ii).obj; + fname = objs(ii).fname; + + if ~isempty(strfind(fname, '_vec')) + % Loaded object must be a vector + if ~isvector(obj), atest = false; end + elseif ~isempty(strfind(fname, '_mat')) + % Loaded object must be a matrix + % REMARK: Known error in LTPDA version 1.9.2 + % A saved matrix doesn't keep the shape of the matrix. + if isempty(strfind(fname, '_192')) + if ~(size(obj,1) > 1 && size(obj,2) > 1), atest = false; end + end + else + % Loaded object must be a single object + if ~(size(obj,1) == 1 && size(obj,2) == 1), + atest = false; end + end + + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_mfir.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_mfir.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,1883 @@ +% UTP_MFIR_MFIR a set of UTPs for the mfir/mfir method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_mfir.m,v 1.37 2011/08/22 05:37:13 hewitson Exp $ +% + +% +% +% The mfir method of the mfir class constructs MFIR objects. +% +% + +function results = utp_mfir_mfir(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'mfir'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test objects + [firhp,firlp,firbp,firbr,firpzm,firao,firv,firm] = get_test_objects_mfir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working with empty constructor + results = [results utp_07]; % Test history is working with copy constructor + results = [results utp_08]; % Test history is working with MAT file constructor + results = [results utp_09]; % Test history is working with XML file constructor + results = [results utp_10]; % Test history is working with AO constructor (default) + results = [results utp_11]; % Test history is working with struct constructor + results = [results utp_12]; % Test history is working with pzmodel-object constructor + results = [results utp_13]; % Test history is working with plist(filename) constructor + results = [results utp_14]; % Test history is working with plist(hostname) constructor + results = [results utp_15]; % Test history is working with plist(type) constructor + results = [results utp_16]; % Test history is working with plist(pzmodel) constructor + results = [results utp_17]; % Test history is working with plist(plist) constructor + results = [results utp_18]; % Test history is working with plist(a) constructor + results = [results utp_19]; % Test history is working with plist(AO) constructor + results = [results utp_20]; % Test history is working with plist(AO) constructor + results = [results utp_21]; % Test history is working with plist(AO) constructor + results = [results utp_22]; % Test history is working with AO + plist constructor + results = [results utp_23]; % Test history is working with conn+Id constructor + results = [results utp_24]; % Test history is working with pzmodel + plist constructor + results = [results utp_25]; % Test history is working with a + fs constructor + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + dwin = char(prefs.getMiscPrefs.getDefaultWindow); + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From XML File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From MAT File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Repository')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Standard Type')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Pzmodel')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From A')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From AO')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Built-in Model')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 3, atest = false; end + % Check key + % Check default value + % Check options + %%%%%%%%%% SET 'From MAT File' + pn = 4; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + %%%%%%%%%% SET 'From XML File' + pn = 5; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + %%%%%%%%%% SET 'From Repository' + pn = 6; + if io(pn).plists.nparams ~= 10, atest = false; end + % Check key + if ~io(pn).plists.isparam('hostname'), atest = false; end + if ~io(pn).plists.isparam('id'), atest = false; end + if ~io(pn).plists.isparam('cid'), atest = false; end + if ~io(pn).plists.isparam('database'), atest = false; end + if ~io(pn).plists.isparam('binary'), atest = false; end + if ~io(pn).plists.isparam('username'), atest = false; end + if ~io(pn).plists.isparam('password'), atest = false; end + % Check default value + if ~isEmptyDouble(io(pn).plists.find('id')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('cid')), atest = false; end + if ~isequal(io(pn).plists.find('binary'), 'yes'), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('id'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('cid'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('binary'), {'yes', 'no'}), atest = false; end + %%%%%%%%%% SET 'From Built-in Model' + pn = 7; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('built-in'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('built-in')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('built-in'), {''}), atest = false; end + %%%%%%%%%% SET 'From Standard Type' + pn = 8; + if io(pn).plists.nparams ~= 10, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('type'), atest = false; end + if ~io(pn).plists.isparam('fc'), atest = false; end + if ~io(pn).plists.isparam('gain'), atest = false; end + if ~io(pn).plists.isparam('fs'), atest = false; end + if ~io(pn).plists.isparam('order'), atest = false; end + if ~io(pn).plists.isparam('iunits'), atest = false; end + if ~io(pn).plists.isparam('ounits'), atest = false; end + % Check default value + if ~isequal(io(pn).plists.find('type'), 'lowpass'), atest = false; end + if ~isequal(io(pn).plists.find('fc'), [.1 .4]), atest = false; end + if ~isequal(io(pn).plists.find('gain'), 1), atest = false; end + if ~isequal(io(pn).plists.find('fs'), 1), atest = false; end + if ~isequal(io(pn).plists.find('order'), 128), atest = false; end + if ~isEmptyChar(io(pn).plists.find('iunits')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('ounits')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('type'), {'highpass', 'lowpass', 'bandpass', 'bandreject'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('fc'), {[.1 .4]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('gain'), {1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('fs'), {1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('order'), {128}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('iunits'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('ounits'), {''}), atest = false; end + %%%%%%%%%% SET 'From Pzmodel' + pn = 9; + if io(pn).plists.nparams ~= 7, atest = false; end + % Check key + if ~io(pn).plists.isparam('pzmodel'), atest = false; end + if ~io(pn).plists.isparam('fs'), atest = false; end + if ~io(pn).plists.isparam('iunits'), atest = false; end + if ~io(pn).plists.isparam('ounits'), atest = false; end + % Check default value + if ~eq(io(pn).plists.find('pzmodel'), pzmodel(), ple1), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('fs')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('iunits')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('ounits')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('iunits'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('ounits'), {''}), atest = false; end + %%%%%%%%%% SET 'From A' + pn = 10; + if io(pn).plists.nparams ~= 7, atest = false; end + % Check key + if ~io(pn).plists.isparam('a'), atest = false; end + if ~io(pn).plists.isparam('fs'), atest = false; end + if ~io(pn).plists.isparam('name'), atest = false; end + % Check default value + if ~isEmptyDouble(io(pn).plists.find('a')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('fs')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('a'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('name'), {''}), atest = false; end + %%%%%%%%%% SET 'From AO' + pn = 11; + if io(pn).plists.nparams ~= 10, atest = false; end + % Check key + if ~io(pn).plists.isparam('ao'), atest = false; end + if ~io(pn).plists.isparam('n'), atest = false; end + if ~io(pn).plists.isparam('method'), atest = false; end + if ~io(pn).plists.isparam('win'), atest = false; end + % Check default value + if ~eq(io(pn).plists.find('ao'), ao(), ple1), atest = false; end + if ~isequal(io(pn).plists.find('n'), 512), atest = false; end + if ~isequal(io(pn).plists.find('method'), 'frequency-sampling'), atest = false; end + if ~isequal(lower(io(pn).plists.find('win')), lower(dwin)), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('n'), {512}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('method'), {'frequency-sampling', 'least-squares', 'Parks-McClellan'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('win'), specwin.getTypes), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the mfir method works with a vector of MFIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the mfir method works with a vector of MFIR objects as input. + % + % + + try + % + out = mfir(firv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output MFIRs is the same as the input shape. + % 2) Check that each output MFIR is a copy of the input MFIR. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + if stest + % + % Check we have the correct shape + if size(out) ~= size(firv), atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(firv(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(firv(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(firv(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the mfir method works with a matrix of MFIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the mfir method works with a matrix of MFIR objects as input. + % + % + + try + % + out = mfir(firm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output MFIRs is the same as the input shape. + % 2) Check that each output MFIR is a copy of the input MFIR. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if size(out) ~= size(firm), atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(firm(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(firm(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(firm(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the mfir method works with a list of MFIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the mfir method works with a list of MFIR objects as input. + % + % + + try + % + out = mfir(firhp, firlp, firbp); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same of the + % number in the input. + % 2) Check that each output MFIR is a copy of the input MFIR. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + firin = [firhp, firlp, firbp]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(firin(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(firin(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(firin(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the mfir method works with a mix of different shaped MFIRs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the mfir method works with a mix of different shaped MFIRs as + % input. + % + % + + try + % + out = mfir(firhp,firv,firbr,firm,firlp); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same of the + % number in the input. + % 2) Check that each output MFIR is a copy of the input MFIR. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + firin = [firhp, reshape(firv, 1, []), firbr, reshape(firm, 1, []), firlp]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3+numel(firv)+numel(firm), atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(firin(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(firin(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(firin(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the mfir method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the mfir method can be processed back. + % + % + + try + % + out = mfir(firlp); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'mfir'. + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'mfir'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the mfir method properly applies history to the copy constructor. + % + % + function result = utp_07 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % Test the constructor with a different number of inputs. + % + % + + try + % + out1 = mfir(firhp); + out2 = mfir(firhp, firlp); + out3 = mfir(firhp, firlp, firbp); + out1.setName('my name'); + out2(1).setName('my name'); + out2(2).setName('my name'); + out3(1).setName('my name'); + out3(2).setName('my name'); + out3(3).setName('my name'); + mout = rebuild(out1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'mfir'. + % 2) Check that the original objects are not changed by the setter function + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + % It is the method 'setName' because we set it in above + if ~strcmp(out1.hist.methodInfo.mname, 'setName'), atest = false; end + % Check next to the last step in the history of 'out' + if ~strcmp(out1.hist.inhists.methodInfo.mname, 'mfir'), atest = false; end + % Check the originals + if strcmp(firhp, 'my name'), atest = false; end + if strcmp(firlp, 'my name'), atest = false; end + if strcmp(firbp, 'my name'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out1, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the mfir method properly applies history to the read + % MAT-file constructor. + % + % + function result = utp_08 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + filename = 'fir.mat'; + fir = mfir(firlp); + save(fir, filename); + + out = mfir(filename); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' + % corresponds to 'mfir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'mfir'), atest = false; end + % Reading a file doesn't add additionally history steps + if ~eq(out, fir, ple2), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + delete(filename); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + + %% UTP_09 + + % + % + % Tests that the mfir method properly applies history to the read + % XML-file constructor. + % + % + function result = utp_09 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + filename = 'fir.xml'; + amat = mfir(firm); + save(amat, filename); + + out = mfir(filename); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the shape + % 2) Check that the last entry in the history of 'out' + % corresponds to 'mfir'. + % 3) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the shape of the rebuilt object + if size(amat) ~= size(out), atest = false; end + % Check the algorithm + for kk = 1:numel(out) + % Check the last step in the history of 'out' + if ~strcmp(out(kk).hist.methodInfo.mname, 'mfir'), atest = false; end + % Reading a file doesn't add additionally history steps + if ~eq(out(kk), amat(kk), ple1), atest = false; end + end + + % Check the rebuilt object + for kk = 1:numel(out) + if ~eq(mout(kk), out(kk), ple2), atest = false; end + end + % + delete(filename); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Tests that the mfir method properly applies history to the AO constructor. + % + % + function result = utp_10 + + % + % + % Test that the output can be processed back with the 'rebuild' method. Use + % the default values (method = 'frequency-sampling'). + % + % + + try + % + fs = 1000; + f = linspace(0, fs/2, 1000); + xx = randn(1000,1); + plao = plist('type', 'fsdata', 'xvals', f, 'yvals', xx, 'fs', fs); + a1 = ao(plao); + + out = mfir(a1); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' + % corresponds to 'mfir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'mfir'), atest = false; end + % Get the default values and compare this values with the output. + f = a1.x; + xx = abs(a1.y); + pl = mfir.getInfo('mfir', 'From AO').plists; + N = pl.find('N'); + win = specwin(pl.find('win'), N+1); + ffm = f/(fs/2); + mtaps = fir2(N, ffm, xx, win.win); + + if out.fs ~= fs, atest = false; end + if out.ntaps ~= length(mtaps), atest = false; end + if out.a ~= mtaps, atest = false; end + if out.gd ~= (length(mtaps)+1)/2, atest = false; end + % Check that the AO history appends to the mfir history + if ~eq(out.hist.inhists, a1.hist), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_11 + + % + % + % Tests that the mfir method properly applies history to the struct constructor. + % + % + function result = utp_11 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + sfirhp = struct(firhp); + sfirhp.iunits = struct(firhp.iunits); + sfirhp.ounits = struct(firhp.ounits); + sfirhp.hist = struct(firhp.hist); + + out1 = mfir(struct(firpzm)); + out2 = mfir(sfirhp); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' + % corresponds to 'mfir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check that the output is a MFIR object + if ~isa(out1,'mfir'), atest = false; end + if ~isa(out2,'mfir'), atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'setName'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'setName'), atest = false; end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_11 + + %% UTP_12 + + % + % + % Tests that the mfir method properly applies history to the pzmodel constructor. + % + % + function result = utp_12 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + ps = [pz(1) pz(200)]; + zs = pz(50); + pzm = pzmodel(1, ps, zs, unit('Hz^2'), unit('V^2')); + out = mfir(pzm); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' + % corresponds to 'mfir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check that the output is a MFIR object + if ~isa(out,'mfir'), atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'mfir'), atest = false; end + if ~strcmp(out.hist.inhists.methodInfo.mname, 'pzmodel'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Tests that the mfir method properly applies history to the + % plist(filename) constructor. + % + % + function result = utp_13 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + try + % + filename1 = 'fir.xml'; + filename2 = 'fir.mat'; + + f1 = mfir(firpzm); + f2 = mfir(firlp); + + save(f1, filename1); + save(f2, filename2); + + out1 = mfir(plist('filename', filename1)); + out2 = mfir(plist('filename', filename2)); + + rout1 = out1.rebuild; + rout2 = out2.rebuild; + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the save method doesn't change the input object + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the input object of the save method + if ~eq(f1, mfir(firpzm), ple1), atest = false; end + if ~eq(f2, mfir(firlp), ple1) , atest = false; end + % Check the last history step of 'out' (load)c + if ~strcmp(out1.hist.methodInfo.mname, 'mfir'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'mfir'), atest = false; end + % The load doesn't have two additionally history steps (save + load) + if ~eq(out1, f1, ple1), atest = false; end + if ~eq(out2, f2, ple1), atest = false; end + % Run 'test.m' and check the result + if ~eq(rout1, out1, ple2), atest = false; end + if ~eq(rout2, out2, ple2), atest = false; end + % + % delete test file + delete(filename1) + delete(filename2) + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + %% UTP_14 + + % + % + % Tests that the MFIR method properly applies history to the + % plist(conn) constructor. + % + % + function result = utp_14 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + conn = utpGetConnection; + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_mfir_mfir_14: submit mfir vector'; + sinfo.experiment_description = 'utp_mfir_mfir_14: &description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + plForAutoTest = plist('no dialog', true, 'use selector', false); + ids = submit(firv, sinfo, plForAutoTest); + + out = mfir(plist('hostname', utpGetHostname, 'database', utpGetDatabase, 'conn', conn, 'id', ids)); + % + % Close connection + utpCloseConnection(conn); + stest = true; + catch err + disp(err.message) + % Close connection + utpCloseConnection(conn); + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'mfir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + for kk = 1:numel(out) + if ~strcmp(out(kk).hist.methodInfo.mname, 'mfir'), atest = false; end + end + % Check data values + if ~eq(out, firv, ple3), atest = false; end + % Rebuild object and check the result + % + % This test is in an automatic test not possible because the repository + % asks for username and password. + % + % Manually tested by: Ingo Diepholz + % Test date: 08.12.2008 + % Status: success + % + % rout = rebuild(out); + % if ~eq(rout, out, ple3), atest = false; end + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_14 + + %% UTP_15 + + % + % + % Tests that the MFIR method properly applies history to the + % plist(type) constructor. + % + % + function result = utp_15 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + pl1 = plist('type', 'lowpass'); + pl2 = plist('type', 'highpass'); + pl3 = plist('type', 'bandpass'); + pl4 = plist('type', 'bandreject'); + plerr = plist('type', 'wrong name'); + + % Use different values to the default values + g = 2; + fs = 1000; + fc = 60; + fcb = [50 100]; + order = 32; + win = specwin('Hamming', order+1); + pl = plist('fs', fs, 'fc', fc, 'order', order, 'gain', g); + plb = plist('fs', fs, 'fc', fcb, 'order', order, 'gain', g); + + out1 = mfir(combine(pl1, pl)); + out2 = mfir(combine(pl2, pl)); + out3 = mfir(combine(pl3, plb)); + out4 = mfir(combine(pl4, plb)); + + rout1 = rebuild(out1); + rout2 = rebuild(out2); + rout3 = rebuild(out3); + rout4 = rebuild(out4); + + try + % Negative test: Should throw an error + mfir(plerr); + stest = false; + catch + stest = true; + end + + % + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'mfir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'mfir'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'mfir'), atest = false; end + if ~strcmp(out3.hist.methodInfo.mname, 'mfir'), atest = false; end + if ~strcmp(out4.hist.methodInfo.mname, 'mfir'), atest = false; end + % Check 'lowpass' filter + a = g.*fir1(order, 2*fc/fs, 'low', win.win); + if ~isequal(out1.a, a), atest = false; end + if ~isequal(out1.fs, fs), atest = false; end + if ~isequal(out1.gd, (length(a)-1)/2), atest =false; end + if ~strcmp(out1.name, 'lowpass'), atest = false; end + % Check 'highpass' filter + a = g.*fir1(order, 2*fc/fs, 'high', win.win); + if ~isequal(out2.a, a), atest = false; end + if ~isequal(out2.fs, fs), atest = false; end + if ~isequal(out2.gd, (length(a)-1)/2), atest =false; end + if ~strcmp(out2.name, 'highpass'), atest = false; end + % Check 'bandpass' filter + a = g.*fir1(order, 2.*fcb/fs, 'bandpass', win.win); + if ~isequal(out3.a, a), atest = false; end + if ~isequal(out3.fs, fs), atest = false; end + if ~isequal(out3.gd, (length(a)-1)/2), atest =false; end + if ~strcmp(out3.name, 'bandpass'), atest = false; end + % Check 'bandpass' filter + a = g.*fir1(order, 2.*fcb/fs, 'stop', win.win); + if ~isequal(out4.a, a), atest = false; end + if ~isequal(out4.fs, fs), atest = false; end + if ~isequal(out4.gd, (length(a)-1)/2), atest =false; end + if ~strcmp(out4.name, 'bandreject'), atest = false; end + % Rebuild object and check the result + if ~eq(rout1, out1, ple2), atest = false; end + if ~eq(rout2, out2, ple2), atest = false; end + if ~eq(rout3, out3, ple2), atest = false; end + if ~eq(rout4, out4, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_15 + + %% UTP_16 + + % + % + % Tests that the MFIR method properly applies history to the + % plist(pzmodel) constructor. + % + % + function result = utp_16 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + ps = [pz(1) pz(200)]; + zs = pz(50); + pzm = pzmodel(1, ps, zs, unit('Hz'), unit('V')); + pl = plist('pzmodel', pzm, 'fs', 500); + out = mfir(pl); + + rout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'mfir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'mfir'), atest = false; end + % Check the next to the last step in the history. + % It must be the history of the pole/zero model (here 'pzmodel') + % Since we changed the constructors, the history no longer contains the pzmodel + % since we put the pzmodel in the plist. + %if ~strcmp(out.hist.inhists.methodInfo.mname, 'pzmodel'), atest = false; end + % Check values + if ~isequal(out.fs, 500), atest = false; end + if ~eq(out.iunits, unit('Hz')), atest = false; end + if ~eq(out.ounits, unit('V')), atest = false; end + % Rebuild object and check the result + if ~eq(rout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_16 + + %% UTP_17 + + % + % + % Tests that the MFIR method properly applies history to the + % plist() constructor. + % + % + function result = utp_17 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + pzm = pzmodel(1, [pz(1) pz(200)], pz(50), unit('V'), unit('Hz')); + pl = plist('pzmodel', pzm, 'fs', 500); + out1 = mfir(plist('plist', pl)); + out2 = mfir(plist('plist', plist())); % empty plist + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'mfir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~strcmp(out1.hist.methodInfo.mname, 'mfir'), atest = false; end + % Check the next to the last step in the history. + % It must be the history of the partial fraction model (here 'pzmodel') + if ~strcmp(out1.hist.inhists.methodInfo.mname, 'pzmodel'), atest = false; end + % Check values + if ~isequal(out1.fs, 500), atest = false; end + if ~eq(out1.iunits, unit('V')), atest = false; end + if ~eq(out1.ounits, unit('Hz')), atest = false; end + % Check the last step in the history of 'out2' + if ~strcmp(out2.hist.methodInfo.mname, 'mfir'), atest = false; end + % Check the next to the last step in the history. + if ~isempty(out2.hist.inhists), atest = false; end + % Rebuild object and check the result + if ~eq(out1, mout1, ple1), atest = false; end + if ~eq(out2, mout2, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_17 + + %% UTP_18 + + % + % + % Tests that the MFIR method properly applies history to the a constructor. + % + % + function result = utp_18 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + pl = plist('a', [1 2 3], 'fs', 123); + out = mfir(pl); + + rout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'mfir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'mfir'), atest = false; end + % Check values + if ~isequal(out.fs, 123), atest = false; end + if ~isequal(out.a, [1 2 3]), atest = false; end + % Rebuild object and check the result + if ~eq(rout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_18 + + %% UTP_19 + + % + % + % Tests that the mfir method properly applies history to the plist(AO) constructor. + % + % + function result = utp_19 + + % + % + % Test that the output can be processed back with the 'rebuild' method. Use + % the method 'frequency-sampling'. + % + % + + try + % + fs = 500; + f = linspace(0, fs/2, fs); + xx = randn(fs,1); + plao = plist('type', 'fsdata', 'xvals', f, 'yvals', xx, 'fs', fs); + a1 = ao(plao); + + win1 = specwin('kaiser', 32, 100); + win2 = specwin('BH92', 32); + N = 64; + plfir1 = plist('ao', a1, 'method', 'frequency-sampling', 'win', win1, 'N', N); + plfir2 = plist('ao', a1, 'method', 'frequency-sampling', 'win', win2, 'N', N); + + out1 = mfir(plfir1); + out2 = mfir(plfir2); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' + % corresponds to 'mfir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'mfir'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'mfir'), atest = false; end + % Get the default values and compare this values with the output. + f = a1.x; + xx = abs(a1.y); + ffm = f/(fs/2); + newwin = specwin('kaiser', N+1, 100); + mtaps1 = fir2(N, ffm, xx, newwin.win); + newwin = specwin('BH92', N+1); + mtaps2 = fir2(N, ffm, xx, newwin.win); + + if out1.fs ~= fs, atest = false; end + if out1.ntaps ~= length(mtaps1), atest = false; end + if out1.a ~= mtaps1, atest = false; end + if out1.gd ~= (length(mtaps1)+1)/2, atest = false; end + if out2.fs ~= fs, atest = false; end + if out2.ntaps ~= length(mtaps2), atest = false; end + if out2.a ~= mtaps2, atest = false; end + if out2.gd ~= (length(mtaps2)+1)/2, atest = false; end + % Check that the AO history appends to the mfir history + if ~eq(out1.hist.inhists, a1.hist), atest = false; end + if ~eq(out2.hist.inhists, a1.hist), atest = false; end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_19 + + %% UTP_20 + + % + % + % Tests that the mfir method properly applies history to the plist(AO) constructor. + % + % + function result = utp_20 + + % + % + % Test that the output can be processed back with the 'rebuild' method. Use + % the method 'least-squares'. + % + % + + try + % + fs = 500; + f = linspace(0, fs/2, fs); + xx = randn(fs,1); + plao = plist('type', 'fsdata', 'xvals', f, 'yvals', xx, 'fs', fs); + a1 = ao(plao); + + win = specwin('BH92', 32); + N = 64; + + try + plfir = plist('ao', a1, 'method', 'least-squares', 'win', win, 'N', N); + out = mfir(plfir); + mout = rebuild(out); + stest = false; + catch + stest = true; + end + % + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) At the moment throws this method an error. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_20 + + %% UTP_21 + + % + % + % Tests that the mfir method properly applies history to the plist(AO) constructor. + % + % + function result = utp_21 + + % + % + % Test that the output can be processed back with the 'rebuild' method. Use + % the method 'Parks-McClellan'. + % + % + + try + % + fs = 500; + f = linspace(0, fs/2, fs); + xx = randn(fs,1); + plao = plist('type', 'fsdata', 'xvals', f, 'yvals', xx, 'fs', fs); + a1 = ao(plao); + + win = specwin('BH92', 32); + N = 64; + + try + plfir = plist('ao', a1, 'method', 'Parks-McClellan', 'win', win, 'N', N); + out = mfir(plfir); + mout = rebuild(out); + stest = false; + catch + stest = true; + end + % + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) At the moment throws this method an error. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_21 + + %% UTP_22 + + % + % + % Tests that the mfir method properly applies history to the AO + plist constructor. + % + % + function result = utp_22 + + % + % + % Test that the output can be processed back with the 'rebuild' method. Use + % the method 'frequency-sampling'. + % + % + + try + % + fs = 500; + f = linspace(0, fs/2, fs); + xx = randn(fs,1); + plao = plist('type', 'fsdata', 'xvals', f, 'yvals', xx, 'fs', fs); + a1 = ao(plao); + + win = specwin('kaiser', 32, 100); + N = 64; + plfir = plist('method', 'frequency-sampling', 'win', win, 'N', N); + + out = mfir(a1, plfir); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' + % corresponds to 'mfir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'mfir'), atest = false; end + % Get the default values and compare this values with the output. + f = a1.x; + xx = abs(a1.y); + ffm = f/(fs/2); + newwin = specwin('kaiser', N+1, 100); + mtaps = fir2(N, ffm, xx, newwin.win); + + if out.fs ~= fs, atest = false; end + if out.ntaps ~= length(mtaps), atest = false; end + if out.a ~= mtaps, atest = false; end + if out.gd ~= (length(mtaps)+1)/2, atest = false; end + % Check that the AO history appends to the mfir history + if ~eq(out.hist.inhists, a1.hist), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_22 + + %% UTP_23 + + % + % + % Tests that the MFIR method properly applies history to the conn+Id constructor. + % + % + function result = utp_23 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + conn = utpGetConnection + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_mfir_mfir_23: submit mfir'; + sinfo.experiment_description = 'utp_mfir_mfir_23: description'; + sinfo.analysis_description = 'utp_mfir_mfir_23'; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + plForAutoTest = plist('no dialog', true, 'use selector', false); + [ids] = submit(firao, sinfo, plForAutoTest); + + out = mfir(conn, ids); + % + % Close connection + utpCloseConnection(conn); + stest = true; + catch err + disp(err.message) + % Close connection + utpCloseConnection(conn); + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'mfir'. + % 2) Check that re-running the 'test.m' file produces the same object + % as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'mfir'), atest = false; end + % Check data values + if ~eq(out,firao, ple3), atest = false; end + % Check the history except the additional 'submit' + 'retrieve' steps + if ~eq(out.hist.inhists, firao.hist), atest = false; end + % + % This test is in an automatic test not possible because the repository + % asks for username and password + % + % Manual test by: Ingo Diepholz + % Test date: 08.12.2008 + % Status: success + % + % rout = rebuild(out); + % if ~eq(mout, out, ple3), atest = false; end + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_23 + + %% UTP_24 + + % + % + % Tests that the MFIR method properly applies history to the + % pole/zero model + plist object constructor. + % + % + function result = utp_24 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + ps = [pz(1) pz(200)]; + zs = pz(50); + pzm = pzmodel(1, ps, zs, unit('Hz'), unit('V')); + pl = plist('fs', 123); + out = mfir(pzm, pl); + + rout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'mfir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'mfir'), atest = false; end + % Check values + if ~isequal(out.fs, 123), atest = false; end + if ~eq(out.iunits, unit('Hz')), atest = false; end + if ~eq(out.ounits, unit('V')), atest = false; end + % Rebuild object and check the result + if ~eq(rout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_24 + + %% UTP_25 + + % + % + % Tests that the MFIR method properly applies history to the + % a + fs object constructor. + % + % + function result = utp_25 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + a = [1 2 3]; + fs = 123.123; + out = mfir(a,fs); + + rout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'mfir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'mfir'), atest = false; end + % Check values + if ~isequal(out.fs, 123.123), atest = false; end + if ~isequal(out.a, [1 2 3]), atest = false; end + % Rebuild object and check the result + if ~eq(rout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_25 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_ne.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_ne.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,455 @@ +% UTP_MFIR_NE a set of UTPs for the mfir/ne method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_ne.m,v 1.6 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The ne() method of the mfir class fir1 ~= fir2 compares each element of an +% mfir object with the corresponding element of an second fir object and returns +% a logical 1 (true) where fir1 and fir2 are not equal, or logical 0 (false) +% where they are equal. +% +% + +function results = utp_mfir_ne(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'ne'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MFIR objects + [firhp,firlp,firbp,firbr,firpzm,firao,firv,firm] = get_test_objects_mfir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test with the exception list 'name' + results = [results utp_08]; % Test exception list in a plist + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the ne method works with a vector of MFIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the ne method works for a vector of MFIR objects as input. + % Test the positive and the negative case. + % + % + + try + % + fir = firpzm.setName('my name'); + iirv1 = [firao, firbr, firhp, firpzm]; + iirv2 = [firao, firbr, firhp, fir]; + out1 = ne(iirv1, iirv1); + out2 = ne(iirv1, iirv2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the ne function. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the ne method works with a matrix of MFIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the ne method works for a matrix of MFIR objects as input. + % Test the positive and the negative case. + % + % + + try + % + fir = firpzm.setName('my name'); + firm1 = [firao, firbr, firpzm, firpzm, firhp, firao]; + firm2 = [firao, firbr, fir; firpzm, firhp, firao]; + out1 = ne(firm1, firm1); + out2 = ne(firm1, firm2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the ne function. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the ne method works with a list of MFIR objects as input. + % + % + function result = utp_04 + + % + % + % The ne method doesn't works for a list of MFIR objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the ne method works with a mix of different shaped MFIR objects + % as input. + % + % + function result = utp_05 + + % + % + % The ne method doesn't works for a list of MFIR objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the ne method properly applies history. + % + % + function result = utp_06 + + % + % + % The ne method doesn't change the MFIR object, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the ne method with an exception list. + % The function mfir/ne use the function mfir/eq so it is not necessary to check + % all possibilities of the exception list. + % + % + function result = utp_07 + + % + % + % Test the ne method with the exception 'name'. Use the option 'internal' to + % suppress the history. It is necessary to add 'created' to the exception + % list because fir is created at an other time. + % + % + + try + % + fir = testCallerIsMethod(@setName, firpzm, 'my name'); + out1 = ne(fir, firpzm); + out2 = ne(fir, firpzm, 'name', 'created', 'UUID'); + out3 = ne(fir, firpzm, 'mfir/name', 'created', 'UUID'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + if out3 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the ne method with an exception list which is in a plist. + % + % + function result = utp_08 + + % + % + % Test that the ne method uses the exception list in a plist. + % + % + + try + % + fir = testCallerIsMethod(@setName, firpzm, 'my name'); + pl = plist('Exceptions', {'name', 'created', 'UUID'}); + out1 = ne(fir, firpzm); + out2 = ne(fir, firpzm, pl); + out3 = ne(fir, firpzm, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + if out3 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_rebuild.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_rebuild.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,413 @@ +% UTP_MFIR_REBUILD a set of UTPs for the mfir/rebuild method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_rebuild.m,v 1.2 2009/07/23 12:33:00 ingo Exp $ +% + +% +% +% The rebuild method of the mfir class rebuilds the input objects using the +% history. This method is also intensively tested in the most other UTPs. +% +% + +function results = utp_mfir_rebuild(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'rebuild'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MFIR objects + [fir1, fir2, fir3, fir4, fir5, fir6, firv, firm] = get_test_objects_mfir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the output + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the rebuild method works with a vector of MFIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the rebuild method works for a vector of MFIR objects as input. + % + % + + try + % + out = rebuild(firv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + % Check the output + if ~isa(out, 'mfir'), atest = false; end; + for kk = 1:numel(firv) + if eq(out(kk), firv(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the rebuild method works with a matrix of MFIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the rebuild method works for a matrix of MFIR objects as input. + % + % + + try + % + out = rebuild(firm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + if ~isa(out, 'mfir'), atest = false; end; + for kk = 1:numel(firm) + if eq(out(kk), firm(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the rebuild method works with a list of MFIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the rebuild method works for a list of MFIR objects as input. + % + % + + try + % + out = rebuild(fir5,fir4,fir3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + firin = [fir5,fir4,fir3]; + if stest + % + if ~isa(out, 'mfir'), atest = false; end; + for kk = 1:numel(firin) + if eq(out(kk), firin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the rebuild method works with a mix of different shaped MFIR objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the rebuild method works with an input of matrices and vectors + % and single MFIR objects. + % + % + + try + % + out = rebuild(fir4,firv,fir2,firm,fir1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + firin = [fir4,reshape(firv,1,[]),fir2,reshape(firm,1,[]),fir1]; + if stest + % + if ~isa(out, 'mfir'), atest = false; end; + for kk = 1:numel(firin) + if eq(out(kk), firin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the rebuild method properly applies history. + % + % + function result = utp_06 + + % + % + % The method rebuild doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the rebuild method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = rebuild(fir1, fir2); + o3 = rebuild(fir1, fir2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, fir1, ple2), atest = false; end + if ~eq(o2, fir2, ple2), atest = false; end + if ~eq(o3, [fir1 fir2], ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_redesign.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_redesign.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,572 @@ +% UTP_MFIR_REDESIGN a set of UTPs for the mfir/redesign method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_redesign.m,v 1.3 2011/04/17 15:47:28 ingo Exp $ +% + +% +% +% The redesign method of the mfir class redesign the input filter to work for the +% given sample rate. +% +% + +function results = utp_mfir_redesign(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'redesign'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MFIR objects + [firhp,firlp,firbp,firbr,firpzm,firao,firv,firm] = get_test_objects_mfir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + e = ple3.find('EXCEPTIONS'); + ple3 = plist('EXCEPTIONS', [e {'iunits', 'ounits'}]); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test redesign from a standard type + results = [results utp_08]; % Test redesign from a pzmodel type + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the redesign method works with a vector of MFIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the redesign method works for a vector of MFIR objects as input. + % To keep this UTP simple use for the vector only one filter object. The + % different filters will be tested in an other UTP. + % + % + + try + % + hp = mfir(firhp); + hp.setIunits('Hz'); + hp.setOunits('m^-2/3'); + firvec = [hp, hp, hp]; + out1 = redesign(firvec, 123); + out2 = redesign(firvec, plist('fs', 123)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'firvec' + % 2) Check that each output MFIR contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(firvec)), atest = false; end + if ~isequal(size(out2), size(firvec)), atest = false; end + % Check each output against the redesign of the filter with the + % new frequency + firhp_123 = mfir(plist('type', 'highpass', 'fs', 123)); + for kk=1:numel(firvec) + if ~eq(out1(kk), firhp_123, ple3), atest = false; end + % The following values must have the same as the input values + if ~strcmp(out1(kk).name, hp.name), atest = false; end + if ~eq(out1(kk).iunits, hp.iunits), atest = false; end + if ~eq(out1(kk).ounits, hp.ounits), atest = false; end + end + % 'out1' must be the same as 'out2' + if ~eq(out1, out2, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the redesign method works with a matrix of MFIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the redesign method works for a matrix of MFIR objects as input. + % To keep this UTP simple use for the matrix only one filter object. The + % different filters will be tested in an other UTP. + % + % + + try + % + hp = mfir(firhp); + hp.setIunits('Hz'); + hp.setOunits('m^-2/3'); + firmat = [hp, hp, hp; hp, hp, hp]; + out1 = redesign(firmat, 123); + out2 = redesign(firmat, plist('fs', 123)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'firmat' + % 2) Check that each output MFIR contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(firmat)), atest = false; end + if ~isequal(size(out2), size(firmat)), atest = false; end + % Check each output against the redesign of the filter with the + % new frequency + firhp_123 = mfir(plist('type', 'highpass', 'fs', 123)); + for kk=1:numel(firmat) + if ~eq(out1(kk), firhp_123, ple3), atest = false; end + % The following values must have the same as the input values + if ~strcmp(out1(kk).name, hp.name), atest = false; end + if ~eq(out1(kk).iunits, hp.iunits), atest = false; end + if ~eq(out1(kk).ounits, hp.ounits), atest = false; end + end + % 'out1' must be the same as 'out2' + if ~eq(out1, out2, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the redesign method works with a list of MFIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the redesign method works for a list of MFIR objects as input. + % To keep this UTP simple use for the list only one filter object. The + % different filters will be tested in an other UTP. + % + % + + try + % + hp = mfir(firhp); + hp.setIunits('Hz'); + hp.setOunits('m^-2/3'); + out1 = redesign(hp, hp, hp, 123); + out2 = redesign(hp, hp, hp, plist('fs', 123)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output MFIR contains the correct data. + % + % + + atest = true; + firin = [hp, hp, hp]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 3, atest = false; end + if numel(out2) ~= 3, atest = false; end + % Check each output against the redesign of the filter with the + % new frequency + firhp_123 = mfir(plist('type', 'highpass', 'fs', 123)); + for kk=1:numel(firin) + if ~eq(out1(kk), firhp_123, ple3), atest = false; end + % The following values must have the same as the input values + if ~strcmp(out1(kk).name, hp.name), atest = false; end + if ~eq(out1(kk).iunits, hp.iunits), atest = false; end + if ~eq(out1(kk).ounits, hp.ounits), atest = false; end + end + % 'out1' must be the same as 'out2' + if ~eq(out1, out2, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the redesign method works with a mix of different shaped + % MFIR objects as input. + % + % + function result = utp_05 + + % + % + % Test that the redesign method works with an input of matrices and vectors + % and single MFIR objects. + % To keep this UTP simple use for the vector only one filter object. The + % different filters will be tested in an other UTP. + % + % + + try + % + hp = mfir(firhp); + hp.setIunits('Hz'); + hp.setOunits('m^-2/3'); + out1 = redesign(hp,[hp hp],hp,[hp hp hp; hp hp hp],hp, 123); + out2 = redesign(hp,[hp hp],hp,[hp hp hp; hp hp hp],hp, plist('fs', 123)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output MFIR contains the correct data. + % + % + + atest = true; + firin = [hp hp hp hp hp hp hp hp hp hp hp]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= numel(firin), atest = false; end + if numel(out2) ~= numel(firin), atest = false; end + % Check each output against the redesign of the filter with the + % new frequency + firhp_123 = mfir(plist('type', 'highpass', 'fs', 123)); + for kk=1:numel(firin) + if ~eq(out1(kk), firhp_123, ple3), atest = false; end + % The following values must have the same as the input values + if ~strcmp(out1(kk).name, hp.name), atest = false; end + if ~eq(out1(kk).iunits, hp.iunits), atest = false; end + if ~eq(out1(kk).ounits, hp.ounits), atest = false; end + end + % 'out1' must be the same as 'out2' + if ~eq(out1, out2, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the redesign method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the redesign method can be processed back. + % + % + + try + % + hp = mfir(firhp); + hp.setIunits('Hz'); + hp.setOunits('m^-2/3'); + out = redesign(hp, 123); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'redesign'. + % 2) Check that re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'redesign'), atest = false; end + % Run 'test.m' and check the result + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the redesign method redesigns a standard filter type. + % + % + function result = utp_07 + + % + % + % Tests that the redesign method redesigns a standard filter type. + % + % + + try + % + out1 = redesign(firhp, 123); + out2 = redesign(firlp, 123); + out3 = redesign(firbp, 123); + out4 = redesign(firbr, 123); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check the rebuilt object + % + % + + atest = true; + if stest + % + % Check each output against the redesign of the filter with the new + % frequency + hp_123 = mfir(plist('type', 'highpass', 'fs', 123)); + lp_123 = mfir(plist('type', 'lowpass', 'fs', 123)); + bp_123 = mfir(plist('type', 'bandpass', 'fs', 123, 'fc', [0.01 0.1])); + br_123 = mfir(plist('type', 'bandreject', 'fs', 123, 'fc', [0.01 0.1])); + if ~eq(out1, hp_123, ple3), atest = false; end + if ~eq(out2, lp_123, ple3), atest = false; end + if ~eq(out3, bp_123, ple3), atest = false; end + if ~eq(out4, br_123, ple3), atest = false; end + % Run 'test[1..4].m' and check the result + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + if ~eq(mout4, out4, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the redesign method redesigns a pzmodel filter type. + % + % + function result = utp_08 + + % + % + % Tests that the redesign method redesigns a pzmodel filter type. + % + % + + try + % + pzm = pzmodel(1, [pz(1) pz(200)], pz(50)); + pzm.setName(); + pl = plist('pzmodel', pzm, 'fs', 1000); + firpzm = mfir(pl); + out = redesign(firpzm, 123); + + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check the rebuilt object + % + % + + atest = true; + if stest + % + % Check each output against the redesign of the filter with the new + % frequency + pzm_123 = mfir(plist('pzmodel', pzm, 'fs', 123)); + if ~eq(out, pzm_123, ple3), atest = false; end + % Check the result of the rebuilt object. + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_resp.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_resp.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,1098 @@ +% UTP_MFIR_RESP a set of UTPs for the mfir/resp method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_resp.m,v 1.6 2010/03/15 15:57:06 ingo Exp $ +% + +% +% +% The resp method of the mfir class Make a frequency response of the filter. +% For a command with no output variables plots the method the result into a +% diagram. +% +% + +function results = utp_mfir_resp(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'resp'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MFIR objects + [fir1,fir2,fir3,fir4,fir5,fir6,firv,firm] = get_test_objects_mfir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test with f = ao.y + results = [results utp_11]; % Test with f + results = [results utp_12]; % Test with f1, f2 and nf + results = [results utp_13]; % Test with f1, f2 and nf AND 'scale' + results = [results utp_14]; % Test serial bank + results = [results utp_15]; % Test parallel bank + + % Make surethat all figures are closed + close all; + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'List')), atest = false; end + if ~any(strcmpi(io(2).sets, 'Range')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'List' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('f'), atest = false; end + if ~io(3).plists.isparam('bank'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('f')), atest = false; end + if ~isequal(io(3).plists.find('bank'), 'none'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('f'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('bank'), {'none', 'serial', 'parallel'}), atest = false; end + %%%%%%%%%% SET 'Range' + if io(4).plists.nparams ~= 5, atest = false; end + % Check key + if ~io(4).plists.isparam('f1'), atest = false; end + if ~io(4).plists.isparam('f2'), atest = false; end + if ~io(4).plists.isparam('nf'), atest = false; end + if ~io(4).plists.isparam('scale'), atest = false; end + if ~io(4).plists.isparam('bank'), atest = false; end + % Check default value + if ~isEmptyDouble(io(4).plists.find('f1')), atest = false; end + if ~isEmptyDouble(io(4).plists.find('f2')), atest = false; end + if ~isequal(io(4).plists.find('nf'), 1000), atest = false; end + if ~isequal(io(4).plists.find('scale'), 'log'), atest = false; end + if ~isequal(io(4).plists.find('bank'), 'none'), atest = false; end + % Check options + if ~isequal(io(4).plists.getOptionsForParam('f1'), {[]}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('f2'), {[]}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('nf'), {1000}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('scale'), {'lin', 'log'}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('bank'), {'none', 'serial', 'parallel'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the resp method works with a vector of MFIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the resp method works for a vector of MFIR objects as input. + % Test the method with an output and with no output (a diagram must appear) + % + % + + try + % + % Make sure that all figures are closed. + close all; + resp(firv); + out = resp(firv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Test the right number of lines in the diagram. + % 2) Check that the number of elements in 'out' is the same as in 'firv' + % 3) Check that each output MFIR contains the correct data. + % + % + + THRESHOLD = 1e-12; + atest = true; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + % Check that the diagram have the same number of lines as the output + % object + if max(cellfun('size', lines, 1)) ~= numel(firv), atest = false; end + % Check the number of output objects. + if ~isequal(size(out), size(firv)), atest = false; end + % Check each output against the default values for f1, f2 and nf + for ii = 1:numel(out) + nf = find(mfir.getInfo('resp', 'Range').plists, 'nf'); + % Default values always from the first filter + f1 = firv(ii).fs/1000; + f2 = firv(ii).fs/2-1/nf; + if ~isa(out(ii), 'ao'), atest = false; end + if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end + if out(ii).x(1) ~= f1, atest = false; end + if abs(out(ii).x(end)-f2)>THRESHOLD, atest = false; end + if numel(out(ii).x) ~= nf, atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the resp method works with a matrix of MFIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the resp method works for a matrix of MFIR objects as input. + % Test the method with an output and with no output (a diagram must appear) + % + % + + try + % + % Make sure that all figures are closed. + close all; + firmat = [fir1, fir2, fir3; fir4, fir5, fir6]; + resp(firmat); + out = resp(firmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Test the right number of lines in the diagram. + % 2) Check that the number of elements in 'out' is the same as in 'firmat' + % 3) Check that each output MFIR contains the correct data. + % + % + + atest = true; + THRESHOLD = 1e-12; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + % Check that the diagram have the same number of lines as the output + % object + if max(cellfun('size', lines, 1)) ~= numel(firmat), atest = false; end + % Check the number of output objects. + if ~isequal(size(out), size(firmat)), atest = false; end + % Check each output against the default values for f1, f2 and nf + for ii = 1:numel(out) + % Default values always from the first filter + nf = find(mfir.getInfo('resp', 'Range').plists, 'nf'); + f1 = firmat(ii).fs/1000; + f2 = firmat(ii).fs/2-1/nf; + if ~isa(out(ii), 'ao'), atest = false; end + if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end + if out(ii).x(1) ~= f1, atest = false; end + if abs(out(ii).x(end)-f2)>THRESHOLD, atest = false; end + if numel(out(ii).x) ~= nf, atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the resp method works with a list of MFIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the resp method works for a list of MFIR objects as input. + % Test the method with an output and with no output (a diagram must appear) + % + % + + try + % + close all; + resp(fir1,fir2,fir3); + out = resp(fir1,fir2,fir3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Test the right number of lines in the diagram. + % 2) Check that the number of elements in 'out' is the same as in 'firmat' + % 3) Check that each output MFIR contains the correct data. + % + % + + atest = true; + firin = [fir1,fir2,fir3]; + THRESHOLD = 1e-15; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + % Check that the diagram have the same number of lines as the output + % object + if max(cellfun('size', lines, 1)) ~= numel(firin), atest = false; end + % Check the number of output objects. + if ~isequal(size(out), size(firin)), atest = false; end + % Check each output against the default values for f1, f2 and nf + for ii = 1:numel(out) + % Default values always from the first filter + nf = find(mfir.getInfo('resp', 'Range').plists, 'nf'); + f1 = firin(ii).fs/1000; + f2 = firin(ii).fs/2-1/nf; + if ~isa(out(ii), 'ao'), atest = false; end + if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end + if out(ii).x(1) ~= f1, atest = false; end + if abs(out(ii).x(end)-f2)>THRESHOLD, atest = false; end + if numel(out(ii).x) ~= nf, atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the resp method works with a mix of different shaped MFIR + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the resp method works with an input of matrices and vectors + % and single MFIR objects. Test the method with an output and with no + % output (a diagram must appear) + % + % + + try + % + close all; + firmat = [fir5, fir3, fir2; fir1, fir5, fir3]; + resp(fir1,firv,fir2,firmat,fir3); + out = resp(fir1,firv,fir2,firmat,fir3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Test the right number of lines in the diagram. + % 2) Check that the number of elements in 'out' is the same as in 'firmat' + % 3) Check that each output MFIR contains the correct data. + % + % + + atest = true; + firin = [fir1,reshape(firv,1,[]),fir2,reshape(firmat,1,[]),fir3]; + THRESHOLD = 1e-12; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + % Check that the diagram have the same number of lines as the output + % object + if max(cellfun('size', lines, 1)) ~= numel(firin), atest = false; end + % Check the number of output objects. + if ~isequal(size(out), size(firin)), atest = false; end + % Check each output against the default values for f1, f2 and nf + for ii = 1:numel(out) + % Default values always from the first filter + nf = find(mfir.getInfo('resp', 'Range').plists, 'nf'); + f1 = firin(ii).fs/1000; + f2 = firin(ii).fs/2-1/nf; + if ~isa(out(ii), 'ao'), atest = false; end + if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end + if out(ii).x(1) ~= f1, atest = false; end + if abs(out(ii).x(end)-f2)>THRESHOLD, atest = false; end + if numel(out(ii).x) ~= nf, atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the resp method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the resp method can be processed back. + % + % + + try + % + close all; + resp(fir5); + out = resp(fir5); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'resp'. + % 2) Check that re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + x = get(lines{1}, 'XData'); + y1 = get(lines{1}, 'YData'); + y2 = get(lines{2}, 'YData'); + if ~isequal(x, out.x.'), atest = false; end + if ~isequal(y2, abs(out.y)'), atest = false; end + if ~isequal(y1, utils.math.phase(out.y)'), atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'resp'), atest = false; end + % Run 'test.m' and check the result + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that modify command plots the response into a diagram. + % + % + function result = utp_07 + + % + % + % Tests that modify command plots the response into a diagram. + % + % + + try + % + close all; + fir5.resp(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the response diagram. + % + % + + atest = true; + THRESHOLD = 1e-12; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + x = get(lines{1}, 'XData'); + % Default values always from the first filter + nf = find(mfir.getInfo('resp', 'Range').plists, 'nf'); + f1 = fir5(1).fs/1000; + f2 = fir5(1).fs/2-1/nf; + if x(1) ~= f1, atest = false; end + if abs(x(end)-f2)>THRESHOLD, atest = false; end + if numel(x) ~= nf, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the output AO of the resp method keeps the shape of the used + % input f vector. + % + % + + try + % + close all; + arow = ao(1:100, linspace(.1, 5, 100)); + acol = arow.'; + f = linspace(.1, 5, 100); + out1 = resp(fir5, plist('f', arow)); + out2 = resp(fir5, plist('f', acol)); + out3 = resp(fir5, plist('f', f)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,1) ~= 1, atest = false; end + if size(out1.data.y,2) == 1, atest = false; end + if size(out2.data.y,1) == 1, atest = false; end + if size(out2.data.y,2) ~= 1, atest = false; end + if size(out3.data.y,1) ~= 1, atest = false; end + if size(out3.data.y,2) == 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the resp method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = resp(fir5, fir3); + o3 = resp(fir5, fir3); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the resp method uses the x-data of an input AO for f-vector. + % + % + function result = utp_10 + + % + % + % Call the method with different method to pass an AO in. + % + % + + try + % + f1 = .1; + f2 = 5; + nf = 100; + axy = ao(linspace(f1, f2, nf), randn(100,1)); + afs = ao(linspace(f1, f2, nf), randn(100,1), plist('type', 'fsdata')); + out1 = resp(fir5, plist('f', axy)); + out2 = resp(fir5, plist('f', afs)); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the output + if ~isa(out1, 'ao'), atest = false; end + if ~isa(out2, 'ao'), atest = false; end + if out1.x(1) ~= f1, atest = false; end + if out1.x(end) ~= f2, atest = false; end + if numel(out1.x) ~= nf, atest = false; end + if out2.x(1) ~= f1, atest = false; end + if out2.x(end) ~= f2, atest = false; end + if numel(out2.x) ~= nf, atest = false; end + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_11 + + % + % + % Check that the resp method uses the specified f-vector to compute the response. + % + % + function result = utp_11 + + % + % + % Call the method with different method to pass an f-vector in. + % + % + + try + % + f1 = .1; + f2 = 5; + nf = 100; + f = linspace(f1, f2, nf); + out1 = resp(fir5, plist('f', f)); + + mout1 = rebuild(out1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the output + if ~isa(out1, 'ao'), atest = false; end + if out1.x(1) ~= f1, atest = false; end + if out1.x(end) ~= f2, atest = false; end + if numel(out1.x) ~= nf, atest = false; end + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_11 + + %% UTP_12 + + % + % + % Check that the resp method uses the specified f1, f2, and nf to compute the response. + % + % + function result = utp_12 + + % + % + % Call the method with different method to pass f1, f2, and nf in. + % + % + + try + % + f1 = .1; + f2 = 5; + nf = 100; + nf2 = 123; + out3 = resp(fir5, plist('f1', f1, 'f2', f2, 'nf', nf)); + out4 = resp(fir5, plist('f1', f1, 'nf', nf2)); + out5 = resp(fir5, plist('f2', f2)); + + mout3 = rebuild(out3); + mout4 = rebuild(out4); + mout5 = rebuild(out5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + T = 1e-12; + if stest + % + % Check the output + nfd = find(mfir.getInfo('resp', 'Range').plists, 'nf'); + f1d = fir5.fs/1000; + f2d = fir5.fs/2-1/nf; + f2d2 = fir5.fs/2-1/nf2; + if ~isa(out3, 'ao'), atest = false; end + if ~isa(out4, 'ao'), atest = false; end + if ~isa(out5, 'ao'), atest = false; end + if out3.x(1) ~= f1, atest = false; end + if abs(out3.x(end)-f2)>T, atest = false; end + if numel(out3.x) ~= nf, atest = false; end + if out4.x(1) ~= f1, atest = false; end + if abs(out4.x(end)-f2d2)>T, atest = false; end % Default values + if numel(out4.x) ~= nf2, atest = false; end + if out5.x(1) ~= f1d, atest = false; end % Default values + if abs(out5.x(end)-f2)>T, atest = false; end + if numel(out5.x) ~= nfd, atest = false; end % Default values + % Check the rebuilding of the object + if ~eq(out3, mout3, ple2), atest = false; end + if ~eq(out4, mout4, ple2), atest = false; end + if ~eq(out5, mout5, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Check that the resp method uses the specified f1, f2, and nf to compute the response. + % + % + function result = utp_13 + + % + % + % Call the method with different method to pass f1, f2, and nf in. + % + % + + try + % + f1 = .1; + f2 = 5; + nf = 123; + out1 = resp(fir5, plist('f1', f1, 'f2', f2, 'nf', nf, 'scale', 'lin')); + out2 = resp(fir5, plist('f1', f1, 'f2', f2, 'nf', nf, 'scale', 'log')); + out3 = resp(fir5, plist('scale', 'lin')); + out4 = resp(fir5, plist('scale', 'log')); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + T = 10e-12; + if stest + % + % Check the output + nfd = find(mfir.getInfo('resp', 'Range').plists, 'nf'); + f1d = fir5.fs/1000; + f2d = fir5.fs/2-1/nfd; + if ~isa(out1, 'ao'), atest = false; end + if ~isa(out2, 'ao'), atest = false; end + if ~isa(out3, 'ao'), atest = false; end + if ~isa(out4, 'ao'), atest = false; end + xlin1 = linspace(f1, f2, nf); + xlin2 = linspace(f1d, f2d, nfd); + xlog1 = logspace(log10(f1), log10(f2), nf); + xlog2 = logspace(log10(f1d), log10(f2d), nfd); + if ~isequal(xlin1, out1.x'), atest = false; end + if ~isequal(xlin2, out3.x'), atest = false; end + if ~isequal(xlog1, out2.x'), atest = false; end + if ~isequal(xlog2, out4.x'), atest = false; end + + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + if ~eq(out3, mout3, ple2), atest = false; end + if ~eq(out4, mout4, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + %% UTP_14 + + % + % + % Check that the resp method the response of a serial filter bank. + % + % + function result = utp_14 + + % + % + % Check that the resp method the response of a serial filter bank. + % + % + + try + % + out = resp(fir1, fir2, plist('bank', 'serial')); + + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the output + if ~isa(out, 'ao'), atest = false; end + if numel(out) ~= 1, atest = false; end + s1 = resp(fir1); + s2 = resp(fir2); + stot = s1 .* s2; + if ~isequal(stot.x, out.x), atest = false; end + if ~isequal(stot.y, out.y), atest = false; end + % Check the rebuilding of the object + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_14 + + %% UTP_15 + + % + % + % Check that the resp method the response of a parallel filter bank. + % + % + function result = utp_15 + + % + % + % Check that the resp method the response of a parallel filter bank. + % + % + + try + % + out = resp(fir1, fir2, plist('bank', 'parallel')); + + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + T = 10e-12; + if stest + % + % Check the output + if ~isa(out, 'ao'), atest = false; end + if numel(out) ~= 1, atest = false; end + s1 = resp(fir1); + s2 = resp(fir2); + stot = s1 + s2; + if ~isequal(stot.x, out.x), atest = false; end + if ~isequal(stot.y, out.y), atest = false; end + % Check the rebuilding of the object + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_15 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_save.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_save.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,765 @@ +% UTP_MFIR_SAVE a set of UTPs for the mfir/save method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_save.m,v 1.7 2010/08/31 09:43:48 hewitson Exp $ +% + +% +% +% The save method of the mfir class saves a mfir object to disk. Save stores +% the variables in a MATLAB formatted file (MAT-file) named filename.mat or in a +% XML fromat named filename.xml +% +% + +function results = utp_mfir_save(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'save'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MFIR objects + [firhp,firlp,firbp,firbr,firpzm,firao,firv,firm] = get_test_objects_mfir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test plist contains the filename + results = [results utp_09]; % Test with standard MFIR objects + results = [results utp_10]; % Test MFIR which is build from a pzmodel + results = [results utp_11]; % Test MFIR which is build from a AO + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(3).plists.isparam('filename'), atest = false; end + if ~io(3).plists.isparam('prefix'), atest = false; end + if ~io(3).plists.isparam('postfix'), atest = false; end + if ~io(3).plists.isparam('individual files'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('filename'), ''), atest = false; end + if ~isequal(io(3).plists.find('prefix'), ''), atest = false; end + if ~isequal(io(3).plists.find('postfix'), ''), atest = false; end + if ~isequal(io(3).plists.find('individual files'), false), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('filename'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the save method works with a vector of MFIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the save method works for a vector of MFIR objects as input. + % Test both formats 'xml' and 'mat'. + % + % + + try + % + save(firv, 'test.xml'); + save(firv, 'test.mat'); + out1 = mfir('test.xml'); + out2 = mfir('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the same + % as in 'firv' + % 2) Check that the loaded objects are the same as the saved objects. + % 3) The outputs 'out1' and 'out2' must be the same. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(firv)), atest = false; end + if ~isequal(size(out2), size(firv)), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(firv(kk), out1(kk), ple1), atest = false; end + if ~eq(firv(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the save method works with a matrix of MFIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the save method works for a matrix of MFIR objects as input. + % Test both formats 'xml' and 'mat'. + % + % + + try + % + save(firm, 'test.xml'); + save(firm, 'test.mat'); + out1 = mfir('test.xml'); + out2 = mfir('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the same + % as in 'firm' + % 2) Check that the loaded objects are the same as the saved objects. + % 3) The outputs 'out1' and 'out2' must be the same. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(firm)), atest = false; end + if ~isequal(size(out2), size(firm)), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(firm(kk), out1(kk), ple1), atest = false; end + if ~eq(firm(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the save method works with a list of MFIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the save method works for a list of MFIR objects as input. + % Test both formats 'xml' and 'mat'. + % + % + + try + % + save(firhp, firpzm, firbr, 'test.xml'); + save(firhp, firpzm, firbr, 'test.mat'); + out1 = mfir('test.xml'); + out2 = mfir('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the same + % as in the list + % 2) Check that the loaded objects are the same as the saved objects. + % 3) The outputs 'out1' and 'out2' must be the same. + % + % + + atest = true; + firin = [firhp, firpzm, firbr]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 3, atest = false; end + if numel(out2) ~= 3, atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(firin(kk), out1(kk), ple1), atest = false; end + if ~eq(firin(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the save method works with a mix of different shaped MFIR objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the save method works with an input of matrices and vectors + % and single MFIR objects. Test both formats 'xml' and 'mat'. + % + % + + try + % + save(firhp,firv,firpzm, 'test.xml'); + save(firhp,firv,firpzm, 'test.mat'); + out1 = mfir('test.xml'); + out2 = mfir('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output MFIR object contains the correct data. + % + % + + atest = true; + firin = [firhp, reshape(firv, 1, []), firpzm]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 2+numel(firv), atest = false; end + if numel(out2) ~= 2+numel(firv), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(firin(kk), out1(kk), ple1), atest = false; end + if ~eq(firin(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the save method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the save method can be processed back + % to an m-file. Do this for both extensions 'mat' and 'xml' + % + % + + try + % + out1 = save(firao, 'test.xml'); + out2 = save(firpzm, 'test.mat'); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history applies to the output object. Check that + % save doesn't add a history step to the input object. + % 2) Check that the read object doesn't contain the save + load history steps. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % The last history step is the save method + if strcmp(out1.hist.methodInfo.mname, 'save'), atest = false; end + if strcmp(out2.hist.methodInfo.mname, 'save'), atest = false; end + if ~eq(out1.hist, firao.hist), atest = false; end + if ~eq(out2.hist, firpzm.hist), atest = false; end + % check the history steps of the read object (load + save) + outr1 = mfir('test.xml'); + outr2 = mfir('test.mat'); + if strcmp(outr1.hist.methodInfo.mname, 'mfir'), atest = false; end + if strcmp(outr1.hist.inhists.methodInfo.mname, 'save'), atest = false; end + if strcmp(outr2.hist.methodInfo.mname, 'mfir'), atest = false; end + if strcmp(outr2.hist.inhists.methodInfo.mname, 'save'), atest = false; end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + % delete test file + delete('test.xml') + delete('test.mat') + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the save method works with the modify command. + % + % + function result = utp_07 + + % + % + % Use the save method with the modifier command. + % + % + + try + % + % copy firhp to work with + fir_mat = mfir(firhp); + fir_mat.save('test.mat'); + fir_xml = mfir(firhp); + fir_xml.save('test.xml'); + out1 = mfir('test.mat'); + out2 = mfir('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the save method applies the history. + % 2) Check the output against the input. + % + % + + atest = true; + if stest + % + % Check that the modified object have the 'save' method as the last + % history step + if strcmp(fir_xml.hist.methodInfo.mname, 'save'), atest = false; end + if strcmp(fir_mat.hist.methodInfo.mname, 'save'), atest = false; end + % Check the output without the history + if ~eq(fir_mat, out1, ple1), atest = false; end + if ~eq(fir_xml, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the save method uses the filename which is stored in a plist. + % + % + + try + % + pl1 = plist('filename', 'test.mat'); + pl2 = plist('filename', 'test.xml'); + save(firbp, pl1); + save(firbp, pl2); + out1 = mfir('test.mat'); + out2 = mfir('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + % Check the output + if ~eq(firbp, out1, ple1), atest = false; end + if ~eq(firbp, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test the save method with standard MFIR objects. + % + % + function result = utp_09 + + % + % + % Save all standard MFIR objects with both extensions. + % + % + + try + % + save(firhp, 'test_hp.mat'); % highpass + save(firhp, 'test_hp.xml'); % highpass + save(firlp, 'test_lp.mat'); % lowpass + save(firlp, 'test_lp.xml'); % lowpass + save(firbp, 'test_bp.mat'); % bandpass + save(firbp, 'test_bp.xml'); % bandpass + save(firbr, 'test_br.mat'); % bandreject + save(firbr, 'test_br.xml'); % bandreject + out1 = mfir('test_hp.mat'); + out2 = mfir('test_hp.xml'); + out3 = mfir('test_lp.mat'); + out4 = mfir('test_lp.xml'); + out5 = mfir('test_bp.mat'); + out6 = mfir('test_bp.xml'); + out7 = mfir('test_br.mat'); + out8 = mfir('test_br.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + % Check highpass + if ~eq(firhp, out1, ple1), atest = false; end + if ~eq(firhp, out2, ple1), atest = false; end + if ~eq(firlp, out3, ple1), atest = false; end + if ~eq(firlp, out4, ple1), atest = false; end + if ~eq(firbp, out5, ple1), atest = false; end + if ~eq(firbp, out6, ple1), atest = false; end + if ~eq(firbr, out7, ple1), atest = false; end + if ~eq(firbr, out8, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + if ~eq(out3, out4, ple1), atest = false; end + if ~eq(out5, out6, ple1), atest = false; end + if ~eq(out7, out8, ple1), atest = false; end + % + delete('test_hp.mat'); + delete('test_hp.xml'); + delete('test_lp.mat'); + delete('test_lp.xml'); + delete('test_bp.mat'); + delete('test_bp.xml'); + delete('test_br.mat'); + delete('test_br.xml'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Test the save method with MFIR object which is created from a pole/zero model + % + % + function result = utp_10 + + % + % + % Save MFIR object which is created from a pzmodel. + % + % + + try + % + % Create a MFIR object from a pole/zero model + fir = mfir(plist('pzmodel', pzmodel(1,{[1 4], 2}, 3), 'Nsecs', 10, 'fs', 37)); + save(fir, 'test.mat'); + save(fir, 'test.xml'); + out1 = mfir('test.mat'); + out2 = mfir('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + % Check the output + if ~eq(fir, out1, ple1), atest = false; end + if ~eq(fir, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_11 + + % + % + % Test the save method with MFIR object which is created from an analysis + % model. + % + % + function result = utp_11 + + % + % + % Save MFIR object which is created from an analysis model. + % + % + + try + % + % Create a MFIR object from an analysis model + aa = ao(plist('fsfcn', '1./(50+f)', 'f', linspace(0, 500, 1000))); + aa.setFs(1000); + fir = mfir(aa); + save(fir, 'test.mat'); + save(fir, 'test.xml'); + out1 = mfir('test.mat'); + out2 = mfir('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + % Check the output + if ~eq(fir, out1, ple1), atest = false; end + if ~eq(fir, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_11 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_setHistout.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_setHistout.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,477 @@ +% UTP_MFIR_SETHISTOUT a set of UTPs for the mfir/setHistout method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_setHistout.m,v 1.7 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The setHistout method of the mfir class sets the histout property. +% +% + +function results = utp_mfir_setHistout(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'setHistout'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MFIR objects + [firhp,firlp,firbp,firbr,firpzm,firao,firv,firm] = get_test_objects_mfir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('histout'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('histout')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('histout'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setHistout method works with a vector of MFIR objects as input. + % + % + function result = utp_02 + + % + % + % The setHistout should set the output history (histout) of each input. + % + % + + try + % + vals = [1 2 3]; + out = setHistout(firv, vals); + % + stest = true; + catch err + stest = false; + end + + % + % + % 1) Check the histout has the correct values + % + % + + atest = true; + if stest + % + if ~isequal(out.histout, vals), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setHistout method works with a matrix of MFIR objects as input. + % + % + function result = utp_03 + + % + % + % The setHistout should set the output history (histout) of each input. + % + % + + try + % + vals = [1 2 3]; + out = setHistout(firm, vals); + % + stest = true; + catch err + stest = false; + end + + % + % + % 1) Check the histout has the correct values + % + % + + atest = true; + if stest + % + if ~isequal(out.histout, vals), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setHistout method works with a list of MFIR objects as input. + % + % + function result = utp_04 + + % + % + % The setHistout should set the output history (histout) of each input. + % + % + + try + % + vals = [1 2 3]; + out = setHistout(firhp,firpzm,firbp, vals); + % + stest = true; + catch err + stest = false; + end + + % + % + % 1) Check the histout has the correct values + % + % + + atest = true; + if stest + % + if ~isequal(out.histout, vals), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setHistout method works with a mix of different shaped MFIR + % objects as input. + % + % + function result = utp_05 + + % + % + % The setHistout method is not designed for this call, for that reason must + % this call fail. + % + % + + try + % + vals = [1 2 3]; + out = setHistout(firhp,firv,firpzm,firm,firbp, vals); + % + stest = true; + catch err + stest = fail; + end + + % + % + % 1) Check the histout has the correct values + % + % + + atest = true; + if stest + % + if ~isequal(out.histout, vals), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setHistout method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setHistout method can be processed back + % to an m-file. + % + % + + try + % + out1 = setHistout(firhp, [1 2 3]); + out2 = testCallerIsMethod(@setHistout, firhp, [1 2 3]); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setHistout'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setHistout'. + % 3) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setHistout') && ... + eq(out1.hist.plistUsed, plist('histout', [1 2 3]), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('histout', [1 2 3]), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'histout'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setHistout method can modify the input MFIR object. + % + % + function result = utp_07 + + % + % + % Test that the setHistout method can modify the input MFIR object + % by calling with no output. + % + % + + try + % + % copy firhp to work with + ain = mfir(firhp); + % modify ain + aout = ain.setHistout([1 2 3]); + ain.setHistout([1 2 3]); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'firhp' and 'ain' are now different. + % 2) Check that 'ain' has the correct histout field + % + % + + atest = true; + if stest + % + % Check that setHistout modified the input by comparing to the copy + if eq(mfir(firhp), ain, ple1), atest = false; end + % Check that setHistout doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~eq(ain.histout, [1 2 3]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setHistout method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setHistout method can modify the property 'histout' + % with a value in a plist. + % + % + + try + % + pl = plist('histout', [1 2 3]); + out = firhp.setHistout(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct histout field + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'histout' + if ~eq(out.histout, [1 2 3]), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_setIunits.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_setIunits.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,561 @@ +% UTP_MFIR_SETIUNITS a set of UTPs for the mfir/setIunits method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_setIunits.m,v 1.7 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The setIunits method of the mfir class sets the iunits property. +% +% + +function results = utp_mfir_setIunits(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'setIunits'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MFIR objects + [firhp,firlp,firbp,firbr,firpzm,firao,firv,firm] = get_test_objects_mfir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('iunits'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('iunits')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('iunits'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setIunits method works with a vector of MFIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the setIunits method works for a vector of MFIR objects as input. + % + % + + try + % + out = setIunits(firv, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'firv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(firv)), atest = false; end + % Check iunits field of each output + for kk=1:numel(out) + if ~eq(out(kk).iunits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setIunits method works with a matrix of MFIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the setIunits method works for a matrix of MFIR objects as input. + % + % + + try + % + out = setIunits(firm, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'firm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(firm)), atest = false; end + % Check iunits field of each output + for kk=1:numel(out) + if ~eq(out(kk).iunits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setIunits method works with a list of MFIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the setIunits method works for a list of MFIR objects as input. + % + % + + try + % + out = setIunits(firhp,firpzm,firbp, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~eq(out(1).iunits, unit('Hz')), atest = false; end + if ~eq(out(2).iunits, unit('Hz')), atest = false; end + if ~eq(out(3).iunits, unit('Hz')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setIunits method works with a mix of different shaped MFIR + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the setIunits method works with an input of matrices and vectors + % and single MFIR objects. + % + % + + try + % + out = setIunits(firhp,firv,firpzm,firm,firbp, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(firm)+numel(firv)), atest = false; end + for kk=1:numel(out) + if ~eq(out(kk).iunits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setIunits method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setIunits method can be processed back + % to an m-file. + % + % + + try + % + out1 = setIunits(firhp, unit('Hz')); + out2 = testCallerIsMethod(@setIunits, firhp, unit('Hz')); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setIunits'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setIunits'. + % 3) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setIunits') && ... + eq(out1.hist.plistUsed, plist('iunits', unit('Hz')), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('iunits', unit('Hz')), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'iunits'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setIunits method can modify the input MFIR object. + % + % + function result = utp_07 + + % + % + % Test that the setIunits method can modify the input MFIR object + % by calling with no output. + % + % + + try + % + % copy firhp to work with + ain = mfir(firhp); + % modify ain + aout = ain.setIunits(unit('Hz')); + ain.setIunits(unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'firhp' and 'ain' are now different. + % 2) Check that 'ain' has the correct iunits field + % + % + + atest = true; + if stest + % + % Check that setIunits modified the input by comparing to the copy + if eq(mfir(firhp), ain, ple1), atest = false; end + % Check that setIunits doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~eq(ain.iunits, unit('Hz')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setIunits method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setIunits method can modify the property 'iunits' + % with a value in a plist. + % + % + + try + % + pl = plist('iunits', unit('Hz')); + out = firhp.setIunits(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct iunits field + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'iunits' + if ~eq(out.iunits, unit('Hz')), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setIunits method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setIunits(firhp, firlp, unit('mol')); + o3 = setIunits(firhp, firlp, unit('mol')); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_setName.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_setName.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,561 @@ +% UTP_MFIR_SETNAME a set of UTPs for the mfir/setName method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_setName.m,v 1.7 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The setName method of the mfir class sets the name property. +% +% + +function results = utp_mfir_setName(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'setName'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MFIR objects + [firhp,firlp,firbp,firbr,firpzm,firao,firv,firm] = get_test_objects_mfir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + +% % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('name'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('name')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('name'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setName method works with a vector of MFIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the setName method works for a vector of MFIR objects as input. + % + % + + try + % + out = setName(firv, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'firv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(firv)), atest = false; end + % Check name field of each output + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setName method works with a matrix of MFIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the setName method works for a matrix of MFIR objects as input. + % + % + + try + % + out = setName(firm, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'firm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(firm)), atest = false; end + % Check name field of each output + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setName method works with a list of MFIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the setName method works for a list of MFIR objects as input. + % + % + + try + % + out = setName(firhp,firpzm,firbp, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~strcmp(out(1).name, 'my name'), atest = false; end + if ~strcmp(out(2).name, 'my name'), atest = false; end + if ~strcmp(out(3).name, 'my name'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setName method works with a mix of different shaped MFIR + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the setName method works with an input of matrices and vectors + % and single MFIR objects. + % + % + + try + % + out = setName(firhp,firv,firpzm,firm,firbp, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(firm)+numel(firv)), atest = false; end + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setName method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setName method can be processed back + % to an m-file. + % + % + + try + % + out1 = setName(firhp, 'my name'); + out2 = testCallerIsMethod(@setName, firhp, 'my name'); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setName'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setName'. + % 3) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setName') && ... + eq(out1.hist.plistUsed, plist('name', 'my name'), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('name', 'my name'), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'name'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setName method can modify the input MFIR object. + % + % + function result = utp_07 + + % + % + % Test that the setName method can modify the input MFIR object + % by calling with no output. + % + % + + try + % + % copy firhp to work with + ain = mfir(firhp); + % modify ain + aout = ain.setName('my name'); + ain.setName('my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'firhp' and 'ain' are now different. + % 2) Check that 'ain' has the correct name field + % + % + + atest = true; + if stest + % + % Check that setName modified the input by comparing to the copy + if eq(mfir(firhp), ain, ple1), atest = false; end + % Check that setName doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~strcmp(ain.name, 'my name'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setName method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setName method can modify the property 'name' + % with a value in a plist. + % + % + + try + % + pl = plist('name', 'my name'); + out = firhp.setName(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct name field + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'name' + if ~strcmp(out.name, 'my name'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setName method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setName(firhp, firlp, 'new name'); + o3 = setName(firhp, firlp, 'new name'); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_setOunits.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_setOunits.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,561 @@ +% UTP_MFIR_SETOUNITS a set of UTPs for the mfir/setOunits method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_setOunits.m,v 1.7 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The setOunits method of the mfir class sets the ounits property. +% +% + +function results = utp_mfir_setOunits(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'setOunits'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MFIR objects + [firhp,firlp,firbp,firbr,firpzm,firao,firv,firm] = get_test_objects_mfir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('ounits'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('ounits')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('ounits'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setOunits method works with a vector of MFIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the setOunits method works for a vector of MFIR objects as input. + % + % + + try + % + out = setOunits(firv, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'firv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(firv)), atest = false; end + % Check ounits field of each output + for kk=1:numel(out) + if ~eq(out(kk).ounits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setOunits method works with a matrix of MFIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the setOunits method works for a matrix of MFIR objects as input. + % + % + + try + % + out = setOunits(firm, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'firm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(firm)), atest = false; end + % Check ounits field of each output + for kk=1:numel(out) + if ~eq(out(kk).ounits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setOunits method works with a list of MFIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the setOunits method works for a list of MFIR objects as input. + % + % + + try + % + out = setOunits(firhp,firpzm,firbp, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~eq(out(1).ounits, unit('Hz')), atest = false; end + if ~eq(out(2).ounits, unit('Hz')), atest = false; end + if ~eq(out(3).ounits, unit('Hz')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setOunits method works with a mix of different shaped MFIR + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the setOunits method works with an input of matrices and vectors + % and single MFIR objects. + % + % + + try + % + out = setOunits(firhp,firv,firpzm,firm,firbp, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(firm)+numel(firv)), atest = false; end + for kk=1:numel(out) + if ~eq(out(kk).ounits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setOunits method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setOunits method can be processed back + % to an m-file. + % + % + + try + % + out1 = setOunits(firhp, unit('Hz')); + out2 = testCallerIsMethod(@setOunits, firhp, unit('Hz')); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setOunits'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setOunits'. + % 3) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setOunits') && ... + eq(out1.hist.plistUsed, plist('ounits', unit('Hz')), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('ounits', unit('Hz')), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'ounits'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setOunits method can modify the input MFIR object. + % + % + function result = utp_07 + + % + % + % Test that the setOunits method can modify the input MFIR object + % by calling with no output. + % + % + + try + % + % copy firhp to work with + ain = mfir(firhp); + % modify ain + aout = ain.setOunits(unit('Hz')); + ain.setOunits(unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'firhp' and 'ain' are now different. + % 2) Check that 'ain' has the correct ounits field + % + % + + atest = true; + if stest + % + % Check that setOunits modified the input by comparing to the copy + if eq(mfir(firhp), ain, ple1), atest = false; end + % Check that setOunits doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~eq(ain.ounits, unit('Hz')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setOunits method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setOunits method can modify the property 'ounits' + % with a value in a plist. + % + % + + try + % + pl = plist('ounits', unit('Hz')); + out = firhp.setOunits(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct ounits field + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'ounits' + if ~eq(out.ounits, unit('Hz')), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setOunits method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setOunits(firhp, firlp, unit('mol')); + o3 = setOunits(firhp, firlp, unit('mol')); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_string.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_string.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,428 @@ +% UTP_MFIR_STRING a set of UTPs for the mfir/string method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_string.m,v 1.2 2009/07/23 12:33:01 ingo Exp $ +% + +% +% +% The string method of the mfir class writes a command string that can be +% used to recreate the input object(s). But the object should not have more than +% one history step. +% +% + +function results = utp_mfir_string(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'string'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + fir1 = mfir(plist('type', 'lowpass')); + fir2 = mfir(plist('type', 'highpass')); + firv = [fir1, fir2, fir1]; + firm = [fir1, fir2, fir1; fir1, fir2, fir1]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Negative test: The object have more than one history step. + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the string method works with a vector of MFIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the string method works for a vector of MFIR objects as input. + % + % + + try + % + out = string(firv); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end; + if ~isa(rout, 'mfir'), atest = false; end + if numel(rout) ~= numel(firv), atest = false; end + for kk = 1:numel(firv) + if eq(rout(kk), firv(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the string method works with a matrix of MFIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the string method works for a matrix of MFIR objects as input. + % + % + + try + % + out = string(firm); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'mfir'), atest = false; end + if numel(rout) ~= numel(firm), atest = false; end + for kk = 1:numel(firm) + if eq(rout(kk), firm(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the string method works with a list of MFIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the string method works for a list of MFIR objects as input. + % + % + + try + % + out = string(fir1,fir2); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + firin = [fir1, fir2]; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'mfir'), atest = false; end + if numel(rout) ~= numel(firin), atest = false; end + for kk = 1:numel(firin) + if eq(rout(kk), firin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the string method works with a mix of different shaped MFIR objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the string method works with an input of matrices and vectors + % and single MFIR objects. + % + % + + try + % + out = string(fir1,firm,fir2); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + firin = [fir1, reshape(firm, 1, []), fir2]; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'mfir'), atest = false; end + if numel(rout) ~= numel(firin), atest = false; end + for kk = 1:numel(firin) + if eq(rout(kk), firin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the string method properly applies history. + % + % + function result = utp_06 + + % + % + % The method string doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the string method doesn't work if the MFIR object have more + % than one history step. + % + % + function result = utp_07 + + % + % + % The method string throws an error because the input object have more than + % one history step. + % + % + + try + % + fir3 = mfir(plist('type', 'bandpass')); + fir3.setName('Second history step'); + out = fir3.string(); + % + stest = false; + catch err + stest = true; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_submit.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_submit.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,529 @@ +% UTP_MFIR_SUBMIT a set of UTPs for the mfir/submit method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_submit.m,v 1.14 2010/08/18 09:25:54 ingo Exp $ +% + +% +% +% The bsubmit method of the mfir class submits a collection of objects +% in XML form to an LTPDA Repository. The type of the objects are +% independent. +% +% + +function results = utp_mfir_submit(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'submit'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + [fir1,fir2,fir3,fir4,fir5,fir6,firv,firm] = get_test_objects_mfir; + plForAutoTest = plist('no dialog', true, 'use selector', false); + + conn = utpGetConnection(); + try + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_mfir_submit: submit mfir'; + sinfo.experiment_description = 'utp_mfir_submit: description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test output of the data + catch + end + + % Close connection + utpCloseConnection(conn); + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()) + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 16, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('sinfo filename'), atest = false; end + if ~io(3).plists.isparam('binary'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isEmptyChar(io(3).plists.find('sinfo filename')), atest = false; end + if ~isequal(io(3).plists.find('binary'), false), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the submit method works with a vector of MFIR objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the submit method works for a vector of MFIR objects as + % input. + % + % + + try + % + [ids, cids] = submit(firv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + robjs3 = ltpda_uo.retrieve(conn, ids(1), ids(2), ids(3), ids(4)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(firv), atest = false; end + if numel(robjs2) ~= numel(firv), atest = false; end + if numel(robjs3) ~= numel(firv), atest = false; end + % Check the retrieved object against the submitted + if ~eq(firv, [robjs1{:}]), atest = false; end + if ~eq(firv, [robjs2{:}]), atest = false; end + if ~eq(firv, [robjs3{:}]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the submit method works with a matrix of MFIR objects as + % input. + % + % + function result = utp_03 + + % + % + % Tests that the submit method works with a matrix of MFIR objects + % as input. + % + % + + try + % + [ids, cids] = submit(firm, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + robjs3 = ltpda_uo.retrieve(conn, ids(1), ids(2), ids(3), ids(4), ids(5), ids(6)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(firm), atest = false; end + if numel(robjs2) ~= numel(firm), atest = false; end + if numel(robjs3) ~= numel(firm), atest = false; end + % Check the retrieved object against the submitted + if ~eq(firm, reshape([robjs1{:}], size(firm))), atest = false; end + if ~eq(firm, reshape([robjs2{:}], size(firm))), atest = false; end + if ~eq(firm, reshape([robjs3{:}], size(firm))), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the submit method works with a list of MFIR objects as + % input. + % + % + function result = utp_04 + + % + % + % Tests that the submit method works with a list of MFIR objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = submit(fir1, pl, iir, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + robjs3 = ltpda_uo.retrieve(conn, ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 3, atest = false; end + if numel(robjs2) ~= 3, atest = false; end + if numel(robjs3) ~= 3, atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, fir1), atest = false; end + if ~eq(robjs1{2}, iir), atest = false; end + if ~eq(robjs1{3}, pl), atest = false; end + % Check robjs2 + if ~eq(robjs2{1}, fir1), atest = false; end + if ~eq(robjs2{2}, iir), atest = false; end + if ~eq(robjs2{3}, pl), atest = false; end + % Check robjs3 + if ~eq(robjs3{1}, fir1), atest = false; end + if ~eq(robjs3{2}, iir), atest = false; end + if ~eq(robjs3{3}, pl), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the abs method works with a mix of different shaped MFIR + % objects as input. + % + % + function result = utp_05 + + % + % + % Tests that the submit method works with a list of MFIR objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = submit(pl, firm, iir, firv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 2 + numel(firm) + numel(firv), atest = false; end + if numel(robjs2) ~= 2 + numel(firm) + numel(firv), atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, firm(1)), atest = false; end + if ~eq(robjs1{2}, firm(2)), atest = false; end + if ~eq(robjs1{3}, firm(3)), atest = false; end + if ~eq(robjs1{4}, firm(4)), atest = false; end + if ~eq(robjs1{5}, firm(5)), atest = false; end + if ~eq(robjs1{6}, firm(6)), atest = false; end + if ~eq(robjs1{7}, iir), atest = false; end + if ~eq(robjs1{8}, firv(1)), atest = false; end + if ~eq(robjs1{9}, firv(2)), atest = false; end + if ~eq(robjs1{10}, firv(3)), atest = false; end + if ~eq(robjs1{11}, firv(4)), atest = false; end + if ~eq(robjs1{12}, pl), atest = false; end + % Check robjs2 + if ~isequalwithequalnans(robjs1, robjs2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tthe submit method properly applies history. + % + % + function result = utp_06 + + % + % + % Tthe submit method properly applies history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the submit method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [ids, cids] = submit(fir1, fir2, sinfo, plForAutoTest); + + [o1, o2] = ltpda_uo.retrieve(conn, 'Collection', cids); + o3 = ltpda_uo.retrieve(conn, 'Collection', cids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the output + if ~eq(o1, fir1), atest = false; end + if ~eq(o2, fir2), atest = false; end + if ~eq(o3{1}, fir1), atest = false; end + if ~eq(o3{2}, fir2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_type.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_type.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,395 @@ +% UTP_MFIR_TYPE a set of UTPs for the mfir/type method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_type.m,v 1.2 2009/07/23 12:33:01 ingo Exp $ +% + +% +% +% The type method of the mfir class converts the input objects to +% MATLAB functions that reproduce the processing steps that led to the +% input objects. +% +% + +function results = utp_mfir_type(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'type'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MFIR objects + [fir1,fir2,fir3,fir4,fir5,fir6,firv,firm] = get_test_objects_mfir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % DEfine the filename + filename = 'test_mfir_type.m'; + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('filename'), atest = false; end + if ~io(3).plists.isparam('stop_option'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('filename')), atest = false; end + if ~isequal(io(3).plists.find('stop_option'), 'full'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('filename'), {''}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('stop_option'), {'full', 'File', 'Repo', 'File Repo', 'N'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the type method works with a vector of MFIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the type method works for a vector of MFIR objects as input. + % + % + + try + % + type(firv, filename); + type(firv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + if ~eq(firv, mout, ple2), atest = false; end; + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the type method works with a matrix of MFIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the type method works for a matrix of MFIR objects as input. + % + % + + try + % + type(firm, filename); + type(firm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + % Type doesn't keep the shape + for ii = 1:numel(firm) + if ~eq(firm(ii), mout(ii), ple2), atest = false; end; + end + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the type method works with a list of MFIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the type method works for a list of MFIR objects as input. + % + % + + try + % + type(fir5,fir4,fir3, filename); + type(fir5,fir4,fir3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + firin = [fir5,fir4,fir3]; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + % Type doesn't keep the shape + for ii = 1:numel(firin) + if ~eq(firin(ii), mout(ii), ple2), atest = false; end; + end + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the type method works with a mix of different shaped MFIR objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the type method works with an input of matrices and vectors + % and single MFIR objects. + % + % + + try + % + type(fir4,firv,fir2,firm,fir1, filename); + type(fir4,firv,fir2,firm,fir1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + firin = [fir4,reshape(firv,1,[]),fir2,reshape(firm,1,[]),fir1]; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + % Type doesn't keep the shape + for ii = 1:numel(firin) + if ~eq(firin(ii), mout(ii), ple2), atest = false; end; + end + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the type method properly applies history. + % + % + function result = utp_06 + + % + % + % The method type doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/mfir/utp_mfir_update.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/mfir/utp_mfir_update.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,387 @@ +% UTP_MFIR_UPDATE a set of UTPs for the mfir/update method +% +% M Hewitson 06-08-08 +% +% $Id: utp_mfir_update.m,v 1.14 2010/08/18 09:25:54 ingo Exp $ +% + +% +% +% The update method of the mfir class updates (replace) an LTPDA object +% in the repository with the given replacement object. It is only possible +% to update one object. This is the reason why the general UTPs are not +% possible. +% +% + +function results = utp_mfir_update(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'mfir'; + mthd = 'update'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + obj = mfir(plist('type', 'bandreject', 'fc', [0.01 0.1])); + obj.setName(); + + plForAutoTest = plist('no dialog', true, 'use selector', false); + conn = utpGetConnection(); + try + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_mfir_update: update mfir'; + sinfo.experiment_description = 'utp_mfir_update: description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + [ids, cids] = submit(obj, sinfo, plForAutoTest); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Test with conn + results = [results utp_03]; % Test with sinfo + results = [results utp_04]; % Test update of an binary file + results = [results utp_05]; % Test replace with other object + catch + end + + % Close connection + utpCloseConnection(conn); + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 15, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('binary'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isequal(io(3).plists.find('binary'), false), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_02 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Use a database object (conn) to establish the connection. + % + % + + try + % + % Make some changes to the object. + uobj = obj.setName('I was updated (conn)'); + update(uobj, ids, conn, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_03 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Use a database info structure (sinfo) to establish the connection. + % + % + + try + % + % Make some changes to the object. + uobj = obj.setName('I was updated (sinfo)'); + update(uobj, ids, sinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_04 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Check that the update method also updates objects which are stored as + % a binary file. + % + % + + try + % + % Submit the object as a binary + [ids_bin, cids] = bsubmit(obj, sinfo, plForAutoTest); + % Make some changes to the object. + uobj = obj.setName('I was updated (sinfo)'); + update(uobj, ids_bin, sinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids_bin' + robj = ltpda_uo.retrieve(conn, ids_bin); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the update method replaces the object in the repository with + % a completely other object. + % + % + function result = utp_05 + + % + % + % Tests that the update method replaces the object in the repository + % with a completely other object. + % Replace the mfir object with a filter object. + % + % + + try + % + % Make some changes to the object. + uobj = miir(plist('type', 'lowpass')); + update(uobj, ids, sinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/test_iir.fil --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/test_iir.fil Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,43 @@ +#/* Fri Dec 16 21:06:44 2005; "dewh.fil" (daqs): */ +#/* pole 4 */ +#/* zero 400 */ +#/* pole 4 */ +#/* zero 400 */ +#/* */ +#/* */ +#/* */ +#/* */ +#/* */ +#/* # computing instructions */ +#/* */ +#/* */ +#/* factor 25 */ +#/* */ +#/* freq log 0.1 8k 1000 */ +#/* */ +#/* iir 16384 start 4 4 */ + +iir 16384 +iirstab 0.995 +a0 0.003061308659705303 +a1 -0.008461893738519068 +a2 0.008912224099961949 +a3 -0.004341107569771629 +a4 0.0008495938331665227 +b0 1 +b1 -2.969127117661185 +b2 3.253166856674948 +b3 -1.597899568659838 +b4 0.3138606346574565 +param a0 -0.017149 0.0175993 lin +param a1 -0.017149 0.0175993 lin +param a2 -0.017149 0.0175993 lin +param a3 -0.017149 0.0175993 lin +param a4 -0.017149 0.0175993 lin +param b1 -6.08027 6.36431 lin +param b2 -6.08027 6.36431 lin +param b3 -6.08027 6.36431 lin +param b4 -6.08027 6.36431 lin +fit dewh.out dbdeg rel +rewrite samebetter +cfile diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_bsubmit.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_bsubmit.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,527 @@ +% UTP_MIIR_BSUBMIT a set of UTPs for the miir/bsubmit method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_bsubmit.m,v 1.14 2010/08/18 09:25:55 ingo Exp $ +% + +% +% +% The bsubmit method of the miir class submits a collection of objects +% in binary form to an LTPDA Repository. The type of the objects are +% independent. +% +% + +function results = utp_miir_bsubmit(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'bsubmit'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + [iir1,iir2,iir3,iir4,iir5,iir6,iirv,iirm] = get_test_objects_miir; + plForAutoTest = plist('no dialog', true, 'use selector', false); + + conn = utpGetConnection(); + try + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_miir_bsubmit: submit miir'; + sinfo.experiment_description = 'utp_miir_bsubmit: description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test output of the data + catch + end + + % Close connection + utpCloseConnection(conn); + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 15, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('sinfo filename'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isEmptyChar(io(3).plists.find('sinfo filename')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the bsubmit method works with a vector of MIIR objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the bsubmit method works for a vector of MIIR objects as + % input. + % + % + + try + % + [ids, cids] = bsubmit(iirv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3), ids(4)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(iirv), atest = false; end + if numel(robjs2) ~= numel(iirv), atest = false; end + if numel(robjs3) ~= numel(iirv), atest = false; end + % Check the retrieved object against the submitted + if ~eq(iirv, [robjs1{:}]), atest = false; end + if ~eq(iirv, [robjs2{:}]), atest = false; end + if ~eq(iirv, [robjs3{:}]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the bsubmit method works with a matrix of MIIR objects as + % input. + % + % + function result = utp_03 + + % + % + % Tests that the bsubmit method works with a matrix of MIIR objects + % as input. + % + % + + try + % + [ids, cids] = bsubmit(iirm, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3), ids(4), ids(5), ids(6)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(iirm), atest = false; end + if numel(robjs2) ~= numel(iirm), atest = false; end + if numel(robjs3) ~= numel(iirm), atest = false; end + % Check the retrieved object against the submitted + if ~eq(iirm, reshape([robjs1{:}], size(iirm))), atest = false; end + if ~eq(iirm, reshape([robjs2{:}], size(iirm))), atest = false; end + if ~eq(iirm, reshape([robjs3{:}], size(iirm))), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the bsubmit method works with a list of MIIR objects as + % input. + % + % + function result = utp_04 + + % + % + % Tests that the bsubmit method works with a list of MIIR objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = bsubmit(iir1, pl, iir, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 3, atest = false; end + if numel(robjs2) ~= 3, atest = false; end + if numel(robjs3) ~= 3, atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, iir1), atest = false; end + if ~eq(robjs1{3}, pl), atest = false; end + if ~eq(robjs1{2}, iir), atest = false; end + % Check robjs2 + if ~eq(robjs2{1}, iir1), atest = false; end + if ~eq(robjs2{3}, pl), atest = false; end + if ~eq(robjs2{2}, iir), atest = false; end + % Check robjs3 + if ~eq(robjs3{1}, iir1), atest = false; end + if ~eq(robjs3{2}, iir), atest = false; end + if ~eq(robjs3{3}, pl), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the abs method works with a mix of different shaped MIIR + % objects as input. + % + % + function result = utp_05 + + % + % + % Tests that the bsubmit method works with a list of MIIR objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = bsubmit(pl, iirm, iir, iirv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 2 + numel(iirm) + numel(iirv), atest = false; end + if numel(robjs2) ~= 2 + numel(iirm) + numel(iirv), atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, iirm(1)), atest = false; end + if ~eq(robjs1{2}, iirm(2)), atest = false; end + if ~eq(robjs1{3}, iirm(3)), atest = false; end + if ~eq(robjs1{4}, iirm(4)), atest = false; end + if ~eq(robjs1{5}, iirm(5)), atest = false; end + if ~eq(robjs1{6}, iirm(6)), atest = false; end + if ~eq(robjs1{7}, iir), atest = false; end + if ~eq(robjs1{8}, iirv(1)), atest = false; end + if ~eq(robjs1{9}, iirv(2)), atest = false; end + if ~eq(robjs1{10}, iirv(3)), atest = false; end + if ~eq(robjs1{11}, iirv(4)), atest = false; end + if ~eq(robjs1{12}, pl), atest = false; end + % Check robjs2 + if ~isequalwithequalnans(robjs1, robjs2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tthe bsubmit method properly applies history. + % + % + function result = utp_06 + + % + % + % Tthe bsubmit method properly applies history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the bsubmit method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [ids, cids] = bsubmit(iir1, iir2, sinfo, plForAutoTest); + + [o1, o2] = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + o3 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the output + if ~eq(o1, iir1), atest = false; end + if ~eq(o2, iir2), atest = false; end + if ~eq(o3{1}, iir1), atest = false; end + if ~eq(o3{2}, iir2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_char.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_char.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,357 @@ +% UTP_MIIR_CHAR a set of UTPs for the miir/char method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_char.m,v 1.2 2009/07/23 14:12:01 ingo Exp $ +% + +% +% +% The char method of the miir class converts the objects into one character string +% which contains information of the object. +% +% + +function results = utp_miir_char(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'char'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MIIR objects + [iirhp,iirlp,iirbp,iirbr,iirpzm,iirab,iirv,iirm] = get_test_objects_miir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the char method works with a vector of MIIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the char method works for a vector of MIIR objects as input. + % + % + + try + % + out = char(iirv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end; + for kk = 1:numel(iirv) + if isempty(strfind(out, iirv(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the char method works with a matrix of MIIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the char method works for a matrix of MIIR objects as input. + % + % + + try + % + out = char(iirm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(iirm) + if isempty(strfind(out, iirm(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the char method works with a list of MIIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the char method works for a list of MIIR objects as input. + % + % + + try + % + out = char(iirbp,iirhp,iirpzm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + miirin = [iirbp,iirhp,iirpzm]; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(miirin) + if isempty(strfind(out, miirin(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the char method works with a mix of different shaped MIIR objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the char method works with an input of matrices and vectors + % and single MIIR objects. + % + % + + try + % + out = char(iirhp,iirv,iirab,iirm,iirlp); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + miirin = [iirhp,reshape(iirv,1,[]),iirab,reshape(iirm,1,[]),iirlp]; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(miirin) + if isempty(strfind(out, miirin(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the char method properly applies history. + % + % + function result = utp_06 + + % + % + % The method char doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_copy.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_copy.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,50 @@ +% UTP_MIIR_COPY a set of UTPs for the miir/copy method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_copy.m,v 1.5 2009/08/08 12:21:40 hewitson Exp $ +% + +% +% +% The copy method of the miir class copies the input object depending of the +% second input. +% +% + +function results = utp_miir_copy(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'copy'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_69(class, 1, 1, ple2)]; + results = [results utp_69(class, 1, 3, ple2)]; + results = [results utp_69(class, 2, 3, ple2)]; + + 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 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_created.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_created.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,485 @@ +% UTP_MIIR_CREATED a set of UTPs for the miir/created method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_created.m,v 1.2 2009/07/23 14:12:01 ingo Exp $ +% + +% +% +% The created method of the miir returns a time object of the last +% modification. For this uses the created method the 'proctime' property of +% the last history step and computs from this value a timeobject. +% +% + +function results = utp_miir_created(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'created'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MIIR objects + [iir1,iir2,iir3,iir4,iir5,iir6,iirv,iirm] = get_test_objects_miir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test empty object + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the created method works with a vector of MIIR objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the created method works for a vector of MIIR objects as + % input. + % + % + + try + % + out = created(iirv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'iirv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if ~isequal(size(out), size(iirv)), atest = false; end + % Check the time-object + for kk=1:numel(out) + if out(kk).utc_epoch_milli ~= iirv(kk).hist.proctime, atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the created method works with a matrix of MIIR objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the created method works for a matrix of MIIR objects as + % input. + % + % + + try + % + out = created(iirm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'iirm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if ~isequal(size(out), size(iirm)), atest = false; end + % Check time-object + for kk=1:numel(out) + if out(kk).utc_epoch_milli ~= iirm(kk).hist.proctime, atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the created method works with a list of MIIR objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the created method works for a list of MIIR objects as + % input. + % + % + + try + % + out = created(iir1,iir2,iir3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if out(1).utc_epoch_milli ~= iir1.hist.proctime, atest = false; end + if out(2).utc_epoch_milli ~= iir2.hist.proctime, atest = false; end + if out(3).utc_epoch_milli ~= iir3.hist.proctime, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the created method works with a mix of different shaped + % MIIR objects as input. + % + % + function result = utp_05 + + % + % + % Test that the created method works with an input of matrices and + % vectors and single MIIR objects. + % + % + + try + % + out = created(iir1,iirv,iir2,iirm,iir3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + iirin = [iir1,reshape(iirv,1,[]),iir2,reshape(iirm,1,[]),iir3]; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(iirm)+numel(iirv)), atest = false; end + for kk=1:numel(out) + if out(kk).utc_epoch_milli ~= iirin(kk).hist.proctime, atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the created method properly applies history + % + % + function result = utp_06 + + % + % + % This method doesn't change the input object, thus no history is added + % to the object. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the created method can be used with the modify command. + % + % + function result = utp_07 + + % + % + % Tests that the created method can be used with the modify command. + % + % + + try + % + out1 = iir3.created; + out2 = iirm.created; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the single object + % 2) Check the matrix object + % + % + + atest = true; + if stest + % + % Check the single object + if out1.utc_epoch_milli ~= iir3.hist.proctime, atest = false; end + % Check the matrix + for kk = 1:numel(out2) + if out2(kk).utc_epoch_milli ~= iirm(kk).hist.proctime, atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the created method retruns always a well defined time object + % even for an empty input object. + % + % + function result = utp_08 + + % + % + % Test that the created method with an empty 'MIIR object + % + % + + try + % + iir = miir(); + out = iir.created; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a time object with a ell defined time. + % + % + + atest = true; + if stest + % + if ~isa(out, 'time'), atest = false; end + if isnan(out.utc_epoch_milli), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_creator.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_creator.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,520 @@ +% UTP_MIIR_CREATED a set of UTPs for the miir/creator method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_creator.m,v 1.2 2009/07/23 14:12:01 ingo Exp $ +% + +% +% +% The creator method of the miir extract the creator(s)/modifier from +% the history. Depending to the input parameter returns this method all +% creator/modifier or only the last creator/modifier. +% +% + +function results = utp_miir_creator(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'creator'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MIIR objects + [iir1,iir2,iir3,iir4,iir5,iir6,iirv,iirm] = get_test_objects_miir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with different creator/modifier + results = [results utp_09]; % Test negative case for the option 'all' + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('option'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('option')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('option'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the creator method works with a vector of MIIR objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the creator method works for a vector of MIIR objects as + % input. + % + % + + try + % + out = creator(iirv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'iirv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(iirv), atest = false; end + % Check the creator + curr_creator = provenance(); + for kk=1:numel(out) + if ~strcmp(out{kk}, curr_creator.creator), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the creator method works with a matrix of MIIR objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the creator method works for a matrix of MIIR objects as + % input. + % + % + + try + % + out = creator(iirm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'iirm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(iirm), atest = false; end + % Check creator + curr_creator = provenance(); + for kk=1:numel(out) + if ~strcmp(out{kk}, curr_creator.creator), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the creator method works with a list of MIIR objects as + % input. + % + % + function result = utp_04 + + % + % + % The creator method doesn't work for a list of MIIR objects as input. + % + % + + % + try + creator(iir1,iir2,iir3); + stest = false; + catch + stest = true; + end + % + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the creator method works with a mix of different shaped + % MIIR objects as input. + % + % + function result = utp_05 + + % + % + % The creator method doesn't work with different shaped input objects. + % + % + + % + try + creator(iir1,iirv,iir2,iirm,iir3); + stest = false; + catch + stest = true; + end + % + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the creator method properly applies history + % + % + function result = utp_06 + + % + % + % This method doesn't change the input object, thus no history is added + % to the object. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the creator method can be used with the modify command. + % + % + function result = utp_07 + + % + % + % Tests that the creator method can be used with the modify command. + % + % + + try + % + out1 = iir3.creator; + out2 = iirm.creator; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the single object + % 2) Check the matrix object + % + % + + atest = true; + if stest + % + curr_creator = provenance(); + % Check the single object + if ~strcmp(out1, curr_creator.creator), atest = false; end + % For a single object must be the the output a char string + if ~ischar(out1), atest = false; end + % Check the matrix + for kk = 1:numel(out2) + if ~strcmp(out2{kk}, curr_creator.creator), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the creator method retruns all creator(s)/modifier(s) which + % are in the history. + % + % + function result = utp_08 + + % + % + % Test that the creator method uses the option 'all' direct or in a + % plist. The test file must have the modifier 'first', 'second' and + % 'third' + % + % + + try + % + % Read object with different modifier + iir = miir('test_miir_diff_creator.xml'); + out1 = iir.creator; + out2 = iir.creator('all'); + out3 = iir.creator(plist('option', 'all')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that out1 contains only one creator + % 2) Check that out2 contain more creator/modifier + % + % + + atest = true; + if stest + % + if ~ischar(out1), atest = false; end + if ~strmatch('fist', out2), atest = false; end + if ~strmatch('second', out2), atest = false; end + if ~strmatch('third', out2), atest = false; end + if ~strmatch('fist', out3), atest = false; end + if ~strmatch('second', out3), atest = false; end + if ~strmatch('third', out3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Tests the negative case for the option 'all'. + % + % + function result = utp_09 + + % + % + % Test that the creator method throws an error if the option 'all' is + % used in connection with a matrix/vector of MIIR objects. + % + % + + try + % + iirm.creator('all'); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_display.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_display.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,367 @@ +% UTP_MIIR_DISPLAY a set of UTPs for the miir/display method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_display.m,v 1.3 2009/07/23 14:12:01 ingo Exp $ +% + +% +% +% The display method of the miir class prints defined values of an MIIR object. +% MATLAB calls display when it interprets an object that is not terminated +% by a semicolon. +% +% + +function results = utp_miir_display(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'display'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MIIR objects + [iirhp,iirlp,iirbp,iirbr,iirpzm,iirab,iirv,iirm] = get_test_objects_miir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the display method works with a vector of MIIR objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the display method works for a vector of MIIR objects as + % input. + % + % + + try + % + iirv + out = display(iirv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + % Check the output + if ~iscell(out), atest = false; end; + for kk = 1:numel(iirv) + if isempty(strfind(out, iirv(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the display method works with a matrix of MIIR objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the display method works for a matrix of MIIR objects as + % input. + % + % + + try + % + iirm + out = display(iirm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(iirm) + if isempty(strfind(out, iirm(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the display method works with a list of MIIR objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the display method works for a list of MIIR objects as + % input. + % + % + + try + % + iirlp,iirbp,iirab + out = display(iirlp,iirbp,iirab); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + iirin = [iirlp,iirbp,iirab]; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(iirin) + if isempty(strfind(out, iirin(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the display method works with a mix of different shaped + % MIIR objects as input. + % + % + function result = utp_05 + + % + % + % Test that the display method works with an input of matrices and + % vectors and single MIIR objects as. + % + % + + try + % + out = display(iirhp,iirv,iirbr,iirm,iirpzm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + iirin = [iirhp,reshape(iirv,1,[]),iirbr,reshape(iirm,1,[]),iirpzm]; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(iirin) + if isempty(strfind(out, iirin(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the display method properly applies history. + % + % + function result = utp_06 + + % + % + % The method display doesn't change the data, thus it is not possible + % to check the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_eq.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_eq.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,695 @@ +% UTP_MIIR_EQ a set of UTPs for the miir/eq method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_eq.m,v 1.8 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The eq() method of the miir class iir1 == iir2 compares each element of an +% iir object with the corresponding element of an second iir object and returns +% a logical 1 (true) where iir1 and iir2 are equal, or logical 0 (false) +% where they are not equal. +% +% + +function results = utp_miir_eq(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'eq'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MIIR objects + [iirhp,iirlp,iirbp,iirbr,iirpzm,iirab,iirv,iirm] = get_test_objects_miir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test with the exception list 'name' + results = [results utp_08]; % Test with the exception list 'histin' + results = [results utp_09]; % Test with the exception list 'histout' + results = [results utp_10]; % Test with the exception list 'iunits' + results = [results utp_11]; % Test with the exception list 'ounits' + results = [results utp_12]; % Test exception list in a plist + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check number of SETS + if numel(io(2).sets) ~= 1, atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + % SET 'Default' + % Check key + if ~io(3).plists.isparam('Exceptions'), atest = false; end + if ~io(3).plists.isparam('Tol'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('Exceptions'), {}), atest = false; end + if ~isequal(io(3).plists.find('Tol'), eps(1)), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('Exceptions'), {{}}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('Tol'), {eps(1)}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the eq method works with a vector of MIIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the eq method works for a vector of MIIR objects as input. + % Test the positive and the negative case. + % + % + + try + % + iir = iirbr.setName('my name'); + iirv1 = [iirlp, iirab, iirpzm, iirbr]; + iirv2 = [iirlp, iirab, iirpzm, iir]; + out1 = eq(iirv1, iirv1); + out2 = eq(iirv1, iirv2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the eq function. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the eq method works with a matrix of MIIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the eq method works for a matrix of MIIR objects as input. + % Test the positive and the negative case. + % + % + + try + % + iir = iirbr.setName('my name'); + iirm1 = [iirlp, iirab, iirbr, iirbr, iirpzm, iirlp]; + iirm2 = [iirlp, iirab, iir; iirbr, iirpzm, iirlp]; + out1 = eq(iirm1, iirm1); + out2 = eq(iirm1, iirm2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the eq function. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the eq method works with a list of MIIR objects as input. + % + % + function result = utp_04 + + % + % + % The eq method doesn't works for a list of MIIR objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the eq method works with a mix of different shaped MIIR objects + % as input. + % + % + function result = utp_05 + + % + % + % The eq method doesn't works for a list of MIIR objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the eq method properly applies history. + % + % + function result = utp_06 + + % + % + % The eq method doesn't change the MIIR object, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_07 + + % + % + % Test the eq method with the exception 'name'. Use the option 'internal' to + % suppress the history. It is necessary to add 'created' to the exception + % list because iir is created at an other time. + % + % + + try + % + iir = testCallerIsMethod(@setName, iirbr, 'my name'); + out1 = eq(iir, iirbr); + out2 = eqLocal(iir, iirbr, 'name'); + out3 = eqLocal(iir, iirbr, 'miir/name'); + out4 = eq(iir.hist, iirbr.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_08 + + % + % + % Test the eq method with the exception 'histin'. Use the option 'internal' to + % suppress the history. It is necessary to add 'created' to the exception + % list because iir is created at an other time. + % + % + + try + % + iir = testCallerIsMethod(@setHistin, iirbr, [1 1]); + out1 = eq(iir, iirbr); + out2 = eqLocal(iir, iirbr, 'histin'); + out3 = eqLocal(iir, iirbr, 'miir/histin'); + out4 = eq(iir.hist, iirbr.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_09 + + % + % + % Test the eq method with the exception 'histout'. Use the option 'internal' + % to suppress the history. It is necessary to add 'created' to the exception + % list because iir is created at an other time. + % + % + + try + % + iir = testCallerIsMethod(@setHistout, iirbr, [1 1]); + out1 = eq(iir, iirbr); + out2 = eqLocal(iir, iirbr, 'histout'); + out3 = eqLocal(iir, iirbr, 'miir/histout'); + out4 = eq(iir.hist, iirbr.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_10 + + % + % + % Test the eq method with the exception 'iunits'. Use the option 'internal' + % to suppress the history. It is necessary to add 'created' to the exception + % list because iir is created at an other time. + % + % + + try + % + iir = testCallerIsMethod(@setIunits, iirbr, unit('Hz')); + out1 = eq(iir, iirbr); + out2 = eqLocal(iir, iirbr, 'iunits'); + out3 = eqLocal(iir, iirbr, 'miir/iunits'); + out4 = eq(iir.hist, iirbr.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_11 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_11 + + % + % + % Test the eq method with the exception 'ounits'. Use the option 'internal' + % to suppress the history. It is necessary to add 'created' to the exception + % list because iir is created at an other time. + % + % + + try + % + iir = testCallerIsMethod(@setOunits, iirbr, unit('V')); + out1 = eq(iir, iirbr); + out2 = eqLocal(iir, iirbr, 'ounits'); + out3 = eqLocal(iir, iirbr, 'miir/ounits'); + out4 = eq(iir.hist, iirbr.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_11 + + %% UTP_12 + + % + % + % Test the eq method with an exception list which is in a plist. + % + % + function result = utp_12 + + % + % + % Test that the eq method uses the exception list in a plist. + % + % + + try + % + iir = testCallerIsMethod(@setName, iirbr, 'my name'); + pl = plist('Exceptions', {'name', 'UUID'}); + out1 = eq(iir, iirbr); + out2 = eq(iir, iirbr, pl); + out3 = eq(iir, iirbr, pl); + out4 = eq(iir.hist, iirbr.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + function res = eqLocal(obj1, obj2, ex) + e = ple1.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {ex}]); + + res = eq(obj1, obj2, ple); + end +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_get.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_get.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,309 @@ +% UTP_MIIR_GET a set of UTPs for the miir/get method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_get.m,v 1.3 2011/03/29 13:03:29 ingo Exp $ +% + +% +% +% The get method of the miir class returns the value of an object +% property. This is a very simple method which accepts only one miir as +% input thus are the most general units test not possible. +% +% + +function results = utp_miir_get(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'get'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Algorithm test + results = [results utp_03]; % Algorithm test with a plist + results = [results utp_04]; % Negative test with more than one miir + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('property'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('property')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('property'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests the get method of the miir class. + % + % + function result = utp_02 + + % + % + % Test that the get returns returns the value of the specified + % property. Do this for all properties of the MIIR object. + % + % + + try + % + iir = miir(plist('type', 'lowpass')); + out1 = get(iir, 'b'); + out2 = get(iir, 'histin'); + out4 = get(iir, 'ntaps'); + out5 = get(iir, 'fs'); + out6 = get(iir, 'infile'); + out7 = get(iir, 'a'); + out8 = get(iir, 'histout'); + out9 = get(iir, 'iunits'); + out10= get(iir, 'ounits'); + out11= get(iir, 'hist'); + out12= get(iir, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the correct value of the output + % + % + + atest = true; + if stest + % + if ~isequal(out1, iir.b), atest = false; end + if ~isequal(out2, iir.histin), atest = false; end + if ~isequal(out4, iir.ntaps), atest = false; end + if ~isequal(out5, iir.fs), atest = false; end + if ~isequal(out6, iir.infile), atest = false; end + if ~isequal(out7, iir.a), atest = false; end + if ~isequal(out8, iir.histout), atest = false; end + if ~eq(out9, iir.iunits), atest = false; end + if ~eq(out10,iir.ounits), atest = false; end + if ~eq(out11,iir.hist), atest = false; end + if ~isequal(out12,iir.name), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the get method works with a plist. + % + % + function result = utp_03 + + % + % + % Test that the get returns returns the value of the specified + % property which is defined in a plist. + % + % + + try + % + iir = miir(plist('type', 'lowpass')); + pl1 = plist('property', 'b'); + pl2 = plist('property', 'histin'); + pl4 = plist('property', 'ntaps'); + pl5 = plist('property', 'fs'); + pl6 = plist('property', 'infile'); + pl7 = plist('property', 'a'); + pl8 = plist('property', 'histout'); + pl9 = plist('property', 'iunits'); + pl10= plist('property', 'ounits'); + pl11= plist('property', 'hist'); + pl12= plist('property', 'name'); + out1 = get(iir, pl1); + out2 = get(iir, pl2); + out4 = get(iir, pl4); + out5 = get(iir, pl5); + out6 = get(iir, pl6); + out7 = get(iir, pl7); + out8 = get(iir, pl8); + out9 = get(iir, pl9); + out10= get(iir, pl10); + out11= get(iir, pl11); + out12= get(iir, pl12); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the correct value of the output + % + % + + atest = true; + if stest + % + if ~isequal(out1, iir.b), atest = false; end + if ~isequal(out2, iir.histin), atest = false; end + if ~isequal(out4, iir.ntaps), atest = false; end + if ~isequal(out5, iir.fs), atest = false; end + if ~isequal(out6, iir.infile), atest = false; end + if ~isequal(out7, iir.a), atest = false; end + if ~isequal(out8, iir.histout), atest = false; end + if ~eq(out9, iir.iunits), atest = false; end + if ~eq(out10,iir.ounits), atest = false; end + if ~eq(out11,iir.hist), atest = false; end + if ~isequal(out12,iir.name), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests the get method of the miir class. + % + % + function result = utp_04 + + % + % + % Test that the get throws an error if the input are more than + % one MIIR object. + % + % + + try + % + iir = miir(plist('type', 'lowpass')); + out = get([iir, iir], 'name'); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_index.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_index.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,525 @@ +% UTP_MIIR_INDEX a set of UTPs for the miir/index method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_index.m,v 1.4 2009/07/28 17:12:38 ingo Exp $ +% + +% +% +% The index method of the miir class index into a MIIR vector or +% matrix. This properly captures the history. +% +% + +function results = utp_miir_index(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'index'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MIIR objects + [iir1,iir2,iir3,iir4,iir5,iir6,iirv,iirm] = get_test_objects_miir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test history is working + results = [results utp_06]; % Test the modify call works + results = [results utp_07]; % Test with plist + results = [results utp_08]; % Test select more objects with an index + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('i'), atest = false; end + if ~io(3).plists.isparam('j'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('i')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('j')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('i'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('j'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the index method works with a vector of MIIR objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the index method works for a vector of MIIR objects as + % input. The following indexing should work: + % I = [ 1 2 3 ] or (I/J) = [(1,1), (1,2), (1,3)] + % + % + + try + % + objvec = [iir1, iir2, iir3]; + out1 = objvec.index(1); + out2 = objvec.index(3); + out3 = objvec.index(1,2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the index method selects the correct object. + % + % + + atest = true; + if stest + % + if ~eq(out1, iir1, ple3), atest = false; end + if ~eq(out2, iir3, ple3), atest = false; end + if ~eq(out3, iir2, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the index method works with a matrix of MIIR objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the index method works for a matrix of MIIR objects as + % input. The following indexing should work: + % I = [ 1 3 5 ] or (I/J) = [(1,1), (1,2), (1,3)] + % [ 2 4 6 ] [(2,1), (2,2), (2,3)] + % + + try + % + objmat = [iir1, iir2, iir3; ... + iir3, iir1, iir2]; + out1 = objmat.index(5); + out2 = objmat.index(4); + out3 = objmat.index(1,2); + out4 = objmat.index(2,1); + out5 = objmat.index(2,2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the index method selects the correct object. + % + % + + atest = true; + if stest + % + if ~eq(out1, iir3, ple3), atest = false; end + if ~eq(out2, iir1, ple3), atest = false; end + if ~eq(out3, iir2, ple3), atest = false; end + if ~eq(out4, iir3, ple3), atest = false; end + if ~eq(out5, iir1, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the index method works with a list of MIIR objects as + % input. + % + % + function result = utp_04 + + % + % + % The index method doesn't work for a list of MIIR objects as input. + % + % + + try + % + out = index(iir1,iir2,iir3, 4); + % + stest = false; + catch + stest = true; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the index method properly applies history. + % + % + function result = utp_05 + + % + % + % Test that the result of index have an additional history step. + % + % + + try + % + i = 2; + j = 3; + objmat = [iir1, iir2, iir3; ... + iir3, iir1, iir2]; + out = index(objmat, i, j); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds + % to 'index'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'index'), atest = false; end + % Check that the history-plist contains the used indices. + pl = out.hist.plistUsed; + if pl.find('i') ~= i, atest = false; end + if pl.find('j') ~= j, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the index method works for the modifier command. + % + % + function result = utp_06 + + % + % + % Tests that the index method works for the modifier command. + % + % + + try + % + i = 1; + j = 1; + objmat = [iir1, iir2, iir3; ... + iir3, iir1, iir2]; + out1 = index(objmat, i, j); + out2 = objmat.index(i,j); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history-plist contains the used indices. + % 2) Check that the index method selects the correct object + % + % + + atest = true; + if stest + % + % Check that the history-plist contains the used indices. + pl = out1.hist.plistUsed; + if pl.find('i') ~= i, atest = false; end + if pl.find('j') ~= j, atest = false; end + % Check that the index method selects the correct object + if ~eq(out1, iir1, ple3), atest = false; end + % Check that the history-plist contains the used indices. + pl = out2.hist.plistUsed; + if pl.find('i') ~= i, atest = false; end + if pl.find('j') ~= j, atest = false; end + % Check that the index method selects the correct object + if ~eq(out2, iir1, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Control the method with a plist. + % + % + function result = utp_07 + + % + % + % Test that the index method can be controled with a plist. + % + % + + try + % + i1 = 6; + i2 = 1; + j2 = 3; + objmat = [iir1, iir2, iir3; ... + iir3, iir1, iir2]; + pl1 = plist('i', i1); + pl2 = plist('i', i2, 'j', j2); + out1 = index(objmat, pl1); + out2 = index(objmat, pl2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history-plist contains the used indices. + % 2) Check that the index method selects the correct object + % + % + + atest = true; + if stest + % + % Check that the history-plist contains the used indices. + pl = out1.hist.plistUsed; + if ~isequal(pl.find('i'), i1), atest = false; end + if ~isequal(pl.find('j'), []), atest = false; end + % Check that the index method selects the correct object + if ~eq(out1, iir2, ple3), atest = false; end + % Check that the history-plist contains the used indices. + pl = out2.hist.plistUsed; + if ~isequal(pl.find('i'), i2), atest = false; end + if ~isequal(pl.find('j'), j2), atest = false; end + % Check that the index method selects the correct object + if ~eq(out2, iir3, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test that the index method selects more objects if I have more indices. + % + % + function result = utp_08 + + % + % + % Test that the index method selects more objects if I have more indices. + % + % + + try + % + i = [2 6]; + objmat = [iir1, iir2, iir3; ... + iir3, iir1, iir2]; + pl = plist('i', i); + out1 = objmat.index(i); + out2 = objmat.index(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history-plist contains the used indices. + % 2) Check that the index method selects the correct object + % + % + + atest = true; + if stest + % + % Check that the history-plist contains the used indices. + pl = out1(1).hist.plistUsed; + if ~isequal(pl.find('i'), i), atest = false; end + if ~isequal(pl.find('j'), []), atest = false; end + % Check that the index method selects the correct object + if ~eq(out1(1), iir3, ple3), atest = false; end + if ~eq(out1(2), iir2, ple3), atest = false; end + % Check that the history-plist contains the used indices. + pl = out2(2).hist.plistUsed; + if ~isequal(pl.find('i'), i), atest = false; end + if ~isequal(pl.find('j'), []), atest = false; end + % Check that the index method selects the correct object + if ~eq(out2(1), iir3, ple3), atest = false; end + if ~eq(out2(2), iir2, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_isprop.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_isprop.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,492 @@ +% UTP_MIIR_ISPROP a set of UTPs for the miir/isprop method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_isprop.m,v 1.6 2011/03/29 13:13:33 ingo Exp $ +% + +% +% +% The isprop method of the miir class determine whether input is object +% property. +% +% + +function results = utp_miir_isprop(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'isprop'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MIIR objects + [iirhp,iirlp,iirbp,iirbr,iirpzm,iirab,iirv,iirm] = get_test_objects_miir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test negative case + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the isprop method works with a vector of MIIR objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the isprop method works for a vector of MIIR objects as + % input. + % + % + + try + % + out = isprop(iirv, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'iirv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(iirv)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the isprop method works with a matrix of MIIR objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the isprop method works for a matrix of MIIR objects as + % input. + % + % + + try + % + out = isprop(iirm, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'iirm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(iirm)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the isprop method works with a list of MIIR objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the isprop method works for a list of MIIR objects as + % input. + % + % + + try + % + out = isprop(iirlp,iirpzm,iirbr, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the isprop method works with a mix of different shaped + % MIIR objects as input. + % + % + function result = utp_05 + + % + % + % Test that the isprop method works with an input of matrices and + % vectors and single MIIR objects. + % + % + + try + % + out = isprop(iirlp,iirv,iirpzm,iirm,iirbr, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(iirm)+numel(iirv)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the isprop method properly applies history. + % + % + function result = utp_06 + + % + % + % The method isprop doesn't change the object, thus it is not necessary + % to apply history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the isprop method works for each property. + % + % + function result = utp_07 + + % + % + % Test that the isprop method works for the properties: + % 'b', 'histin', 'ntaps', 'fs', 'infile', 'a', 'histout', + % 'iunits', 'ounits', 'hist', 'name' + % + % + + try + % + % copy iirlp to work with + out1 = isprop(iirlp, 'b'); + out2 = isprop(iirlp, 'histin'); + out4 = isprop(iirlp, 'ntaps'); + out5 = isprop(iirlp, 'fs'); + out6 = isprop(iirlp, 'infile'); + out7 = isprop(iirlp, 'a'); + out8 = isprop(iirlp, 'histout'); + out9 = isprop(iirlp, 'iunits'); + out10 = isprop(iirlp, 'ounits'); + out11 = isprop(iirlp, 'hist'); + out12 = isprop(iirlp, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if ~out1, atest = false; end; + if ~out2, atest = false; end; + if ~out4, atest = false; end; + if ~out5, atest = false; end; + if ~out6, atest = false; end; + if ~out7, atest = false; end; + if ~out8, atest = false; end; + if ~out9, atest = false; end; + if ~out10, atest = false; end; + if ~out11, atest = false; end; + if ~out12, atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the negative case and the not function command. + % + % + function result = utp_08 + + % + % + % Test that the isprop method retrun false for a unknown property and for + % methods of the object. + % + % + + try + % + out1 = isprop(iirbp, 'foo'); + out2 = iirbp.isprop('foo'); + out3 = iirbp.isprop('name'); + out4 = iirbp.isprop('type'); + out5 = iirbp.isprop('char'); + out6 = iirbp.isprop('creator'); + out7 = iirbp.isprop('created'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if out1, atest = false; end; + if out2, atest = false; end; + if ~out3, atest = false; end; + if out4, atest = false; end; + if out5, atest = false; end; + if out6, atest = false; end; + if out7, atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_loadobj.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_loadobj.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,151 @@ +% UTP_MIIR_LOADOBJ a set of UTPs for the miir/loadobj method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_loadobj.m,v 1.1 2009/01/12 14:30:26 ingo Exp $ +% + +% +% +% The loadobj method of the miir class will be automatically called by +% MATLAB if an older object is not compatible with the current object structure. +% This happens only for objects which are stored as a MATLAB formatted +% (MAT-file). The load mechanism for XML formated files calls always the +% 'update_struct' method to keep the stored objects up to date. The +% 'update_struct' method convert the read object structure to the object +% structure which is used in the currend LTPDA version. +% This UTP will load old objects which are stored with an older LTPDA version. +% +% REMARK: Since LTPDA version 1.9.2 will be an object which should be saved as a +% MAT file stored as a struct and not as the object. +% +% + +function results = utp_miir_loadobj(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'loadobj'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Run the tests + results = [results utp_01]; % getInfo call + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Get all .MAT and .XML files + path = fullfile(fileparts(which(mfilename)), '..', '..', 'utp_test_files'); + + matfiles = utils.prog.filescan(path, '.mat'); + xmlfiles = utils.prog.filescan(path, '.xml'); + + % Load .MAT files + obj_no = 1; + for ii=1:numel(matfiles) + fn = matfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = miir(fn); + obj_no = obj_no+1; + end + end + + % Load .XML files + for ii=1:numel(xmlfiles) + fn = xmlfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = miir(fn); + obj_no = obj_no+1; + end + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the shape of the loaded objects. + % + % + + atest = true; + if stest + % + for ii = 1:numel(objs) + obj = objs(ii).obj; + fname = objs(ii).fname; + + if ~isempty(strfind(fname, '_vec')) + % Loaded object must be a vector + if ~isvector(obj), atest = false; end + elseif ~isempty(strfind(fname, '_mat')) + % Loaded object must be a matrix + % REMARK: Known error in LTPDA version 1.9.2 + % A saved matrix doesn't keep the shape of the matrix. + if isempty(strfind(fname, '_192')) + if ~(size(obj,1) > 1 && size(obj,2) > 1), atest = false; end + end + else + % Loaded object must be a single object + if ~(size(obj,1) == 1 && size(obj,2) == 1), + atest = false; end + end + + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_miir.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_miir.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,1801 @@ +% UTP_MIIR_MIIR a set of UTPs for the miir/miir method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_miir.m,v 1.38 2011/08/22 05:37:13 hewitson Exp $ +% + +% +% +% The miir method of the miir class constructs MIIR objects. +% +% + +function results = utp_miir_miir(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'miir'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test objects + [iirhp,iirlp,iirbp,iirbr,iirpzm,iirab,iirv,iirm] = get_test_objects_miir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working with empty constructor + results = [results utp_07]; % Test history is working with copy constructor + results = [results utp_08]; % Test history is working with MAT file constructor + results = [results utp_09]; % Test history is working with XML file constructor + results = [results utp_10]; % Test history is working with FIL file constructor + results = [results utp_11]; % Test history is working with struct constructor + results = [results utp_12]; % Test history is working with parfrac-object constructor + results = [results utp_13]; % Test history is working with pzmodel-object constructor + results = [results utp_14]; % Test history is working with plist(filename) constructor + results = [results utp_15]; % Test history is working with plist(hostname) constructor + results = [results utp_16]; % Test history is working with plist(type) constructor + results = [results utp_17]; % Test history is working with plist(pzmodel) constructor + results = [results utp_18]; % Test history is working with plist(parfrac) constructor + results = [results utp_19]; % Test history is working with plist(plist) constructor + results = [results utp_20]; % Test history is working with plist(a+b) constructor + results = [results utp_21]; % Test history is working with pzmodel + plist constructor + results = [results utp_22]; % Test history is working with parfrac + plist constructor + results = [results utp_23]; % Test history is working with conn+Id constructor + results = [results utp_24]; % Test history is working with a + b + fs constructor + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From XML File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From MAT File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From LISO File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Repository')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Standard Type')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Parfrac')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Pzmodel')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From AB')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Built-in Model')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + pn = 3; + if io(pn).plists.nparams ~= 3, atest = false; end + % Check key + % Check default value + % Check options + %%%%%%%%%% SET 'From MAT File' + pn = 4; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + %%%%%%%%%% SET 'From XML File' + pn = 5; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + %%%%%%%%%% SET 'From Repository' + pn = 6; + if io(pn).plists.nparams ~= 10, atest = false; end + % Check key + if ~io(pn).plists.isparam('hostname'), atest = false; end + if ~io(pn).plists.isparam('id'), atest = false; end + if ~io(pn).plists.isparam('cid'), atest = false; end + if ~io(pn).plists.isparam('database'), atest = false; end + if ~io(pn).plists.isparam('binary'), atest = false; end + if ~io(pn).plists.isparam('username'), atest = false; end + if ~io(pn).plists.isparam('password'), atest = false; end + % Check default value + if ~isEmptyDouble(io(pn).plists.find('id')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('cid')), atest = false; end + if ~isequal(io(pn).plists.find('binary'), 'yes'), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('id'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('cid'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('binary'), {'yes', 'no'}), atest = false; end + %%%%%%%%%% SET 'From Built-in Model' + pn = 7; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('built-in'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('built-in')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('built-in'), {''}), atest = false; end + %%%%%%%%%% SET 'From LISO File' + pn = 8; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + %%%%%%%%%% SET 'From Standard Type' + pn = 9; + if io(pn).plists.nparams ~= 11, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('type'), atest = false; end + if ~io(pn).plists.isparam('fc'), atest = false; end + if ~io(pn).plists.isparam('gain'), atest = false; end + if ~io(pn).plists.isparam('fs'), atest = false; end + if ~io(pn).plists.isparam('order'), atest = false; end + if ~io(pn).plists.isparam('ripple'), atest = false; end + if ~io(pn).plists.isparam('iunits'), atest = false; end + if ~io(pn).plists.isparam('ounits'), atest = false; end + % Check default value + if ~isequal(io(pn).plists.find('type'), 'lowpass'), atest = false; end + if ~isequal(io(pn).plists.find('fc'), .1), atest = false; end + if ~isequal(io(pn).plists.find('gain'), 1), atest = false; end + if ~isequal(io(pn).plists.find('fs'), 1), atest = false; end + if ~isequal(io(pn).plists.find('order'), 1), atest = false; end + if ~isequal(io(pn).plists.find('ripple'), .5), atest = false; end + if ~isEmptyChar(io(pn).plists.find('iunits')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('ounits')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('type'), {'highpass', 'lowpass', 'bandpass', 'bandreject'}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('fc'), {.1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('gain'), {1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('fs'), {1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('order'), {1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('ripple'), {.5}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('iunits'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('ounits'), {''}), atest = false; end + %%%%%%%%%% SET 'Allpass' + pn = 10; + if io(pn).plists.nparams ~= 8, atest = false; end + % Check key + if ~io(pn).plists.isparam('delay'), atest = false; end + if ~io(pn).plists.isparam('N'), atest = false; end + if ~io(pn).plists.isparam('method'), atest = false; end + % Check default value + if ~isEmptyDouble(io(pn).plists.find('delay')), atest = false; end + if ~isequal(io(pn).plists.find('N'), 1), atest = false; end + if ~isequal(io(pn).plists.find('method'), 'thirlen'), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('delay'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('N'), {[1]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('method'), {'thirlen'}), atest = false; end + %%%%%%%%%% SET 'From Parfrac' + pn = 11; + if io(pn).plists.nparams ~= 7, atest = false; end + % Check key + if ~io(pn).plists.isparam('parfrac'), atest = false; end + if ~io(pn).plists.isparam('fs'), atest = false; end + if ~io(pn).plists.isparam('iunits'), atest = false; end + if ~io(pn).plists.isparam('ounits'), atest = false; end + % Check default value + if ~eq(io(pn).plists.find('parfrac'), parfrac(), ple1), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('fs')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('iunits')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('ounits')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('iunits'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('ounits'), {''}), atest = false; end + %%%%%%%%%% SET 'From Pzmodel' + pn = 12; + if io(pn).plists.nparams ~= 7, atest = false; end + % Check key + if ~io(pn).plists.isparam('pzmodel'), atest = false; end + if ~io(pn).plists.isparam('fs'), atest = false; end + if ~io(pn).plists.isparam('iunits'), atest = false; end + if ~io(pn).plists.isparam('ounits'), atest = false; end + % Check default value + if ~eq(io(pn).plists.find('pzmodel'), pzmodel(), ple1), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('fs')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('iunits')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('ounits')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('iunits'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('ounits'), {''}), atest = false; end + %%%%%%%%%% SET 'From AB' + pn = 13; + if io(pn).plists.nparams ~= 8, atest = false; end + % Check key + if ~io(pn).plists.isparam('a'), atest = false; end + if ~io(pn).plists.isparam('b'), atest = false; end + if ~io(pn).plists.isparam('fs'), atest = false; end + if ~io(pn).plists.isparam('name'), atest = false; end + % Check default value + if ~isEmptyDouble(io(pn).plists.find('a')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('b')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('fs')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('a'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('b'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('name'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the miir method works with a vector of MIIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the miir method works with a vector of MIIR objects as input. + % + % + + try + % + out = miir(iirv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output MIIRs is the same as the input shape. + % 2) Check that each output MIIR is a copy of the input MIIR. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + if stest + % + % Check we have the correct shape + if size(out) ~= size(iirv), atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(iirv(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(iirv(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(iirv(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the miir method works with a matrix of MIIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the miir method works with a matrix of MIIR objects as input. + % + % + + try + % + out = miir(iirm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output MIIRs is the same as the input shape. + % 2) Check that each output MIIR is a copy of the input MIIR. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if size(out) ~= size(iirm), atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(iirm(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(iirm(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(iirm(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the miir method works with a list of MIIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the miir method works with a list of MIIR objects as input. + % + % + + try + % + out = miir(iirhp, iirlp, iirbp); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same of the + % number in the input. + % 2) Check that each output MIIR is a copy of the input MIIR. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + iirin = [iirhp, iirlp, iirbp]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(iirin(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(iirin(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(iirin(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the miir method works with a mix of different shaped MIIRs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the miir method works with a mix of different shaped MIIRs as + % input. + % + % + + try + % + out = miir(iirhp,iirv,iirbr,iirm,iirlp); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same of the + % number in the input. + % 2) Check that each output MIIR is a copy of the input MIIR. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + iirin = [iirhp, reshape(iirv, 1, []), iirbr, reshape(iirm, 1, []), iirlp]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3+numel(iirv)+numel(iirm), atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(iirin(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(iirin(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(iirin(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the miir method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the miir method can be processed back. + % + % + + try + % + out = miir(iirlp); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'miir'. + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'miir'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the miir method properly applies history to the copy constructor. + % + % + function result = utp_07 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % Test the constructor with a different number of inputs. + % + % + + try + % + out1 = miir(iirhp); + out2 = miir(iirhp, iirlp); + out3 = miir(iirhp, iirlp, iirbp); + out1.setName('my name'); + out2(1).setName('my name'); + out2(2).setName('my name'); + out3(1).setName('my name'); + out3(2).setName('my name'); + out3(3).setName('my name'); + mout = rebuild(out1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'miir'. + % 2) Check that the original objects are not changed by the setter function + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + % It is the method 'setName' because we set it in above + if ~strcmp(out1.hist.methodInfo.mname, 'setName'), atest = false; end + % Check next to the last step in the history of 'out' + if ~strcmp(out1.hist.inhists.methodInfo.mname, 'miir'), atest = false; end + % Check the originals + if strcmp(iirhp, 'my name'), atest = false; end + if strcmp(iirlp, 'my name'), atest = false; end + if strcmp(iirbp, 'my name'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out1, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the miir method properly applies history to the read + % MAT-file constructor. + % + % + function result = utp_08 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + filename = 'iir.mat'; + iir = miir(iirlp); + save(iir, filename); + + out = miir(filename); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history is the same as the history of the saved + % object. Because save and load shouldn't add a history step. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check that the saved and loaded objects are the same + if ~eq(out, iir), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + delete(filename); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + + %% UTP_09 + + % + % + % Tests that the miir method properly applies history to the read + % XML-file constructor. + % + % + function result = utp_09 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + filename = 'iir.xml'; + amat = miir(iirm); + save(amat, filename); + + out = miir(filename); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history is the same as the history of the saved + % object. Because save and load shouldn't add a history step. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~eq(out, amat), atest = false; end + + % Check the rebuilt object + for kk = 1:numel(out) + if ~eq(mout(kk), out(kk), ple2), atest = false; end + end + % + delete(filename); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Tests that the miir method properly applies history to the read + % FIL-file constructor. + % + % + function result = utp_10 + + % + % + % Read the FIL file which is created from LISO. + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + filename = 'test_iir.fil'; + out = miir(filename); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' + % corresponds to 'miir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'miir'), atest = false; end + % Reading a file adds additionally history steps + if ~isa(out, 'miir'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_11 + + % + % + % Tests that the miir method properly applies history to the struct constructor. + % + % + function result = utp_11 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + siirhp = struct(iirhp); + siirhp.iunits = struct(iirhp.iunits); + siirhp.ounits = struct(iirhp.ounits); + siirhp.hist = struct(iirhp.hist); + + out1 = miir(struct(iirpzm)); + out2 = miir(siirhp); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' + % corresponds to 'miir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check that the output is a MIIR object + if ~isa(out1,'miir'), atest = false; end + if ~isa(out2,'miir'), atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'setName'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'setName'), atest = false; end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_11 + + %% UTP_12 + + % + % + % Tests that the miir method properly applies history to the parfrac constructor. + % + % + function result = utp_12 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + pfrac = parfrac([1 2], {4, 6+2i}, 0, 'my par frac', unit('V'), unit('Hz')); + out = miir(pfrac); + iir1 = out.index(1); + iir2 = out.index(2); + mout1 = rebuild(iir1); + mout2 = rebuild(iir2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' + % corresponds to 'miir'. + % 2) Check the correct number of outputs. + % 3) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check that the output is a MIIR object + if ~isa(out,'miir'), atest = false; end + % Check number of filter objects. This parfrac objects created two filter. + if numel(out) ~= 2, atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out(1).hist.methodInfo.mname, 'miir'), atest = false; end + if ~strcmp(out(2).hist.methodInfo.mname, 'miir'), atest = false; end + % Check the rebuilt object + if ~eq(mout1, iir1, ple2), atest = false; end + if ~eq(mout2, iir2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Tests that the miir method properly applies history to the pzmodel constructor. + % + % + function result = utp_13 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + ps = [pz(1) pz(200)]; + zs = pz(50); + pzm = pzmodel(1, ps, zs, unit('Hz^2'), unit('V^2')); + out = miir(pzm); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' + % corresponds to 'miir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check that the output is a MIIR object + if ~isa(out,'miir'), atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'miir'), atest = false; end + if ~strcmp(out.hist.inhists.methodInfo.mname, 'pzmodel'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + %% UTP_14 + + % + % + % Tests that the miir method properly applies history to the + % plist(filename) constructor. + % + % + function result = utp_14 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + try + % + filename1 = 'iir.xml'; + filename2 = 'iir.mat'; + filename3 = 'test_iir.fil'; + + f1 = miir(iirpzm); + f2 = miir(iirlp); + + save(f1, filename1); + save(f2, filename2); + + out1 = miir(plist('filename', filename1)); + out2 = miir(plist('filename', filename2)); + out3 = miir(plist('filename', filename3)); + + rout1 = out1.rebuild; + rout2 = out2.rebuild; + rout3 = out3.rebuild; + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the save method doesn't change the input object + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % The load doesn't have two additionally history steps (save + load) + if ~eq(out1, f1, ple1), atest = false; end + if ~eq(out2, f2, ple1), atest = false; end + % Rebuild object and check the result + if ~eq(rout1, out1, ple2), atest = false; end + if ~eq(rout2, out2, ple2), atest = false; end + if ~eq(rout3, out3, ple2), atest = false; end + % + % delete test file + delete(filename1) + delete(filename2) + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_14 + + %% UTP_15 + + % + % + % Tests that the MIIR method properly applies history to the + % plist(conn) constructor. + % + % + function result = utp_15 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + conn = utpGetConnection(); + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_miir_miir_15: submit miir vector'; + sinfo.experiment_description = 'utp_miir_miir_15: &description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + plForAutoTest = plist('no dialog', true, 'use selector', false); + ids = submit(iirv, sinfo, plForAutoTest); + + out = miir(plist('hostname', utpGetHostname, 'database', utpGetDatabase, 'conn', conn, 'id', ids)); + % + % Close connection + utpCloseConnection(conn); + stest = true; + catch err + disp(err.message) + % Close connection + utpCloseConnection(conn); + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'miir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + for kk = 1:numel(out) + if ~strcmp(out(kk).hist.methodInfo.mname, 'miir'), atest = false; end + end + % Check data values + if ~eq(out, iirv, ple3), atest = false; end + % Rebuild object and check the result + % + % This test is in an automatic test not possible because the repository + % asks for username and password. + % + % Manually tested by: Ingo Diepholz + % Test date: 01.12.2008 + % Status: success + % + % rout = rebuild(out); + % if ~eq(rout, out, ple3), atest = false; end + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_15 + + %% UTP_16 + + % + % + % Tests that the MIIR method properly applies history to the + % plist(type) constructor. + % + % + function result = utp_16 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + pl1 = plist('type', 'lowpass'); + pl2 = plist('type', 'highpass'); + pl3 = plist('type', 'bandpass'); + pl4 = plist('type', 'bandreject'); + plerr = plist('type', 'wrong name'); + + % Use different values to the default values + fs = 1000; + fc = 60; + fcb = [50 100]; + order = 3; + pl = plist('fs', fs, 'fc', fc, 'order', order); + plb = plist('fs', fs, 'fc', fcb, 'order', order); + + out1 = miir(combine(pl1, pl)); + out2 = miir(combine(pl2, pl)); + out3 = miir(combine(pl3, plb)); + out4 = miir(combine(pl4, plb)); + + rout1 = rebuild(out1); + rout2 = rebuild(out2); + rout3 = rebuild(out3); + rout4 = rebuild(out4); + + try + % Negative test: Should throw an error + miir(plerr); + stest = false; + catch + stest = true; + end + + % + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'miir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'miir'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'miir'), atest = false; end + if ~strcmp(out3.hist.methodInfo.mname, 'miir'), atest = false; end + if ~strcmp(out4.hist.methodInfo.mname, 'miir'), atest = false; end + % Check 'lowpass' filter + [a, b] = butter(order, 2*fc/fs); + if ~isequal(out1.a, a), atest = false; end + if ~isequal(out1.b, b), atest = false; end + if ~isequal(out1.fs, fs), atest = false; end + if ~strcmp(out1.name, 'lowpass'), atest = false; end + % Check 'highpass' filter + [a, b] = butter(order, 2*fc/fs, 'high'); + if ~isequal(out2.a, a), atest = false; end + if ~isequal(out2.b, b), atest = false; end + if ~isequal(out2.fs, fs), atest = false; end + if ~strcmp(out2.name, 'highpass'), atest = false; end + % Check 'bandpass' filter + [a, b] = cheby1(order, .5, 2.*fcb./fs); + if ~isequal(out3.a, a), atest = false; end + if ~isequal(out3.b, b), atest = false; end + if ~isequal(out3.fs, fs), atest = false; end + if ~strcmp(out3.name, 'bandpass'), atest = false; end + % Check 'bandpass' filter + [a, b] = cheby1(order, .5, 2.*fcb./fs, 'stop'); + if ~isequal(out4.a, a), atest = false; end + if ~isequal(out4.b, b), atest = false; end + if ~isequal(out4.fs, fs), atest = false; end + if ~strcmp(out4.name, 'bandreject'), atest = false; end + % Rebuild object and check the result + if ~eq(rout1, out1, ple1), atest = false; end + if ~eq(rout2, out2, ple1), atest = false; end + if ~eq(rout3, out3, ple1), atest = false; end + if ~eq(rout4, out4, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_16 + + %% UTP_17 + + % + % + % Tests that the MIIR method properly applies history to the + % plist(pzmodel) constructor. + % + % + function result = utp_17 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + ps = [pz(1) pz(200)]; + zs = pz(50); + pzm = pzmodel(1, ps, zs, unit('Hz'), unit('V')); + pl = plist('pzmodel', pzm, 'fs', 1000); + out = miir(pl); + + rout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'miir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'miir'), atest = false; end + % Check the next to the last step in the history. + % It must be the history of the pole/zero model (here 'pzmodel') + % Since we changed the constructors, the history no longer contains the pzmodel + % since we put the pzmodel in the plist. + % if ~strcmp(out.hist.inhists.methodInfo.mname, 'pzmodel'), atest = false; end + % Check values + if ~isequal(out.fs, 1000), atest = false; end + if ~eq(out.iunits, unit('Hz')), atest = false; end + if ~eq(out.ounits, unit('V')), atest = false; end + % Rebuild object and check the result + if ~eq(rout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_17 + + %% UTP_18 + + % + % + % Tests that the MIIR method properly applies history to the + % plist(parfrac) constructor. + % + % + function result = utp_18 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + pfrac = parfrac([1 2], {4, 6}, 8, 'my par frac', unit('V'), unit('Hz')); + pl = plist('parfrac', pfrac, 'fs', 1000); + out = miir(pl); + + iir1 = out.index(1); + iir2 = out.index(2); + iir3 = out.index(3); + rout1 = rebuild(iir1); + rout2 = rebuild(iir2); + rout3 = rebuild(iir3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'miir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + for ii = 1:numel(out) + % Check the last step in the history of 'out' + if ~strcmp(out(ii).hist.methodInfo.mname, 'miir'), atest = false; end + % Check the next to the last step in the history. + % It must be the history of the partial fraction model (here 'parfrac') + if ~strcmp(out(ii).hist.inhists.methodInfo.mname, 'parfrac'), atest = false; end + % Check values + if ~isequal(out(ii).fs, 1000), atest = false; end + if ~eq(out(ii).iunits, unit('V')), atest = false; end + if ~eq(out(ii).ounits, unit('Hz')), atest = false; end + end + % Rebuild object and check the result + if ~eq(rout1, iir1, ple2), atest = false; end + if ~eq(rout2, iir2, ple2), atest = false; end + if ~eq(rout3, iir3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_18 + + %% UTP_19 + + % + % + % Tests that the MIIR method properly applies history to the + % plist() constructor. + % + % + function result = utp_19 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + pfrac = parfrac([1 2], {4, 6}, 8, 'my par frac', unit('V'), unit('Hz')); + pl = plist('parfrac', pfrac, 'fs', 1000); + out1 = miir(plist('plist', pl)); + out2 = miir(plist('plist', plist())); % empty plist + + iir1 = out1.index(1); + iir2 = out1.index(2); + iir3 = out1.index(3); + rout1 = rebuild(iir1); + rout2 = rebuild(iir2); + rout3 = rebuild(iir3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'miir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + for ii = 1:numel(out1) + % Check the last step in the history of 'out1' + if ~strcmp(out1(ii).hist.methodInfo.mname, 'miir'), atest = false; end + % Check the next to the last step in the history. + % It must be the history of the partial fraction model (here 'parfrac') + if ~strcmp(out1(ii).hist.inhists.methodInfo.mname, 'parfrac'), atest = false; end + % Check values + if ~isequal(out1(ii).fs, 1000), atest = false; end + if ~eq(out1(ii).iunits, unit('V')), atest = false; end + if ~eq(out1(ii).ounits, unit('Hz')), atest = false; end + end + % Check the last step in the history of 'out2' + if ~strcmp(out2.hist.methodInfo.mname, 'miir'), atest = false; end + % Check the next to the last step in the history. + if ~isempty(out2.hist.inhists), atest = false; end + % Rebuild object and check the result + if ~eq(rout1, iir1, ple2), atest = false; end + if ~eq(rout2, iir2, ple2), atest = false; end + if ~eq(rout3, iir3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_19 + + %% UTP_20 + + % + % + % Tests that the MIIR method properly applies history to the a,b constructor. + % + % + function result = utp_20 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + pl = plist('a', [1 2 3], 'b', [4 5 6], 'fs', 123); + out = miir(pl); + + rout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'miir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'miir'), atest = false; end + % Check values + if ~isequal(out.fs, 123), atest = false; end + if ~isequal(out.a, [1 2 3]), atest = false; end + if ~isequal(out.b, [4 5 6]), atest = false; end + % Rebuild object and check the result + if ~eq(rout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_20 + + %% UTP_21 + + % + % + % Tests that the MIIR method properly applies history to the + % pole/zero model + plist object constructor. + % + % + function result = utp_21 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + ps = [pz(1) pz(200)]; + zs = pz(50); + pzm = pzmodel(1, ps, zs, unit('Hz'), unit('V')); + pl = plist('fs', 123); + out = miir(pzm, pl); + + rout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'miir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'miir'), atest = false; end + % Check values + if ~isequal(out.fs, 123), atest = false; end + if ~eq(out.iunits, unit('Hz')), atest = false; end + if ~eq(out.ounits, unit('V')), atest = false; end + % Rebuild object and check the result + if ~eq(rout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_21 + + %% UTP_22 + + % + % + % Tests that the MIIR method properly applies history to the + % partial fraction model + plist object constructor. + % + % + function result = utp_22 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + pfrac = parfrac(1, 4, 0, 'my par frac', unit('V'), unit('Hz')); + pl = plist('fs', 123); + out = miir(pfrac, pl); + + rout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'miir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'miir'), atest = false; end + % Check values + if ~isequal(out.fs, 123), atest = false; end + if ~eq(out.iunits, unit('V')), atest = false; end + if ~eq(out.ounits, unit('Hz')), atest = false; end + % Rebuild object and check the result + if ~eq(rout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_22 + + %% UTP_23 + + % + % + % Tests that the MIIR method properly applies history to the conn+Id constructor. + % + % + function result = utp_23 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + conn = utpGetConnection(); + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_miir_miir_23: submit miir'; + sinfo.experiment_description = 'utp_miir_miir_23: description'; + sinfo.analysis_description = 'utp_miir_miir_23'; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + plForAutoTest = plist('no dialog', true, 'use selector', false); + [ids] = submit(iirab, sinfo, plForAutoTest); + + out = miir(conn, ids); + % + % Close connection + utpCloseConnection(conn); + stest = true; + catch err + disp(err.message) + % Close connection + utpCloseConnection(conn); + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'miir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'miir'), atest = false; end + % Check data values + if ~eq(out,iirab, ple3), atest = false; end + % Check the history except the additional 'submit' + 'retrieve' steps + if ~eq(out.hist.inhists, iirab.hist), atest = false; end + % + % This test is in an automatic test not possible because the repository + % asks for username and password + % + % Manual test by: Ingo Diepholz + % Test date: 01.12.2008 + % Status: success + % + % rout = rebuild(out); + % if ~eq(mout, out, ple3), atest = false; end + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_23 + + %% UTP_24 + + % + % + % Tests that the MIIR method properly applies history to the + % a + b + fs object constructor. + % + % + function result = utp_24 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + a = [1 2 3]; + b = [5 6 7]; + fs = 123.123; + out = miir(a,b,fs); + + rout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'miir'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'miir'), atest = false; end + % Check values + if ~isequal(out.fs, 123.123), atest = false; end + if ~isequal(out.a, [1 2 3]), atest = false; end + if ~isequal(out.b, [5 6 7]), atest = false; end + % Rebuild object and check the result + if ~eq(rout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_24 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_ne.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_ne.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,455 @@ +% UTP_MIIR_NE a set of UTPs for the miir/ne method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_ne.m,v 1.6 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The ne() method of the miir class iir1 ~= iir2 compares each element of an +% miir object with the corresponding element of an second iir object and returns +% a logical 1 (true) where iir1 and iir2 are not equal, or logical 0 (false) +% where they are equal. +% +% + +function results = utp_miir_ne(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'ne'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MIIR objects + [iirhp,iirlp,iirbp,iirbr,iirpzm,iirab,iirv,iirm] = get_test_objects_miir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test with the exception list 'name' + results = [results utp_08]; % Test exception list in a plist + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the ne method works with a vector of MIIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the ne method works for a vector of MIIR objects as input. + % Test the positive and the negative case. + % + % + + try + % + iir = iirpzm.setName('my name'); + iirv1 = [iirab, iirbr, iirhp, iirpzm]; + iirv2 = [iirab, iirbr, iirhp, iir]; + out1 = ne(iirv1, iirv1); + out2 = ne(iirv1, iirv2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the ne function. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the ne method works with a matrix of MIIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the ne method works for a matrix of MIIR objects as input. + % Test the positive and the negative case. + % + % + + try + % + iir = iirpzm.setName('my name'); + iirm1 = [iirab, iirbr, iirpzm, iirpzm, iirhp, iirab]; + iirm2 = [iirab, iirbr, iir; iirpzm, iirhp, iirab]; + out1 = ne(iirm1, iirm1); + out2 = ne(iirm1, iirm2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the ne function. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the ne method works with a list of MIIR objects as input. + % + % + function result = utp_04 + + % + % + % The ne method doesn't works for a list of MIIR objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the ne method works with a mix of different shaped MIIR objects + % as input. + % + % + function result = utp_05 + + % + % + % The ne method doesn't works for a list of MIIR objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the ne method properly applies history. + % + % + function result = utp_06 + + % + % + % The ne method doesn't change the MIIR object, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the ne method with an exception list. + % The function miir/ne use the function miir/eq so it is not necessary to check + % all possibilities of the exception list. + % + % + function result = utp_07 + + % + % + % Test the ne method with the exception 'name'. Use the option 'internal' to + % suppress the history. It is necessary to add 'created' to the exception + % list because iir is created at an other time. + % + % + + try + % + iir = testCallerIsMethod(@setName, iirpzm, 'my name'); + out1 = ne(iir, iirpzm); + out2 = ne(iir, iirpzm, 'name', 'created', 'UUID'); + out3 = ne(iir, iirpzm, 'miir/name', 'created', 'UUID'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + if out3 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the ne method with an exception list which is in a plist. + % + % + function result = utp_08 + + % + % + % Test that the ne method uses the exception list in a plist. + % + % + + try + % + iir = testCallerIsMethod(@setName, iirpzm, 'my name'); + pl = plist('Exceptions', {'name', 'created', 'UUID'}); + out1 = ne(iir, iirpzm); + out2 = ne(iir, iirpzm, pl); + out3 = ne(iir, iirpzm, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + if out3 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_rebuild.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_rebuild.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,413 @@ +% UTP_MIIR_REBUILD a set of UTPs for the miir/rebuild method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_rebuild.m,v 1.2 2009/07/23 14:12:02 ingo Exp $ +% + +% +% +% The rebuild method of the miir class rebuilds the input objects using the +% history. This method is also intensively tested in the most other UTPs. +% +% + +function results = utp_miir_rebuild(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'rebuild'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MIIR objects + [iir1,iir2,iir3,iir4,iir5,iir6,iirv,iirm] = get_test_objects_miir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the output + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the rebuild method works with a vector of MIIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the rebuild method works for a vector of MIIR objects as input. + % + % + + try + % + out = rebuild(iirv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + % Check the output + if ~isa(out, 'miir'), atest = false; end; + for kk = 1:numel(iirv) + if eq(out(kk), iirv(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the rebuild method works with a matrix of MIIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the rebuild method works for a matrix of MIIR objects as input. + % + % + + try + % + out = rebuild(iirm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + if ~isa(out, 'miir'), atest = false; end; + for kk = 1:numel(iirm) + if eq(out(kk), iirm(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the rebuild method works with a list of MIIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the rebuild method works for a list of MIIR objects as input. + % + % + + try + % + out = rebuild(iir5,iir4,iir3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + iirin = [iir5,iir4,iir3]; + if stest + % + if ~isa(out, 'miir'), atest = false; end; + for kk = 1:numel(iirin) + if eq(out(kk), iirin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the rebuild method works with a mix of different shaped MIIR objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the rebuild method works with an input of matrices and vectors + % and single MIIR objects. + % + % + + try + % + out = rebuild(iir4,iirv,iir2,iirm,iir1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + iirin = [iir4,reshape(iirv,1,[]),iir2,reshape(iirm,1,[]),iir1]; + if stest + % + if ~isa(out, 'miir'), atest = false; end; + for kk = 1:numel(iirin) + if eq(out(kk), iirin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the rebuild method properly applies history. + % + % + function result = utp_06 + + % + % + % The method rebuild doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the rebuild method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = rebuild(iir1, iir2); + o3 = rebuild(iir1, iir2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, iir1, ple2), atest = false; end + if ~eq(o2, iir2, ple2), atest = false; end + if ~eq(o3, [iir1 iir2], ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_redesign.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_redesign.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,632 @@ +% UTP_MIIR_REDESIGN a set of UTPs for the miir/redesign method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_redesign.m,v 1.3 2011/04/17 15:47:40 ingo Exp $ +% + +% +% +% The redesign method of the miir class redesign the input filter to work for the +% given sample rate. +% +% + +function results = utp_miir_redesign(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'redesign'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MIIR objects + [iirhp,iirlp,iirbp,iirbr,iirpzm,iirab,iirv,iirm] = get_test_objects_miir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + e = ple3.find('EXCEPTIONS'); + ple3 = plist('EXCEPTIONS', [e {'iunits', 'ounits'}]); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test redesign from a standard type + results = [results utp_08]; % Test redesign from a pzmodel type + results = [results utp_09]; % Test redesign from a parfrac type + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the redesign method works with a vector of MIIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the redesign method works for a vector of MIIR objects as input. + % To keep this UTP simple use for the vector only one filter object. The + % different filters will be tested in an other UTP. + % + % + + try + % + hp = miir(iirhp); + hp.setIunits('Hz'); + hp.setOunits('m^-2/3'); + iirvec = [hp, hp, hp]; + out1 = redesign(iirvec, 123); + out2 = redesign(iirvec, plist('fs', 123)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'iirvec' + % 2) Check that each output MIIR contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(iirvec)), atest = false; end + if ~isequal(size(out2), size(iirvec)), atest = false; end + % Check each output against the redesign of the filter with the + % new frequency + iirhp_123 = miir(plist('type', 'highpass', 'fs', 123)); + for kk=1:numel(iirvec) + if ~eq(out1(kk), iirhp_123, ple3), atest = false; end + % The following values must have the same as the input values + if ~strcmp(out1(kk).name, hp.name), atest = false; end + if ~eq(out1(kk).iunits, hp.iunits), atest = false; end + if ~eq(out1(kk).ounits, hp.ounits), atest = false; end + end + % 'out1' must be the same as 'out2' + if ~eq(out1, out2, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the redesign method works with a matrix of MIIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the redesign method works for a matrix of MIIR objects as input. + % To keep this UTP simple use for the matrix only one filter object. The + % different filters will be tested in an other UTP. + % + % + + try + % + hp = miir(iirhp); + hp.setIunits('Hz'); + hp.setOunits('m^-2/3'); + iirmat = [hp, hp, hp; hp, hp, hp]; + out1 = redesign(iirmat, 123); + out2 = redesign(iirmat, plist('fs', 123)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'iirmat' + % 2) Check that each output MIIR contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(iirmat)), atest = false; end + if ~isequal(size(out2), size(iirmat)), atest = false; end + % Check each output against the redesign of the filter with the + % new frequency + iirhp_123 = miir(plist('type', 'highpass', 'fs', 123)); + for kk=1:numel(iirmat) + if ~eq(out1(kk), iirhp_123, ple3), atest = false; end + % The following values must have the same as the input values + if ~strcmp(out1(kk).name, hp.name), atest = false; end + if ~eq(out1(kk).iunits, hp.iunits), atest = false; end + if ~eq(out1(kk).ounits, hp.ounits), atest = false; end + end + % 'out1' must be the same as 'out2' + if ~eq(out1, out2, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the redesign method works with a list of MIIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the redesign method works for a list of MIIR objects as input. + % To keep this UTP simple use for the list only one filter object. The + % different filters will be tested in an other UTP. + % + % + + try + % + hp = miir(iirhp); + hp.setIunits('Hz'); + hp.setOunits('m^-2/3'); + out1 = redesign(hp, hp, hp, 123); + out2 = redesign(hp, hp, hp, plist('fs', 123)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output MIIR contains the correct data. + % + % + + atest = true; + iirin = [hp, hp, hp]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 3, atest = false; end + if numel(out2) ~= 3, atest = false; end + % Check each output against the redesign of the filter with the + % new frequency + iirhp_123 = miir(plist('type', 'highpass', 'fs', 123)); + for kk=1:numel(iirin) + if ~eq(out1(kk), iirhp_123, ple3), atest = false; end + % The following values must have the same as the input values + if ~strcmp(out1(kk).name, hp.name), atest = false; end + if ~eq(out1(kk).iunits, hp.iunits), atest = false; end + if ~eq(out1(kk).ounits, hp.ounits), atest = false; end + end + % 'out1' must be the same as 'out2' + if ~eq(out1, out2, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the redesign method works with a mix of different shaped + % MIIR objects as input. + % + % + function result = utp_05 + + % + % + % Test that the redesign method works with an input of matrices and vectors + % and single MIIR objects. + % To keep this UTP simple use for the vector only one filter object. The + % different filters will be tested in an other UTP. + % + % + + try + % + hp = miir(iirhp); + hp.setIunits('Hz'); + hp.setOunits('m^-2/3'); + out1 = redesign(hp,[hp hp],hp,[hp hp hp; hp hp hp],hp, 123); + out2 = redesign(hp,[hp hp],hp,[hp hp hp; hp hp hp],hp, plist('fs', 123)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output MIIR contains the correct data. + % + % + + atest = true; + iirin = [hp hp hp hp hp hp hp hp hp hp hp]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= numel(iirin), atest = false; end + if numel(out2) ~= numel(iirin), atest = false; end + % Check each output against the redesign of the filter with the + % new frequency + iirhp_123 = miir(plist('type', 'highpass', 'fs', 123)); + for kk=1:numel(iirin) + if ~eq(out1(kk), iirhp_123, ple3), atest = false; end + % The following values must have the same as the input values + if ~strcmp(out1(kk).name, hp.name), atest = false; end + if ~eq(out1(kk).iunits, hp.iunits), atest = false; end + if ~eq(out1(kk).ounits, hp.ounits), atest = false; end + end + % 'out1' must be the same as 'out2' + if ~eq(out1, out2, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the redesign method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the redesign method can be processed back. + % + % + + try + % + hp = miir(iirhp); + hp.setIunits('Hz'); + hp.setOunits('m^-2/3'); + out = redesign(hp, 123); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'redesign'. + % 2) Check that re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'redesign'), atest = false; end + % Run 'test.m' and check the result + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the redesign method redesigns a standard filter type. + % + % + function result = utp_07 + + % + % + % Tests that the redesign method redesigns a standard filter type. + % + % + + try + % + out1 = redesign(iirhp, 123); + out2 = redesign(iirlp, 123); + out3 = redesign(iirbp, 123); + out4 = redesign(iirbr, 123); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check the rebuilt object + % + % + + atest = true; + if stest + % + % Check each output against the redesign of the filter with the new + % frequency + hp_123 = miir(plist('type', 'highpass', 'fs', 123)); + lp_123 = miir(plist('type', 'lowpass', 'fs', 123)); + bp_123 = miir(plist('type', 'bandpass', 'fs', 123, 'fc', [0.01 0.1])); + br_123 = miir(plist('type', 'bandreject', 'fs', 123, 'fc', [0.01 0.1])); + if ~eq(out1, hp_123, ple3), atest = false; end + if ~eq(out2, lp_123, ple3), atest = false; end + if ~eq(out3, bp_123, ple3), atest = false; end + if ~eq(out4, br_123, ple3), atest = false; end + % Run 'test[1..4].m' and check the result + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + if ~eq(mout4, out4, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the redesign method redesigns a pzmodel filter type. + % + % + function result = utp_08 + + % + % + % Tests that the redesign method redesigns a pzmodel filter type. + % + % + + try + % + pzm = pzmodel(1, [pz(1) pz(200)], pz(50)); + pzm.setName(); + pl = plist('pzmodel', pzm, 'fs', 1000); + iirpzm = miir(pl); + out = redesign(iirpzm, 123); + + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check the rebuilt object + % + % + + atest = true; + if stest + % + % Check each output against the redesign of the filter with the new + % frequency + pzm_123 = miir(plist('pzmodel', pzm, 'fs', 123)); + if ~eq(out, pzm_123, ple3), atest = false; end + % Check the result of the rebuilt object. + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Tests that the redesign method redesigns a parfrac filter type. + % + % + function result = utp_09 + + % + % + % Tests that the redesign method redesigns a parfrac filter type. + % + % + + try + % + pfrac = parfrac([1 2], {4, 6+2i}, 1, 'my par frac', unit('V'), unit('Hz')); + pl = plist('parfrac', pfrac, 'fs', 1000); + iirpf = miir(pl); + out = redesign(iirpf, 123); + + o1 = out.index(1); + o2 = out.index(2); + mo1 = rebuild(o1); + mo2 = rebuild(o2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check the rebuilt object + % + % + + atest = true; + if stest + % + % Check each output against the redesign of the filter with the new + % frequency + pf_123 = miir(plist('parfrac', pfrac, 'fs', 123)); + if ~eq(out, pf_123, ple3), atest = false; end + % Check the result of the rebuilt object. + if ~eq(mo1, o1, ple2), atest = false; end + if ~eq(mo2, o2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_resp.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_resp.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,1098 @@ +% UTP_MIIR_RESP a set of UTPs for the miir/resp method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_resp.m,v 1.4 2010/03/15 15:57:06 ingo Exp $ +% + +% +% +% The resp method of the miir class Make a frequency response of the filter. +% For a command with no output variables plots the method the result into a +% diagram. +% +% + +function results = utp_miir_resp(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'resp'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MIIR objects + [iir1,iir2,iir3,iir4,iir5,iir6,iirv,iirm] = get_test_objects_miir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test with f = ao.y + results = [results utp_11]; % Test with f + results = [results utp_12]; % Test with f1, f2 and nf + results = [results utp_13]; % Test with f1, f2 and nf AND 'scale' + results = [results utp_14]; % Test serial bank + results = [results utp_15]; % Test parallel bank + + % Make surethat all figures are closed + close all; + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'List')), atest = false; end + if ~any(strcmpi(io(2).sets, 'Range')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'List' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('f'), atest = false; end + if ~io(3).plists.isparam('bank'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('f')), atest = false; end + if ~isequal(io(3).plists.find('bank'), 'none'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('f'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('bank'), {'none', 'serial', 'parallel'}), atest = false; end + %%%%%%%%%% SET 'Range' + if io(4).plists.nparams ~= 5, atest = false; end + % Check key + if ~io(4).plists.isparam('f1'), atest = false; end + if ~io(4).plists.isparam('f2'), atest = false; end + if ~io(4).plists.isparam('nf'), atest = false; end + if ~io(4).plists.isparam('scale'), atest = false; end + if ~io(4).plists.isparam('bank'), atest = false; end + % Check default value + if ~isEmptyDouble(io(4).plists.find('f1')), atest = false; end + if ~isEmptyDouble(io(4).plists.find('f2')), atest = false; end + if ~isequal(io(4).plists.find('nf'), 1000), atest = false; end + if ~isequal(io(4).plists.find('scale'), 'log'), atest = false; end + if ~isequal(io(4).plists.find('bank'), 'none'), atest = false; end + % Check options + if ~isequal(io(4).plists.getOptionsForParam('f1'), {[]}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('f2'), {[]}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('nf'), {1000}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('scale'), {'lin', 'log'}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('bank'), {'none', 'serial', 'parallel'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the resp method works with a vector of MIIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the resp method works for a vector of MIIR objects as input. + % Test the method with an output and with no output (a diagram must appear) + % + % + + try + % + % Make sure that all figures are closed. + close all; + resp(iirv); + out = resp(iirv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Test the right number of lines in the diagram. + % 2) Check that the number of elements in 'out' is the same as in 'iirv' + % 3) Check that each output MIIR contains the correct data. + % + % + + THRESHOLD = 1e-12; + atest = true; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + % Check that the diagram have the same number of lines as the output + % object + if max(cellfun('size', lines, 1)) ~= numel(iirv), atest = false; end + % Check the number of output objects. + if ~isequal(size(out), size(iirv)), atest = false; end + % Check each output against the default values for f1, f2 and nf + for ii = 1:numel(out) + nf = find(miir.getInfo('resp', 'Range').plists, 'nf'); + % Default values always from the first filter + f1 = iirv(ii).fs/1000; + f2 = iirv(ii).fs/2-1/nf; + if ~isa(out(ii), 'ao'), atest = false; end + if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end + if out(ii).x(1) ~= f1, atest = false; end + if abs(out(ii).x(end)-f2)>THRESHOLD, atest = false; end + if numel(out(ii).x) ~= nf, atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the resp method works with a matrix of MIIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the resp method works for a matrix of MIIR objects as input. + % Test the method with an output and with no output (a diagram must appear) + % + % + + try + % + % Make sure that all figures are closed. + close all; + iirmat = [iir1, iir2, iir3; iir4, iir5, iir6]; + resp(iirmat); + out = resp(iirmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Test the right number of lines in the diagram. + % 2) Check that the number of elements in 'out' is the same as in 'iirmat' + % 3) Check that each output MIIR contains the correct data. + % + % + + atest = true; + THRESHOLD = 1e-12; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + % Check that the diagram have the same number of lines as the output + % object + if max(cellfun('size', lines, 1)) ~= numel(iirmat), atest = false; end + % Check the number of output objects. + if ~isequal(size(out), size(iirmat)), atest = false; end + % Check each output against the default values for f1, f2 and nf + for ii = 1:numel(out) + % Default values always from the first filter + nf = find(miir.getInfo('resp', 'Range').plists, 'nf'); + f1 = iirmat(ii).fs/1000; + f2 = iirmat(ii).fs/2-1/nf; + if ~isa(out(ii), 'ao'), atest = false; end + if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end + if out(ii).x(1) ~= f1, atest = false; end + if abs(out(ii).x(end)-f2)>THRESHOLD, atest = false; end + if numel(out(ii).x) ~= nf, atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the resp method works with a list of MIIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the resp method works for a list of MIIR objects as input. + % Test the method with an output and with no output (a diagram must appear) + % + % + + try + % + close all; + resp(iir1,iir2,iir3); + out = resp(iir1,iir2,iir3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Test the right number of lines in the diagram. + % 2) Check that the number of elements in 'out' is the same as in 'iirmat' + % 3) Check that each output MIIR contains the correct data. + % + % + + atest = true; + iirin = [iir1,iir2,iir3]; + THRESHOLD = 1e-15; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + % Check that the diagram have the same number of lines as the output + % object + if max(cellfun('size', lines, 1)) ~= numel(iirin), atest = false; end + % Check the number of output objects. + if ~isequal(size(out), size(iirin)), atest = false; end + % Check each output against the default values for f1, f2 and nf + for ii = 1:numel(out) + % Default values always from the first filter + nf = find(miir.getInfo('resp', 'Range').plists, 'nf'); + f1 = iirin(ii).fs/1000; + f2 = iirin(ii).fs/2-1/nf; + if ~isa(out(ii), 'ao'), atest = false; end + if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end + if out(ii).x(1) ~= f1, atest = false; end + if abs(out(ii).x(end)-f2)>THRESHOLD, atest = false; end + if numel(out(ii).x) ~= nf, atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the resp method works with a mix of different shaped MIIR + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the resp method works with an input of matrices and vectors + % and single MIIR objects. Test the method with an output and with no + % output (a diagram must appear) + % + % + + try + % + close all; + iirmat = [iir5, iir3, iir2; iir1, iir5, iir3]; + resp(iir1,iirv,iir2,iirmat,iir3); + out = resp(iir1,iirv,iir2,iirmat,iir3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Test the right number of lines in the diagram. + % 2) Check that the number of elements in 'out' is the same as in 'iirmat' + % 3) Check that each output MIIR contains the correct data. + % + % + + atest = true; + iirin = [iir1,reshape(iirv,1,[]),iir2,reshape(iirmat,1,[]),iir3]; + THRESHOLD = 1e-12; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + % Check that the diagram have the same number of lines as the output + % object + if max(cellfun('size', lines, 1)) ~= numel(iirin), atest = false; end + % Check the number of output objects. + if ~isequal(size(out), size(iirin)), atest = false; end + % Check each output against the default values for f1, f2 and nf + for ii = 1:numel(out) + % Default values always from the first filter + nf = find(miir.getInfo('resp', 'Range').plists, 'nf'); + f1 = iirin(ii).fs/1000; + f2 = iirin(ii).fs/2-1/nf; + if ~isa(out(ii), 'ao'), atest = false; end + if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end + if out(ii).x(1) ~= f1, atest = false; end + if abs(out(ii).x(end)-f2)>THRESHOLD, atest = false; end + if numel(out(ii).x) ~= nf, atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the resp method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the resp method can be processed back. + % + % + + try + % + close all; + resp(iir5); + out = resp(iir5); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'resp'. + % 2) Check that re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + x = get(lines{1}, 'XData'); + y1 = get(lines{1}, 'YData'); + y2 = get(lines{2}, 'YData'); + if ~isequal(x, out.x.'), atest = false; end + if ~isequal(y2, abs(out.y)'), atest = false; end + if ~isequal(y1, utils.math.phase(out.y)'), atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'resp'), atest = false; end + % Run 'test.m' and check the result + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that modify command plots the response into a diagram. + % + % + function result = utp_07 + + % + % + % Tests that modify command plots the response into a diagram. + % + % + + try + % + close all; + iir5.resp(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the response diagram. + % + % + + atest = true; + THRESHOLD = 1e-12; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + x = get(lines{1}, 'XData'); + % Default values always from the first filter + nf = find(miir.getInfo('resp', 'Range').plists, 'nf'); + f1 = iir5(1).fs/1000; + f2 = iir5(1).fs/2-1/nf; + if x(1) ~= f1, atest = false; end + if abs(x(end)-f2)>THRESHOLD, atest = false; end + if numel(x) ~= nf, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the output AO of the resp method keeps the shape of the used + % input f vector. + % + % + + try + % + close all; + arow = ao(1:100, linspace(.1, 5, 100)); + acol = arow.'; + f = linspace(.1, 5, 100); + out1 = resp(iir5, plist('f', arow)); + out2 = resp(iir5, plist('f', acol)); + out3 = resp(iir5, plist('f', f)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,1) ~= 1, atest = false; end + if size(out1.data.y,2) == 1, atest = false; end + if size(out2.data.y,1) == 1, atest = false; end + if size(out2.data.y,2) ~= 1, atest = false; end + if size(out3.data.y,1) ~= 1, atest = false; end + if size(out3.data.y,2) == 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the resp method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = resp(iir5, iir3); + o3 = resp(iir5, iir3); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the resp method uses the x-data of an input AO for f-vector. + % + % + function result = utp_10 + + % + % + % Call the method with different method to pass an AO in. + % + % + + try + % + f1 = .1; + f2 = 5; + nf = 100; + axy = ao(linspace(f1, f2, nf), randn(100,1)); + afs = ao(linspace(f1, f2, nf), randn(100,1), plist('type', 'fsdata')); + out1 = resp(iir5, plist('f', axy)); + out2 = resp(iir5, plist('f', afs)); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the output + if ~isa(out1, 'ao'), atest = false; end + if ~isa(out2, 'ao'), atest = false; end + if out1.x(1) ~= f1, atest = false; end + if out1.x(end) ~= f2, atest = false; end + if numel(out1.x) ~= nf, atest = false; end + if out2.x(1) ~= f1, atest = false; end + if out2.x(end) ~= f2, atest = false; end + if numel(out2.x) ~= nf, atest = false; end + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_11 + + % + % + % Check that the resp method uses the specified f-vector to compute the response. + % + % + function result = utp_11 + + % + % + % Call the method with different method to pass an f-vector in. + % + % + + try + % + f1 = .1; + f2 = 5; + nf = 100; + f = linspace(f1, f2, nf); + out1 = resp(iir5, plist('f', f)); + + mout1 = rebuild(out1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the output + if ~isa(out1, 'ao'), atest = false; end + if out1.x(1) ~= f1, atest = false; end + if out1.x(end) ~= f2, atest = false; end + if numel(out1.x) ~= nf, atest = false; end + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_11 + + %% UTP_12 + + % + % + % Check that the resp method uses the specified f1, f2, and nf to compute the response. + % + % + function result = utp_12 + + % + % + % Call the method with different method to pass f1, f2, and nf in. + % + % + + try + % + f1 = .1; + f2 = 5; + nf = 100; + nf2 = 123; + out3 = resp(iir5, plist('f1', f1, 'f2', f2, 'nf', nf)); + out4 = resp(iir5, plist('f1', f1, 'nf', nf2)); + out5 = resp(iir5, plist('f2', f2)); + + mout3 = rebuild(out3); + mout4 = rebuild(out4); + mout5 = rebuild(out5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + T = 1e-12; + if stest + % + % Check the output + nfd = find(miir.getInfo('resp', 'Range').plists, 'nf'); + f1d = iir5.fs/1000; + f2d = iir5.fs/2-1/nf; + f2d2 = iir5.fs/2-1/nf2; + if ~isa(out3, 'ao'), atest = false; end + if ~isa(out4, 'ao'), atest = false; end + if ~isa(out5, 'ao'), atest = false; end + if out3.x(1) ~= f1, atest = false; end + if abs(out3.x(end)-f2)>T, atest = false; end + if numel(out3.x) ~= nf, atest = false; end + if out4.x(1) ~= f1, atest = false; end + if abs(out4.x(end)-f2d2)>T, atest = false; end % Default values + if numel(out4.x) ~= nf2, atest = false; end + if out5.x(1) ~= f1d, atest = false; end % Default values + if abs(out5.x(end)-f2)>T, atest = false; end + if numel(out5.x) ~= nfd, atest = false; end % Default values + % Check the rebuilding of the object + if ~eq(out3, mout3, ple2), atest = false; end + if ~eq(out4, mout4, ple2), atest = false; end + if ~eq(out5, mout5, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Check that the resp method uses the specified f1, f2, and nf to compute the response. + % + % + function result = utp_13 + + % + % + % Call the method with different method to pass f1, f2, and nf in. + % + % + + try + % + f1 = .1; + f2 = 5; + nf = 123; + out1 = resp(iir5, plist('f1', f1, 'f2', f2, 'nf', nf, 'scale', 'lin')); + out2 = resp(iir5, plist('f1', f1, 'f2', f2, 'nf', nf, 'scale', 'log')); + out3 = resp(iir5, plist('scale', 'lin')); + out4 = resp(iir5, plist('scale', 'log')); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + T = 10e-12; + if stest + % + % Check the output + nfd = find(miir.getInfo('resp', 'Range').plists, 'nf'); + f1d = iir5.fs/1000; + f2d = iir5.fs/2-1/nfd; + if ~isa(out1, 'ao'), atest = false; end + if ~isa(out2, 'ao'), atest = false; end + if ~isa(out3, 'ao'), atest = false; end + if ~isa(out4, 'ao'), atest = false; end + xlin1 = linspace(f1, f2, nf); + xlin2 = linspace(f1d, f2d, nfd); + xlog1 = logspace(log10(f1), log10(f2), nf); + xlog2 = logspace(log10(f1d), log10(f2d), nfd); + if ~isequal(xlin1, out1.x'), atest = false; end + if ~isequal(xlin2, out3.x'), atest = false; end + if ~isequal(xlog1, out2.x'), atest = false; end + if ~isequal(xlog2, out4.x'), atest = false; end + + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + if ~eq(out3, mout3, ple2), atest = false; end + if ~eq(out4, mout4, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + %% UTP_14 + + % + % + % Check that the resp method the response of a serial filter bank. + % + % + function result = utp_14 + + % + % + % Check that the resp method the response of a serial filter bank. + % + % + + try + % + out = resp(iir1, iir2, plist('bank', 'serial')); + + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the output + if ~isa(out, 'ao'), atest = false; end + if numel(out) ~= 1, atest = false; end + s1 = resp(iir1); + s2 = resp(iir2); + stot = s1 .* s2; + if ~isequal(stot.x, out.x), atest = false; end + if ~isequal(stot.y, out.y), atest = false; end + % Check the rebuilding of the object + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_14 + + %% UTP_15 + + % + % + % Check that the resp method the response of a parallel filter bank. + % + % + function result = utp_15 + + % + % + % Check that the resp method the response of a parallel filter bank. + % + % + + try + % + out = resp(iir1, iir2, plist('bank', 'parallel')); + + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + T = 10e-12; + if stest + % + % Check the output + if ~isa(out, 'ao'), atest = false; end + if numel(out) ~= 1, atest = false; end + s1 = resp(iir1); + s2 = resp(iir2); + stot = s1 + s2; + if ~isequal(stot.x, out.x), atest = false; end + if ~isequal(stot.y, out.y), atest = false; end + % Check the rebuilding of the object + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_15 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_save.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_save.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,706 @@ +% UTP_MIIR_SAVE a set of UTPs for the miir/save method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_save.m,v 1.8 2010/08/31 09:43:48 hewitson Exp $ +% + +% +% +% The save method of the miir class saves a miir object to disk. Save stores +% the variables in a MATLAB formatted file (MAT-file) named filename.mat or in a +% XML fromat named filename.xml +% +% + +function results = utp_miir_save(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'save'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MIIR objects + [iirhp,iirlp,iirbp,iirbr,iirpzm,iirab,iirv,iirm] = get_test_objects_miir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test plist contains the filename + results = [results utp_09]; % Test with standard MIIR objects + results = [results utp_10]; % Test MIIR which is build from a pzmodel + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(3).plists.isparam('filename'), atest = false; end + if ~io(3).plists.isparam('prefix'), atest = false; end + if ~io(3).plists.isparam('postfix'), atest = false; end + if ~io(3).plists.isparam('individual files'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('filename'), ''), atest = false; end + if ~isequal(io(3).plists.find('prefix'), ''), atest = false; end + if ~isequal(io(3).plists.find('postfix'), ''), atest = false; end + if ~isequal(io(3).plists.find('individual files'), false), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('filename'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the save method works with a vector of MIIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the save method works for a vector of MIIR objects as input. + % Test both formats 'xml' and 'mat'. + % + % + + try + % + save(iirv, 'test.xml'); + save(iirv, 'test.mat'); + out1 = miir('test.xml'); + out2 = miir('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the same + % as in 'iirv' + % 2) Check that the loaded objects are the same as the saved objects. + % 3) The outputs 'out1' and 'out2' must be the same. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(iirv)), atest = false; end + if ~isequal(size(out2), size(iirv)), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(iirv(kk), out1(kk), ple1), atest = false; end + if ~eq(iirv(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the save method works with a matrix of MIIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the save method works for a matrix of MIIR objects as input. + % Test both formats 'xml' and 'mat'. + % + % + + try + % + save(iirm, 'test.xml'); + save(iirm, 'test.mat'); + out1 = miir('test.xml'); + out2 = miir('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the same + % as in 'iirm' + % 2) Check that the loaded objects are the same as the saved objects. + % 3) The outputs 'out1' and 'out2' must be the same. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(iirm)), atest = false; end + if ~isequal(size(out2), size(iirm)), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(iirm(kk), out1(kk), ple1), atest = false; end + if ~eq(iirm(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the save method works with a list of MIIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the save method works for a list of MIIR objects as input. + % Test both formats 'xml' and 'mat'. + % + % + + try + % + save(iirhp, iirpzm, iirbr, 'test.xml'); + save(iirhp, iirpzm, iirbr, 'test.mat'); + out1 = miir('test.xml'); + out2 = miir('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the same + % as in the list + % 2) Check that the loaded objects are the same as the saved objects. + % 3) The outputs 'out1' and 'out2' must be the same. + % + % + + atest = true; + iirin = [iirhp, iirpzm, iirbr]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 3, atest = false; end + if numel(out2) ~= 3, atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(iirin(kk), out1(kk), ple1), atest = false; end + if ~eq(iirin(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the save method works with a mix of different shaped MIIR objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the save method works with an input of matrices and vectors + % and single MIIR objects. Test both formats 'xml' and 'mat'. + % + % + + try + % + save(iirhp,iirv,iirpzm, 'test.xml'); + save(iirhp,iirv,iirpzm, 'test.mat'); + out1 = miir('test.xml'); + out2 = miir('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output MIIR object contains the correct data. + % + % + + atest = true; + iirin = [iirhp, reshape(iirv, 1, []), iirpzm]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 2+numel(iirv), atest = false; end + if numel(out2) ~= 2+numel(iirv), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(iirin(kk), out1(kk), ple1), atest = false; end + if ~eq(iirin(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the save method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the save method can be processed back + % to an m-file. Do this for both extensions 'mat' and 'xml' + % + % + + try + % + out1 = save(iirab, 'test.xml'); + out2 = save(iirpzm, 'test.mat'); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history applies to the output object. Check that + % save doesn't add a history step to the input object. + % 2) Check that the read object doesn't contain the save + load history steps. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % The last history step is the save method + if strcmp(out1.hist.methodInfo.mname, 'save'), atest = false; end + if strcmp(out2.hist.methodInfo.mname, 'save'), atest = false; end + % The histories must be the same + if ~eq(out1.hist, iirab.hist), atest = false; end + if ~eq(out2.hist, iirpzm.hist), atest = false; end + % check the history steps of the read object (load + save) + % The steps (save + load) shouldn't add history + outr1 = miir('test.xml'); + outr2 = miir('test.mat'); + if strcmp(outr1.hist, iirab.hist), atest = false; end + if strcmp(outr2.hist, iirpzm.hist), atest = false; end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + % delete test file + delete('test.xml') + delete('test.mat') + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the save method works with the modify command. + % + % + function result = utp_07 + + % + % + % Use the save method with the modifier command. + % + % + + try + % + % copy iirhp to work with + iir_mat = miir(iirhp); + iir_mat.save('test.mat'); + iir_xml = miir(iirhp); + iir_xml.save('test.xml'); + out1 = miir('test.mat'); + out2 = miir('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the save method doesn't apply the history. + % 2) Check the output against the input. + % + % + + atest = true; + if stest + % + % Check that the modified object doesn't have the 'save' method as + % the last history step + if strcmp(iir_xml.hist.methodInfo.mname, 'save'), atest = false; end + if strcmp(iir_mat.hist.methodInfo.mname, 'save'), atest = false; end + % Check the output + if ~eq(iir_mat, out1, ple1), atest = false; end + if ~eq(iir_xml, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the save method uses the filename which is stored in a plist. + % + % + + try + % + pl1 = plist('filename', 'test.mat'); + pl2 = plist('filename', 'test.xml'); + save(iirbp, pl1); + save(iirbp, pl2); + out1 = miir('test.mat'); + out2 = miir('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + % Check the output + if ~eq(iirbp, out1, ple1), atest = false; end + if ~eq(iirbp, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test the save method with standard MIIR objects. + % + % + function result = utp_09 + + % + % + % Save all standard MIIR objects with both extensions. + % + % + + try + % + save(iirhp, 'test_hp.mat'); % highpass + save(iirhp, 'test_hp.xml'); % highpass + save(iirlp, 'test_lp.mat'); % lowpass + save(iirlp, 'test_lp.xml'); % lowpass + save(iirbp, 'test_bp.mat'); % bandpass + save(iirbp, 'test_bp.xml'); % bandpass + save(iirbr, 'test_br.mat'); % bandreject + save(iirbr, 'test_br.xml'); % bandreject + out1 = miir('test_hp.mat'); + out2 = miir('test_hp.xml'); + out3 = miir('test_lp.mat'); + out4 = miir('test_lp.xml'); + out5 = miir('test_bp.mat'); + out6 = miir('test_bp.xml'); + out7 = miir('test_br.mat'); + out8 = miir('test_br.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + % Check highpass + if ~eq(iirhp, out1, ple1), atest = false; end + if ~eq(iirhp, out2, ple1), atest = false; end + if ~eq(iirlp, out3, ple1), atest = false; end + if ~eq(iirlp, out4, ple1), atest = false; end + if ~eq(iirbp, out5, ple1), atest = false; end + if ~eq(iirbp, out6, ple1), atest = false; end + if ~eq(iirbr, out7, ple1), atest = false; end + if ~eq(iirbr, out8, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + if ~eq(out3, out4, ple1), atest = false; end + if ~eq(out5, out6, ple1), atest = false; end + if ~eq(out7, out8, ple1), atest = false; end + % + delete('test_hp.mat'); + delete('test_hp.xml'); + delete('test_lp.mat'); + delete('test_lp.xml'); + delete('test_bp.mat'); + delete('test_bp.xml'); + delete('test_br.mat'); + delete('test_br.xml'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Test the save method with MIIR object which is created from a pole/zero model + % + % + function result = utp_10 + + % + % + % Save MIIR object which is created from a pzmodel. + % + % + + try + % + % Create a MIIR object from a pole/zero model + iir = miir(plist('pzmodel', pzmodel(1,{[1 4], 2}, 3), 'Nsecs', 10, 'fs', 37)); + save(iir, 'test.mat'); + save(iir, 'test.xml'); + out1 = miir('test.mat'); + out2 = miir('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + % Check the output + if ~eq(iir, out1, ple1), atest = false; end + if ~eq(iir, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_setHistin.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_setHistin.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,472 @@ +% UTP_MIIR_SETHISTIN a set of UTPs for the miir/setHistin method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_setHistin.m,v 1.6 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The setHistin method of the miir class sets the Histin property. +% +% + +function results = utp_miir_setHistin(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'setHistin'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MIIR objects + [iirhp,iirlp,iirbp,iirbr,iirpzm,iirab,iirv,iirm] = get_test_objects_miir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('histin'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('histin')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('histin'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setHistin method works with a vector of MIIR objects as input. + % + % + function result = utp_02 + + % + % + % The setHistin method is not designed for vectors, for that reason must + % this call fail. + % + % + + try + % + out = setHistin(iirv, [1 2 3]); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Nothing to check + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setHistin method works with a matrix of MIIR objects as input. + % + % + function result = utp_03 + + % + % + % The setHistin method is not designed for matrices, for that reason must + % this call fail. + % + % + + try + % + out = setHistin(iirm, [1 2 3]); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Nothing to check + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setHistin method works with a list of MIIR objects as input. + % + % + function result = utp_04 + + % + % + % The setHistin method is not designed for input lists, for that reason must + % this call fail. + % + % + + try + % + out = setHistin(iirhp,iirpzm,iirbp, [1 2 3]); + % + stest = false; + catch err + stest = true; + end + + % + % + % 1) Nothing to check + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setHistin method works with a mix of different shaped MIIR + % objects as input. + % + % + function result = utp_05 + + % + % + % The setHistin method is not designed for this call, for that reason must + % this call fail. + % + % + + try + % + out = setHistin(iirhp,iirv,iirpzm,iirm,iirbp, [1 2 3]); + % + stest = fail; + catch err + stest = true; + end + + % + % + % 1) Nothing to check + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setHistin method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setHistin method can be processed back + % to an m-file. + % + % + + try + % + out1 = setHistin(iirhp, [1 2 3]); + out2 = testCallerIsMethod(@setHistin, iirhp, [1 2 3]); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setHistin'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setHistin'. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setHistin') && ... + eq(out1.hist.plistUsed, plist('histin', [1 2 3]), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('histin', [1 2 3]), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'histin'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setHistin method can modify the input MIIR object. + % + % + function result = utp_07 + + % + % + % Test that the setHistin method can modify the input MIIR object + % by calling with no output. + % + % + + try + % + % copy iirhp to work with + ain = miir(iirhp); + % modify ain + aout = ain.setHistin([1 2 3]); + ain.setHistin([1 2 3]); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'iirhp' and 'ain' are now different. + % 2) Check that 'ain' has the correct histin field + % + % + + atest = true; + if stest + % + % Check that setHistin modified the input by comparing to the copy + if eq(miir(iirhp), ain, ple1), atest = false; end + % Check that setHistin doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~eq(ain.histin, [1 2 3]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setHistin method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setHistin method can modify the property 'histin' + % with a value in a plist. + % + % + + try + % + pl = plist('histin', [1 2 3]); + out = iirhp.setHistin(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct histin field + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'histin' + if ~eq(out.histin, [1 2 3]), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_setHistout.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_setHistout.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,477 @@ +% UTP_MIIR_SETHISTOUT a set of UTPs for the miir/setHistout method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_setHistout.m,v 1.8 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The setHistout method of the miir class sets the histout property. +% +% + +function results = utp_miir_setHistout(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'setHistout'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MIIR objects + [iirhp,iirlp,iirbp,iirbr,iirpzm,iirab,iirv,iirm] = get_test_objects_miir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('histout'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('histout')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('histout'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setHistout method works with a vector of MIIR objects as input. + % + % + function result = utp_02 + + % + % + % The setHistout should set the output history (histout) of each input. + % + % + + try + % + vals = [1 2 3]; + out = setHistout(iirv, vals); + % + stest = true; + catch err + stest = false; + end + + % + % + % 1) Check the histout has the correct values + % + % + + atest = true; + if stest + % + if ~isequal(out.histout, vals), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setHistout method works with a matrix of MIIR objects as input. + % + % + function result = utp_03 + + % + % + % The setHistout should set the output history (histout) of each input. + % + % + + try + % + vals = [1 2 3]; + out = setHistout(iirm, vals); + % + stest = true; + catch err + stest = false; + end + + % + % + % 1) Check the histout has the correct values + % + % + + atest = true; + if stest + % + if ~isequal(out.histout, vals), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setHistout method works with a list of MIIR objects as input. + % + % + function result = utp_04 + + % + % + % The setHistout should set the output history (histout) of each input. + % + % + + try + % + vals = [1 2 3]; + out = setHistout(iirhp,iirpzm,iirbp, vals); + % + stest = true; + catch err + stest = false; + end + + % + % + % 1) Check the histout has the correct values + % + % + + atest = true; + if stest + % + if ~isequal(out.histout, vals), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setHistout method works with a mix of different shaped MIIR + % objects as input. + % + % + function result = utp_05 + + % + % + % The setHistout method is not designed for this call, for that reason must + % this call fail. + % + % + + try + % + vals = [1 2 3]; + out = setHistout(iirhp,iirv,iirpzm,iirm,iirbp, vals); + % + stest = true; + catch err + stest = fail; + end + + % + % + % 1) Check the histout has the correct values + % + % + + atest = true; + if stest + % + if ~isequal(out.histout, vals), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setHistout method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setHistout method can be processed back + % to an m-file. + % + % + + try + % + out1 = setHistout(iirhp, [1 2 3]); + out2 = testCallerIsMethod(@setHistout, iirhp, [1 2 3]); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setHistout'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setHistout'. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setHistout') && ... + eq(out1.hist.plistUsed, plist('histout', [1 2 3]), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('histout', [1 2 3]), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'histout'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setHistout method can modify the input MIIR object. + % + % + function result = utp_07 + + % + % + % Test that the setHistout method can modify the input MIIR object + % by calling with no output. + % + % + + try + % + % copy iirhp to work with + ain = miir(iirhp); + % modify ain + aout = ain.setHistout([1 2 3]); + ain.setHistout([1 2 3]); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'iirhp' and 'ain' are now different. + % 2) Check that 'ain' has the correct histout field + % + % + + atest = true; + if stest + % + % Check that setHistout modified the input by comparing to the copy + if eq(miir(iirhp), ain, ple1), atest = false; end + % Check that setHistout doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~eq(ain.histout, [1 2 3]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setHistout method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setHistout method can modify the property 'histout' + % with a value in a plist. + % + % + + try + % + pl = plist('histout', [1 2 3]); + out = iirhp.setHistout(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct histout field + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'histout' + if ~eq(out.histout, [1 2 3]), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_setIunits.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_setIunits.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,561 @@ +% UTP_MIIR_SETIUNITS a set of UTPs for the miir/setIunits method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_setIunits.m,v 1.7 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The setIunits method of the miir class sets the iunits property. +% +% + +function results = utp_miir_setIunits(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'setIunits'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MIIR objects + [iirhp,iirlp,iirbp,iirbr,iirpzm,iirab,iirv,iirm] = get_test_objects_miir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('iunits'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('iunits')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('iunits'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setIunits method works with a vector of MIIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the setIunits method works for a vector of MIIR objects as input. + % + % + + try + % + out = setIunits(iirv, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'iirv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(iirv)), atest = false; end + % Check iunits field of each output + for kk=1:numel(out) + if ~eq(out(kk).iunits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setIunits method works with a matrix of MIIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the setIunits method works for a matrix of MIIR objects as input. + % + % + + try + % + out = setIunits(iirm, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'iirm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(iirm)), atest = false; end + % Check iunits field of each output + for kk=1:numel(out) + if ~eq(out(kk).iunits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setIunits method works with a list of MIIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the setIunits method works for a list of MIIR objects as input. + % + % + + try + % + out = setIunits(iirhp,iirpzm,iirbp, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~eq(out(1).iunits, unit('Hz')), atest = false; end + if ~eq(out(2).iunits, unit('Hz')), atest = false; end + if ~eq(out(3).iunits, unit('Hz')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setIunits method works with a mix of different shaped MIIR + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the setIunits method works with an input of matrices and vectors + % and single MIIR objects. + % + % + + try + % + out = setIunits(iirhp,iirv,iirpzm,iirm,iirbp, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(iirm)+numel(iirv)), atest = false; end + for kk=1:numel(out) + if ~eq(out(kk).iunits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setIunits method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setIunits method can be processed back + % to an m-file. + % + % + + try + % + out1 = setIunits(iirhp, unit('Hz')); + out2 = testCallerIsMethod(@setIunits, iirhp, unit('Hz')); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setIunits'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setIunits'. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setIunits') && ... + eq(out1.hist.plistUsed, plist('iunits', unit('Hz')), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('iunits', unit('Hz')), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'iunits'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setIunits method can modify the input MIIR object. + % + % + function result = utp_07 + + % + % + % Test that the setIunits method can modify the input MIIR object + % by calling with no output. + % + % + + try + % + % copy iirhp to work with + ain = miir(iirhp); + % modify ain + aout = ain.setIunits(unit('Hz')); + ain.setIunits(unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'iirhp' and 'ain' are now different. + % 2) Check that 'ain' has the correct iunits field + % + % + + atest = true; + if stest + % + % Check that setIunits modified the input by comparing to the copy + if eq(miir(iirhp), ain, ple1), atest = false; end + % Check that setIunits doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~eq(ain.iunits, unit('Hz')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setIunits method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setIunits method can modify the property 'iunits' + % with a value in a plist. + % + % + + try + % + pl = plist('iunits', unit('Hz')); + out = iirhp.setIunits(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct iunits field + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'iunits' + if ~eq(out.iunits, unit('Hz')), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setIunits method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setIunits(iirhp, iirlp, unit('mol')); + o3 = setIunits(iirhp, iirlp, unit('mol')); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_setName.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_setName.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,561 @@ +% UTP_MIIR_SETNAME a set of UTPs for the miir/setName method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_setName.m,v 1.7 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The setName method of the miir class sets the name property. +% +% + +function results = utp_miir_setName(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'setName'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MIIR objects + [iirhp,iirlp,iirbp,iirbr,iirpzm,iirab,iirv,iirm] = get_test_objects_miir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('name'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('name')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('name'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setName method works with a vector of MIIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the setName method works for a vector of MIIR objects as input. + % + % + + try + % + out = setName(iirv, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'iirv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(iirv)), atest = false; end + % Check name field of each output + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setName method works with a matrix of MIIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the setName method works for a matrix of MIIR objects as input. + % + % + + try + % + out = setName(iirm, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'iirm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(iirm)), atest = false; end + % Check name field of each output + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setName method works with a list of MIIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the setName method works for a list of MIIR objects as input. + % + % + + try + % + out = setName(iirhp,iirpzm,iirbp, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~strcmp(out(1).name, 'my name'), atest = false; end + if ~strcmp(out(2).name, 'my name'), atest = false; end + if ~strcmp(out(3).name, 'my name'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setName method works with a mix of different shaped MIIR + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the setName method works with an input of matrices and vectors + % and single MIIR objects. + % + % + + try + % + out = setName(iirhp,iirv,iirpzm,iirm,iirbp, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(iirm)+numel(iirv)), atest = false; end + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setName method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setName method can be processed back + % to an m-file. + % + % + + try + % + out1 = setName(iirhp, 'my name'); + out2 = testCallerIsMethod(@setName, iirhp, 'my name'); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setName'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setName'. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setName') && ... + eq(out1.hist.plistUsed, plist('name', 'my name'), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('name', 'my name'), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'name'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setName method can modify the input MIIR object. + % + % + function result = utp_07 + + % + % + % Test that the setName method can modify the input MIIR object + % by calling with no output. + % + % + + try + % + % copy iirhp to work with + ain = miir(iirhp); + % modify ain + aout = ain.setName('my name'); + ain.setName('my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'iirhp' and 'ain' are now different. + % 2) Check that 'ain' has the correct name field + % + % + + atest = true; + if stest + % + % Check that setName modified the input by comparing to the copy + if eq(miir(iirhp), ain, ple1), atest = false; end + % Check that setName doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~strcmp(ain.name, 'my name'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setName method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setName method can modify the property 'name' + % with a value in a plist. + % + % + + try + % + pl = plist('name', 'my name'); + out = iirhp.setName(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct name field + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'name' + if ~strcmp(out.name, 'my name'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setName method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setName(iirhp, iirlp, 'new name'); + o3 = setName(iirhp, iirlp, 'new name'); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_setOunits.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_setOunits.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,561 @@ +% UTP_MIIR_SETOUNITS a set of UTPs for the miir/setOunits method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_setOunits.m,v 1.7 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The setOunits method of the miir class sets the ounits property. +% +% + +function results = utp_miir_setOunits(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'setOunits'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MIIR objects + [iirhp,iirlp,iirbp,iirbr,iirpzm,iirab,iirv,iirm] = get_test_objects_miir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('ounits'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('ounits')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('ounits'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setOunits method works with a vector of MIIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the setOunits method works for a vector of MIIR objects as input. + % + % + + try + % + out = setOunits(iirv, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'iirv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(iirv)), atest = false; end + % Check ounits field of each output + for kk=1:numel(out) + if ~eq(out(kk).ounits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setOunits method works with a matrix of MIIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the setOunits method works for a matrix of MIIR objects as input. + % + % + + try + % + out = setOunits(iirm, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'iirm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(iirm)), atest = false; end + % Check ounits field of each output + for kk=1:numel(out) + if ~eq(out(kk).ounits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setOunits method works with a list of MIIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the setOunits method works for a list of MIIR objects as input. + % + % + + try + % + out = setOunits(iirhp,iirpzm,iirbp, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~eq(out(1).ounits, unit('Hz')), atest = false; end + if ~eq(out(2).ounits, unit('Hz')), atest = false; end + if ~eq(out(3).ounits, unit('Hz')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setOunits method works with a mix of different shaped MIIR + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the setOunits method works with an input of matrices and vectors + % and single MIIR objects. + % + % + + try + % + out = setOunits(iirhp,iirv,iirpzm,iirm,iirbp, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(iirm)+numel(iirv)), atest = false; end + for kk=1:numel(out) + if ~eq(out(kk).ounits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setOunits method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setOunits method can be processed back + % to an m-file. + % + % + + try + % + out1 = setOunits(iirhp, unit('Hz')); + out2 = testCallerIsMethod(@setOunits,iirhp, unit('Hz')); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setOunits'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setOunits'. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setOunits') && ... + eq(out1.hist.plistUsed, plist('ounits', unit('Hz')), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('ounits', unit('Hz')), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'ounits'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setOunits method can modify the input MIIR object. + % + % + function result = utp_07 + + % + % + % Test that the setOunits method can modify the input MIIR object + % by calling with no output. + % + % + + try + % + % copy iirhp to work with + ain = miir(iirhp); + % modify ain + aout = ain.setOunits(unit('Hz')); + ain.setOunits(unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'iirhp' and 'ain' are now different. + % 2) Check that 'ain' has the correct ounits field + % + % + + atest = true; + if stest + % + % Check that setOunits modified the input by comparing to the copy + if eq(miir(iirhp), ain, ple1), atest = false; end + % Check that setOunits doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~eq(ain.ounits, unit('Hz')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setOunits method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setOunits method can modify the property 'ounits' + % with a value in a plist. + % + % + + try + % + pl = plist('ounits', unit('Hz')); + out = iirhp.setOunits(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct ounits field + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'ounits' + if ~eq(out.ounits, unit('Hz')), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setOunits method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setOunits(iirhp, iirlp, unit('mol')); + o3 = setOunits(iirhp, iirlp, unit('mol')); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_string.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_string.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,428 @@ +% UTP_MIIR_STRING a set of UTPs for the miir/string method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_string.m,v 1.2 2009/07/23 14:12:02 ingo Exp $ +% + +% +% +% The string method of the miir class writes a command string that can be +% used to recreate the input object(s). But the object should not have more than +% one history step. +% +% + +function results = utp_miir_string(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'string'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + iir1 = miir(plist('type', 'lowpass')); + iir2 = miir(plist('type', 'highpass')); + iirv = [iir1, iir2, iir1]; + iirm = [iir1, iir2, iir1; iir1, iir2, iir1]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Negative test: The object have more than one history step. + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the string method works with a vector of MIIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the string method works for a vector of MIIR objects as input. + % + % + + try + % + out = string(iirv); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end; + if ~isa(rout, 'miir'), atest = false; end + if numel(rout) ~= numel(iirv), atest = false; end + for kk = 1:numel(iirv) + if eq(rout(kk), iirv(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the string method works with a matrix of MIIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the string method works for a matrix of MIIR objects as input. + % + % + + try + % + out = string(iirm); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'miir'), atest = false; end + if numel(rout) ~= numel(iirm), atest = false; end + for kk = 1:numel(iirm) + if eq(rout(kk), iirm(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the string method works with a list of MIIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the string method works for a list of MIIR objects as input. + % + % + + try + % + out = string(iir1,iir2); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + iirin = [iir1, iir2]; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'miir'), atest = false; end + if numel(rout) ~= numel(iirin), atest = false; end + for kk = 1:numel(iirin) + if eq(rout(kk), iirin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the string method works with a mix of different shaped MIIR objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the string method works with an input of matrices and vectors + % and single MIIR objects. + % + % + + try + % + out = string(iir1,iirm,iir2); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + iirin = [iir1, reshape(iirm, 1, []), iir2]; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'miir'), atest = false; end + if numel(rout) ~= numel(iirin), atest = false; end + for kk = 1:numel(iirin) + if eq(rout(kk), iirin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the string method properly applies history. + % + % + function result = utp_06 + + % + % + % The method string doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the string method doesn't work if the MIIR object have more + % than one history step. + % + % + function result = utp_07 + + % + % + % The method string throws an error because the input object have more than + % one history step. + % + % + + try + % + iir3 = miir(plist('type', 'bandpass')); + iir3.setName('Second history step'); + out = iir3.string(); + % + stest = false; + catch err + stest = true; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_submit.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_submit.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,529 @@ +% UTP_MIIR_SUBMIT a set of UTPs for the miir/submit method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_submit.m,v 1.14 2010/08/18 09:25:55 ingo Exp $ +% + +% +% +% The bsubmit method of the miir class submits a collection of objects +% in XML form to an LTPDA Repository. The type of the objects are +% independent. +% +% + +function results = utp_miir_submit(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'submit'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + [iir1,iir2,iir3,iir4,iir5,iir6,iirv,iirm] = get_test_objects_miir; + plForAutoTest = plist('no dialog', true, 'use selector', false); + + conn = utpGetConnection(); + try + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_miir_submit: submit miir'; + sinfo.experiment_description = 'utp_miir_submit: description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test output of the data + catch + end + + % Close connection + utpCloseConnection(conn); + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 16, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('sinfo filename'), atest = false; end + if ~io(3).plists.isparam('binary'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isEmptyChar(io(3).plists.find('sinfo filename')), atest = false; end + if ~isequal(io(3).plists.find('binary'), false), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the submit method works with a vector of MIIR objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the submit method works for a vector of MIIR objects as + % input. + % + % + + try + % + [ids, cids] = submit(iirv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + robjs3 = ltpda_uo.retrieve(conn, ids(1), ids(2), ids(3), ids(4)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(iirv), atest = false; end + if numel(robjs2) ~= numel(iirv), atest = false; end + if numel(robjs3) ~= numel(iirv), atest = false; end + % Check the retrieved object against the submitted + if ~eq(iirv, [robjs1{:}]), atest = false; end + if ~eq(iirv, [robjs2{:}]), atest = false; end + if ~eq(iirv, [robjs3{:}]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the submit method works with a matrix of MIIR objects as + % input. + % + % + function result = utp_03 + + % + % + % Tests that the submit method works with a matrix of MIIR objects + % as input. + % + % + + try + % + [ids, cids] = submit(iirm, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + robjs3 = ltpda_uo.retrieve(conn, ids(1), ids(2), ids(3), ids(4), ids(5), ids(6)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(iirm), atest = false; end + if numel(robjs2) ~= numel(iirm), atest = false; end + if numel(robjs3) ~= numel(iirm), atest = false; end + % Check the retrieved object against the submitted + if ~eq(iirm, reshape([robjs1{:}], size(iirm))), atest = false; end + if ~eq(iirm, reshape([robjs2{:}], size(iirm))), atest = false; end + if ~eq(iirm, reshape([robjs3{:}], size(iirm))), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the submit method works with a list of MIIR objects as + % input. + % + % + function result = utp_04 + + % + % + % Tests that the submit method works with a list of MIIR objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = submit(iir1, pl, iir, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + robjs3 = ltpda_uo.retrieve(conn, ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 3, atest = false; end + if numel(robjs2) ~= 3, atest = false; end + if numel(robjs3) ~= 3, atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, iir1), atest = false; end + if ~eq(robjs1{2}, iir), atest = false; end + if ~eq(robjs1{3}, pl), atest = false; end + % Check robjs2 + if ~eq(robjs2{1}, iir1), atest = false; end + if ~eq(robjs2{2}, iir), atest = false; end + if ~eq(robjs2{3}, pl), atest = false; end + % Check robjs3 + if ~eq(robjs3{1}, iir1), atest = false; end + if ~eq(robjs3{2}, iir), atest = false; end + if ~eq(robjs3{3}, pl), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the abs method works with a mix of different shaped MIIR + % objects as input. + % + % + function result = utp_05 + + % + % + % Tests that the submit method works with a list of MIIR objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = submit(pl, iirm, iir, iirv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 2 + numel(iirm) + numel(iirv), atest = false; end + if numel(robjs2) ~= 2 + numel(iirm) + numel(iirv), atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, iirm(1)), atest = false; end + if ~eq(robjs1{2}, iirm(2)), atest = false; end + if ~eq(robjs1{3}, iirm(3)), atest = false; end + if ~eq(robjs1{4}, iirm(4)), atest = false; end + if ~eq(robjs1{5}, iirm(5)), atest = false; end + if ~eq(robjs1{6}, iirm(6)), atest = false; end + if ~eq(robjs1{7}, iir), atest = false; end + if ~eq(robjs1{8}, iirv(1)), atest = false; end + if ~eq(robjs1{9}, iirv(2)), atest = false; end + if ~eq(robjs1{10}, iirv(3)), atest = false; end + if ~eq(robjs1{11}, iirv(4)), atest = false; end + if ~eq(robjs1{12}, pl), atest = false; end + % Check robjs2 + if ~isequalwithequalnans(robjs1, robjs2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tthe submit method properly applies history. + % + % + function result = utp_06 + + % + % + % Tthe submit method properly applies history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the submit method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [ids, cids] = submit(iir1, iir2, sinfo, plForAutoTest); + + [o1, o2] = ltpda_uo.retrieve(conn, 'Collection', cids); + o3 = ltpda_uo.retrieve(conn, 'Collection', cids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the output + if ~eq(o1, iir1), atest = false; end + if ~eq(o2, iir2), atest = false; end + if ~eq(o3{1}, iir1), atest = false; end + if ~eq(o3{2}, iir2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_type.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_type.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,395 @@ +% UTP_MIIR_TYPE a set of UTPs for the miir/type method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_type.m,v 1.2 2009/07/23 14:12:02 ingo Exp $ +% + +% +% +% The type method of the miir class converts the input objects to +% MATLAB functions that reproduce the processing steps that led to the +% input objects. +% +% + +function results = utp_miir_type(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'type'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test MIIR objects + [iir1,iir2,iir3,iir4,iir5,iir6,iirv,iirm] = get_test_objects_miir; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % DEfine the filename + filename = 'test_miir_type.m'; + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('filename'), atest = false; end + if ~io(3).plists.isparam('stop_option'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('filename')), atest = false; end + if ~isequal(io(3).plists.find('stop_option'), 'full'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('filename'), {''}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('stop_option'), {'full', 'File', 'Repo', 'File Repo', 'N'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the type method works with a vector of MIIR objects as input. + % + % + function result = utp_02 + + % + % + % Test that the type method works for a vector of MIIR objects as input. + % + % + + try + % + type(iirv, filename); + type(iirv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + if ~eq(iirv, mout, ple2), atest = false; end; + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the type method works with a matrix of MIIR objects as input. + % + % + function result = utp_03 + + % + % + % Test that the type method works for a matrix of MIIR objects as input. + % + % + + try + % + type(iirm, filename); + type(iirm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + % Type doesn't keep the shape + for ii = 1:numel(iirm) + if ~eq(iirm(ii), mout(ii), ple2), atest = false; end; + end + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the type method works with a list of MIIR objects as input. + % + % + function result = utp_04 + + % + % + % Test that the type method works for a list of MIIR objects as input. + % + % + + try + % + type(iir5,iir4,iir3, filename); + type(iir5,iir4,iir3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + iirin = [iir5,iir4,iir3]; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + % Type doesn't keep the shape + for ii = 1:numel(iirin) + if ~eq(iirin(ii), mout(ii), ple2), atest = false; end; + end + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the type method works with a mix of different shaped MIIR objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the type method works with an input of matrices and vectors + % and single MIIR objects. + % + % + + try + % + type(iir4,iirv,iir2,iirm,iir1, filename); + type(iir4,iirv,iir2,iirm,iir1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + iirin = [iir4,reshape(iirv,1,[]),iir2,reshape(iirm,1,[]),iir1]; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + % Type doesn't keep the shape + for ii = 1:numel(iirin) + if ~eq(iirin(ii), mout(ii), ple2), atest = false; end; + end + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the type method properly applies history. + % + % + function result = utp_06 + + % + % + % The method type doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/miir/utp_miir_update.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/miir/utp_miir_update.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,390 @@ +% UTP_MIIR_UPDATE a set of UTPs for the miir/update method +% +% M Hewitson 06-08-08 +% +% $Id: utp_miir_update.m,v 1.14 2010/08/18 09:25:55 ingo Exp $ +% + +% +% +% The update method of the miir class updates (replace) an LTPDA object +% in the repository with the given replacement object. It is only possible +% to update one object. This is the reason why the general UTPs are not +% possible. +% +% + +function results = utp_miir_update(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'miir'; + mthd = 'update'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + pzm = pzmodel(1, [pz(1) pz(200)], pz(50)); + pzm.setName(); + pl = plist('pzmodel', pzm, 'fs', 1000); + obj = miir(pl); + obj.setName(); + + plForAutoTest = plist('no dialog', true, 'use selector', false); + conn = utpGetConnection(); + try + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_miir_update: update miir'; + sinfo.experiment_description = 'utp_miir_update: description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + [ids, cids] = submit(obj, sinfo, plForAutoTest); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Test with conn + results = [results utp_03]; % Test with sinfo + results = [results utp_04]; % Test update of an binary file + results = [results utp_05]; % Test replace with other object + catch + end + + % Close connection + utpCloseConnection(conn); + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 15, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('binary'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isequal(io(3).plists.find('binary'), false), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_02 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Use a database object (conn) to establish the connection. + % + % + + try + % + % Make some changes to the object. + uobj = obj.setName('I was updated (conn)'); + update(uobj, ids, conn, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_03 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Use a database info structure (sinfo) to establish the connection. + % + % + + try + % + % Make some changes to the object. + uobj = obj.setName('I was updated (sinfo)'); + update(uobj, ids, sinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_04 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Check that the update method also updates objects which are stored as + % a binary file. + % + % + + try + % + % Submit the object as a binary + [ids_bin, cids] = bsubmit(obj, sinfo, plForAutoTest); + % Make some changes to the object. + uobj = obj.setName('I was updated (sinfo)'); + update(uobj, ids_bin, sinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids_bin' + robj = ltpda_uo.retrieve(conn, ids_bin); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the update method replaces the object in the repository with + % a completely other object. + % + % + function result = utp_05 + + % + % + % Tests that the update method replaces the object in the repository + % with a completely other object. + % Replace the miir object with a mfir filter object. + % + % + + try + % + % Make some changes to the object. + uobj = mfir(plist('type', 'lowpass')); + update(uobj, ids, sinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_bsubmit.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_bsubmit.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,526 @@ +% UTP_PARFRAC_BSUBMIT a set of UTPs for the parfrac/bsubmit method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_bsubmit.m,v 1.13 2010/08/18 09:25:55 ingo Exp $ +% + +% +% +% The bsubmit method of the parfrac class submits a collection of objects +% in binary form to an LTPDA Repository. The type of the objects are +% independent. +% +% + +function results = utp_parfrac_bsubmit(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'bsubmit'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + [pf1,pf2,pf3,pfv,pfm] = get_test_objects_parfrac; + plForAutoTest = plist('no dialog', true, 'use selector', false); + + try + conn = utpGetConnection(); + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_parfrac_bsubmit: submit parfrac'; + sinfo.experiment_description = 'utp_parfrac_bsubmit: description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test output of the data + catch + end + + % Close connection + utpCloseConnection(conn) + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 15, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('sinfo filename'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isEmptyChar(io(3).plists.find('sinfo filename')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the bsubmit method works with a vector of PARFRAC objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the bsubmit method works for a vector of PARFRAC objects as + % input. + % + % + + try + % + [ids, cids] = bsubmit(pfv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(pfv), atest = false; end + if numel(robjs2) ~= numel(pfv), atest = false; end + if numel(robjs3) ~= numel(pfv), atest = false; end + % Check the retrieved object against the submitted + if ~eq(pfv, [robjs1{:}]), atest = false; end + if ~eq(pfv, [robjs2{:}]), atest = false; end + if ~eq(pfv, [robjs3{:}]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the bsubmit method works with a matrix of PARFRAC objects as + % input. + % + % + function result = utp_03 + + % + % + % Tests that the bsubmit method works with a matrix of PARFRAC objects + % as input. + % + % + + try + % + [ids, cids] = bsubmit(pfm, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3), ids(4), ids(5), ids(6)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(pfm), atest = false; end + if numel(robjs2) ~= numel(pfm), atest = false; end + if numel(robjs3) ~= numel(pfm), atest = false; end + % Check the retrieved object against the submitted + if ~eq(pfm, reshape([robjs1{:}], size(pfm))), atest = false; end + if ~eq(pfm, reshape([robjs2{:}], size(pfm))), atest = false; end + if ~eq(pfm, reshape([robjs3{:}], size(pfm))), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the bsubmit method works with a list of PARFRAC objects as + % input. + % + % + function result = utp_04 + + % + % + % Tests that the bsubmit method works with a list of PARFRAC objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = bsubmit(pf1, pl, iir, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 3, atest = false; end + if numel(robjs2) ~= 3, atest = false; end + if numel(robjs3) ~= 3, atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, pf1), atest = false; end + if ~eq(robjs1{3}, pl), atest = false; end + if ~eq(robjs1{2}, iir), atest = false; end + % Check robjs2 + if ~eq(robjs2{1}, pf1), atest = false; end + if ~eq(robjs2{3}, pl), atest = false; end + if ~eq(robjs2{2}, iir), atest = false; end + % Check robjs3 + if ~eq(robjs3{1}, pf1), atest = false; end + if ~eq(robjs3{3}, pl), atest = false; end + if ~eq(robjs3{2}, iir), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the abs method works with a mix of different shaped PARFRAC + % objects as input. + % + % + function result = utp_05 + + % + % + % Tests that the bsubmit method works with a list of PARFRAC objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = bsubmit(pl, pfm, iir, pfv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 2 + numel(pfm) + numel(pfv), atest = false; end + if numel(robjs2) ~= 2 + numel(pfm) + numel(pfv), atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, pfm(1)), atest = false; end + if ~eq(robjs1{2}, pfm(2)), atest = false; end + if ~eq(robjs1{3}, pfm(3)), atest = false; end + if ~eq(robjs1{4}, pfm(4)), atest = false; end + if ~eq(robjs1{5}, pfm(5)), atest = false; end + if ~eq(robjs1{6}, pfm(6)), atest = false; end + if ~eq(robjs1{7}, iir), atest = false; end + if ~eq(robjs1{8}, pfv(1)), atest = false; end + if ~eq(robjs1{9}, pfv(2)), atest = false; end + if ~eq(robjs1{10}, pfv(3)), atest = false; end + if ~eq(robjs1{11}, pl), atest = false; end + % Check robjs2 + if ~isequalwithequalnans(robjs1, robjs2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tthe bsubmit method properly applies history. + % + % + function result = utp_06 + + % + % + % Tthe bsubmit method properly applies history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the bsubmit method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [ids, cids] = bsubmit(pf1, pf2, sinfo, plForAutoTest); + + [o1, o2] = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + o3 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the output + if ~eq(o1, pf1), atest = false; end + if ~eq(o2, pf2), atest = false; end + if ~eq(o3{1}, pf1), atest = false; end + if ~eq(o3{2}, pf2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_char.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_char.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,357 @@ +% UTP_PARFRAC_CHAR a set of UTPs for the parfrac/char method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_char.m,v 1.3 2009/07/23 16:45:23 ingo Exp $ +% + +% +% +% The char method of the parfrac class converts the objects into one +% character string which contains information of the object. +% +% + +function results = utp_parfrac_char(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'char'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PARFRAC objects + [pf1,pf2,pf3,pfv,pfm] = get_test_objects_parfrac; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the char method works with a vector of PARFRAC objects as input. + % + % + function result = utp_02 + + % + % + % Test that the char method works for a vector of PARFRAC objects as input. + % + % + + try + % + out = char(pfv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end; + for kk = 1:numel(pfv) + if isempty(strfind(out, pfv(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the char method works with a matrix of PARFRAC objects as input. + % + % + function result = utp_03 + + % + % + % Test that the char method works for a matrix of PARFRAC objects as input. + % + % + + try + % + out = char(pfm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(pfm) + if isempty(strfind(out, pfm(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the char method works with a list of PARFRAC objects as input. + % + % + function result = utp_04 + + % + % + % Test that the char method works for a list of PARFRAC objects as input. + % + % + + try + % + out = char(pf1, pf2, pf3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + pain = [pf1, pf2, pf3]; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(pain) + if isempty(strfind(out, pain(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the char method works with a mix of different shaped PARFRAC objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the char method works with an input of matrices and vectors + % and single PARFRAC objects. + % + % + + try + % + out = char(pf1,pfv,pf2,pfm,pf3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + pain = [pf1,reshape(pfv,1,[]),pf2,reshape(pfm,1,[]),pf3]; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(pain) + if isempty(strfind(out, pain(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the char method properly applies history. + % + % + function result = utp_06 + + % + % + % The method char doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_copy.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_copy.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,52 @@ +% UTP_PARFRAC_COPY a set of UTPs for the parfrac/copy method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_copy.m,v 1.2 2009/08/08 12:21:40 hewitson Exp $ +% + +% +% +% The copy method of the parfrac class copies the input object depending of the +% second input. +% +% + +function results = utp_parfrac_copy(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'copy'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_69(class, 1, 1, ple2)]; + results = [results utp_69(class, 1, 3, ple2)]; + results = [results utp_69(class, 2, 3, ple2)]; + + 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 + + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_created.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_created.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,485 @@ +% UTP_PARFRAC_CREATED a set of UTPs for the parfrac/created method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_created.m,v 1.2 2009/07/23 16:45:23 ingo Exp $ +% + +% +% +% The created method of the parfrac returns a time object of the last +% modification. For this uses the created method the 'proctime' property of +% the last history step and computs from this value a timeobject. +% +% + +function results = utp_parfrac_created(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'created'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PARFRAC objects + [pf1,pf2,pf3,pfv,pfm] = get_test_objects_parfrac; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test empty object + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the created method works with a vector of PARFRAC objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the created method works for a vector of PARFRAC objects as + % input. + % + % + + try + % + out = created(pfv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pfv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if ~isequal(size(out), size(pfv)), atest = false; end + % Check the time-object + for kk=1:numel(out) + if out(kk).utc_epoch_milli ~= pfv(kk).hist.proctime, atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the created method works with a matrix of PARFRAC objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the created method works for a matrix of PARFRAC objects as + % input. + % + % + + try + % + out = created(pfm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pfm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if ~isequal(size(out), size(pfm)), atest = false; end + % Check time-object + for kk=1:numel(out) + if out(kk).utc_epoch_milli ~= pfm(kk).hist.proctime, atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the created method works with a list of PARFRAC objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the created method works for a list of PARFRAC objects as + % input. + % + % + + try + % + out = created(pf1,pf2,pf3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if out(1).utc_epoch_milli ~= pf1.hist.proctime, atest = false; end + if out(2).utc_epoch_milli ~= pf2.hist.proctime, atest = false; end + if out(3).utc_epoch_milli ~= pf3.hist.proctime, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the created method works with a mix of different shaped + % PARFRAC objects as input. + % + % + function result = utp_05 + + % + % + % Test that the created method works with an input of matrices and + % vectors and single PARFRAC objects. + % + % + + try + % + out = created(pf1,pfv,pf2,pfm,pf3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + pfin = [pf1,reshape(pfv,1,[]),pf2,reshape(pfm,1,[]),pf3]; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(pfm)+numel(pfv)), atest = false; end + for kk=1:numel(out) + if out(kk).utc_epoch_milli ~= pfin(kk).hist.proctime, atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the created method properly applies history + % + % + function result = utp_06 + + % + % + % This method doesn't change the input object, thus no history is added + % to the object. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the created method can be used with the modify command. + % + % + function result = utp_07 + + % + % + % Tests that the created method can be used with the modify command. + % + % + + try + % + out1 = pf3.created; + out2 = pfm.created; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the single object + % 2) Check the matrix object + % + % + + atest = true; + if stest + % + % Check the single object + if out1.utc_epoch_milli ~= pf3.hist.proctime, atest = false; end + % Check the matrix + for kk = 1:numel(out2) + if out2(kk).utc_epoch_milli ~= pfm(kk).hist.proctime, atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the created method retruns always a well defined time object + % even for an empty input object. + % + % + function result = utp_08 + + % + % + % Test that the created method with an empty 'PARFRAC object + % + % + + try + % + pf = parfrac(); + out = pf.created; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a time object with a ell defined time. + % + % + + atest = true; + if stest + % + if ~isa(out, 'time'), atest = false; end + if isnan(out.utc_epoch_milli), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_creator.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_creator.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,520 @@ +% UTP_PARFRAC_CREATED a set of UTPs for the parfrac/creator method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_creator.m,v 1.2 2009/07/23 16:45:23 ingo Exp $ +% + +% +% +% The creator method of the parfrac extract the creator(s)/modifier from +% the history. Depending to the input parameter returns this method all +% creator/modifier or only the last creator/modifier. +% +% + +function results = utp_parfrac_creator(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'creator'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PARFRAC objects + [pf1,pf2,pf3,pfv,pfm] = get_test_objects_parfrac; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with different creator/modifier + results = [results utp_09]; % Test negative case for the option 'all' + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('option'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('option')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('option'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the creator method works with a vector of PARFRAC objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the creator method works for a vector of PARFRAC objects as + % input. + % + % + + try + % + out = creator(pfv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pfv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(pfv), atest = false; end + % Check the creator + curr_creator = provenance(); + for kk=1:numel(out) + if ~strcmp(out{kk}, curr_creator.creator), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the creator method works with a matrix of PARFRAC objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the creator method works for a matrix of PARFRAC objects as + % input. + % + % + + try + % + out = creator(pfm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pfm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(pfm), atest = false; end + % Check creator + curr_creator = provenance(); + for kk=1:numel(out) + if ~strcmp(out{kk}, curr_creator.creator), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the creator method works with a list of PARFRAC objects as + % input. + % + % + function result = utp_04 + + % + % + % The creator method doesn't work for a list of PARFRAC objects as input. + % + % + + % + try + creator(pf1,pf2,pf3); + stest = false; + catch + stest = true; + end + % + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the creator method works with a mix of different shaped + % PARFRAC objects as input. + % + % + function result = utp_05 + + % + % + % The creator method doesn't work with different shaped input objects. + % + % + + % + try + creator(pf1,pfv,pf2,pfm,pf3); + stest = false; + catch + stest = true; + end + % + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the creator method properly applies history + % + % + function result = utp_06 + + % + % + % This method doesn't change the input object, thus no history is added + % to the object. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the creator method can be used with the modify command. + % + % + function result = utp_07 + + % + % + % Tests that the creator method can be used with the modify command. + % + % + + try + % + out1 = pf3.creator; + out2 = pfm.creator; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the single object + % 2) Check the matrix object + % + % + + atest = true; + if stest + % + curr_creator = provenance(); + % Check the single object + if ~strcmp(out1, curr_creator.creator), atest = false; end + % For a single object must be the the output a char string + if ~ischar(out1), atest = false; end + % Check the matrix + for kk = 1:numel(out2) + if ~strcmp(out2{kk}, curr_creator.creator), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the creator method retruns all creator(s)/modifier(s) which + % are in the history. + % + % + function result = utp_08 + + % + % + % Test that the creator method uses the option 'all' direct or in a + % plist. The test file must have the modifier 'first', 'second' and + % 'third' + % + % + + try + % + % Read object with different modifier + pf = parfrac('test_parfrac_diff_creator.xml'); + out1 = pf.creator; + out2 = pf.creator('all'); + out3 = pf.creator(plist('option', 'all')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that out1 contains only one creator + % 2) Check that out2 contain more creator/modifier + % + % + + atest = true; + if stest + % + if ~ischar(out1), atest = false; end + if ~strmatch('fist', out2), atest = false; end + if ~strmatch('second', out2), atest = false; end + if ~strmatch('third', out2), atest = false; end + if ~strmatch('fist', out3), atest = false; end + if ~strmatch('second', out3), atest = false; end + if ~strmatch('third', out3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Tests the negative case for the option 'all'. + % + % + function result = utp_09 + + % + % + % Test that the creator method throws an error if the option 'all' is + % used in connection with a matrix/vector of PARFRAC objects. + % + % + + try + % + pfm.creator('all'); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_display.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_display.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,367 @@ +% UTP_PARFRAC_DISPLAY a set of UTPs for the parfrac/display method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_display.m,v 1.2 2009/07/23 16:45:23 ingo Exp $ +% + +% +% +% The display method of the parfrac class prints defined values of an +% PARFRAC object. MATLAB calls display when it interprets an object that is +% not terminated by a semicolon. +% +% + +function results = utp_parfrac_display(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'display'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PARFRAC objects + [pf1,pf2,pf3,pfv,pfm] = get_test_objects_parfrac; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the display method works with a vector of PARFRAC objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the display method works for a vector of PARFRAC objects as + % input. + % + % + + try + % + pfv + out = display(pfv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + % Check the output + if ~iscell(out), atest = false; end; + for kk = 1:numel(pfv) + if isempty(strfind(out, pfv(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the display method works with a matrix of PARFRAC objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the display method works for a matrix of PARFRAC objects as + % input. + % + % + + try + % + pfm + out = display(pfm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(pfm) + if isempty(strfind(out, pfm(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the display method works with a list of PARFRAC objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the display method works for a list of PARFRAC objects as + % input. + % + % + + try + % + pf1,pf2,pf3 + out = display(pf1,pf2,pf3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + pain = [pf1,pf2,pf3]; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(pain) + if isempty(strfind(out, pain(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the display method works with a mix of different shaped + % PARFRAC objects as input. + % + % + function result = utp_05 + + % + % + % Test that the display method works with an input of matrices and + % vectors and single PARFRAC objects as. + % + % + + try + % + out = display(pf1,pfv,pf2,pfm,pf3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + pain = [pf1,reshape(pfv,1,[]),pf2,reshape(pfm,1,[]),pf3]; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(pain) + if isempty(strfind(out, pain(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the display method properly applies history. + % + % + function result = utp_06 + + % + % + % The method display doesn't change the data, thus it is not possible + % to check the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_eq.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_eq.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,583 @@ +% UTP_PARFRAC_EQ a set of UTPs for the parfrac/eq method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_eq.m,v 1.7 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The eq() method of the parfrac class pf1 == pf2 compares each element of +% a parfrac object with the corresponding element of an second parfrac +% object and returns a logical 1 (true) where pf1 and pf2 are equal, or +% logical 0 (false) where they are not equal. +% +% + +function results = utp_parfrac_eq(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'eq'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PARFRAC objects + [pf1,pf2,pf3,pfv,pfm] = get_test_objects_parfrac; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test with the exception list 'name' + results = [results utp_08]; % Test with the exception list 'iunits' + results = [results utp_09]; % Test with the exception list 'ounits' + results = [results utp_10]; % Test exception list in a plist + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check number of SETS + if numel(io(2).sets) ~= 1, atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + % SET 'Default' + % Check key + if ~io(3).plists.isparam('Exceptions'), atest = false; end + if ~io(3).plists.isparam('Tol'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('Exceptions'), {}), atest = false; end + if ~isequal(io(3).plists.find('Tol'), eps(1)), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('Exceptions'), {{}}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('Tol'), {eps(1)}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the eq method works with a vector of PARFRAC objects as input. + % + % + function result = utp_02 + + % + % + % Test that the eq method works for a vector of PARFRAC objects as input. + % Test the positive and the negative case. + % + % + + try + % + pa = pf3.setName('my name'); + pfv1 = [pf1, pf2, pf3]; + pfv2 = [pf1, pf2, pa]; + out1 = eq(pfv1, pfv1); + out2 = eq(pfv1, pfv2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the eq function. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the eq method works with a matrix of PARFRAC objects as input. + % + % + function result = utp_03 + + % + % + % Test that the eq method works for a matrix of PARFRAC objects as input. + % Test the positive and the negative case. + % + % + + try + % + pa = pf3.setName('my name'); + pfm1 = [pf1, pf2, pf3, pf1, pf2, pf3]; + pfm2 = [pf3, pf2, pa; pf1, pf2, pf3]; + out1 = eq(pfm1, pfm1); + out2 = eq(pfm1, pfm2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the eq function. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the eq method works with a list of PARFRAC objects as input. + % + % + function result = utp_04 + + % + % + % The eq method doesn't works for a list of PARFRAC objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the eq method works with a mix of different shaped PARFRAC objects + % as input. + % + % + function result = utp_05 + + % + % + % The eq method doesn't works for a list of PARFRAC objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the eq method properly applies history. + % + % + function result = utp_06 + + % + % + % The eq method doesn't change the PARFRAC object, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception + % list with properties where a public set method exist. + % + % + function result = utp_07 + + % + % + % Test the eq method with the exception 'name'. Use the option + % 'internal' to suppress the history. It is necessary to add 'created' + % to the exception list because 'pa' is created at an other time. + % + % + + try + % + pa = testCallerIsMethod(@setName, pf3, 'my name'); + out1 = eq(pa, pf3); + out2 = eqLocal(pa, pf3, 'name'); + out3 = eqLocal(pa, pf3, 'parfrac/name'); + out4 = eq(pa.hist, pf3.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_08 + + % + % + % Test the eq method with the exception 'iunits'. Use the option 'internal' + % to suppress the history. It is necessary to add 'created' to the exception + % list because 'pa' is created at an other time. + % + % + + try + % + pa = testCallerIsMethod(@setIunits, pf3, unit('Hz')); + out1 = eq(pa, pf3); + out2 = eqLocal(pa, pf3, 'iunits'); + out3 = eqLocal(pa, pf3, 'parfrac/iunits'); + out4 = eq(pa.hist, pf3.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception + % list with properties where a public set method exist. + % + % + function result = utp_09 + + % + % + % Test the eq method with the exception 'ounits'. Use the option + % 'internal' to suppress the history. It is necessary to add 'created' + % to the exception list because 'pa' is created at an other time. + % + % + + try + % + pa = testCallerIsMethod(@setOunits, pf3, unit('V')); + out1 = eq(pa, pf3); + out2 = eqLocal(pa, pf3, 'ounits'); + out3 = eqLocal(pa, pf3, 'parfrac/ounits'); + out4 = eq(pa.hist, pf3.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Test the eq method with an exception list which is in a plist. + % + % + function result = utp_10 + + % + % + % Test that the eq method uses the exception list in a plist. + % + % + + try + % + pa = testCallerIsMethod(@setName, pf3, 'my name'); + pl = plist('Exceptions', {'name', 'UUID'}); + out1 = eq(pa, pf3); + out2 = eq(pa, pf3, pl); + out3 = eq(pa, pf3, pl); + out4 = eq(pa.hist, pf3.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + function res = eqLocal(obj1, obj2, ex) + e = ple1.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {ex}]); + + res = eq(obj1, obj2, ple); + end +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_get.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_get.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,294 @@ +% UTP_PARFRAC_GET a set of UTPs for the parfrac/get method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_get.m,v 1.3 2011/03/29 13:03:29 ingo Exp $ +% + +% +% +% The get method of the parfrac class returns the value of an object +% property. This is a very simple method which accepts only one parfrac as +% input thus are the most general units test not possible. +% +% + +function results = utp_parfrac_get(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'get'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Algorithm test + results = [results utp_03]; % Algorithm test with a plist + results = [results utp_04]; % Negative test with more than one parfrac + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('property'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('property')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('property'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests the get method of the parfrac class. + % + % + function result = utp_02 + + % + % + % Test that the get returns returns the value of the specified + % property. Do this for all properties of the PARFRAC object. + % + % + + try + % + pf = parfrac([1 2+1i 2-1i], [6 1+3i 1-3i], [1 2 3 4], 'my par frac', unit('V'), unit('Hz')); + out1 = get(pf, 'res'); + out2 = get(pf, 'poles'); + out3 = get(pf, 'pmul'); + out4 = get(pf, 'dir'); + out6 = get(pf, 'iunits'); + out7 = get(pf, 'ounits'); + out8 = get(pf, 'hist'); + out9 = get(pf, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the correct value of the output + % + % + + atest = true; + if stest + % + if ~isequal(out1, pf.res), atest = false; end + if ~isequal(out2, pf.poles), atest = false; end + if ~isequal(out3, pf.pmul), atest = false; end + if ~isequal(out4, pf.dir), atest = false; end + if ~eq(out6, pf.iunits), atest = false; end + if ~eq(out7, pf.ounits), atest = false; end + if ~eq(out8, pf.hist), atest = false; end + if ~isequal(out9, pf.name), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the get method works with a plist. + % + % + function result = utp_03 + + % + % + % Test that the get returns returns the value of the specified + % property which is defined in a plist. + % + % + + try + % + pf = parfrac([1 2+1i 2-1i], [6 1+3i 1-3i], [1 2 3 4], 'my par frac', unit('V'), unit('Hz')); + pl1 = plist('property', 'res'); + pl2 = plist('property', 'poles'); + pl3 = plist('property', 'pmul'); + pl4 = plist('property', 'dir'); + pl6 = plist('property', 'iunits'); + pl7 = plist('property', 'ounits'); + pl8 = plist('property', 'hist'); + pl9 = plist('property', 'name'); + out1 = get(pf, pl1); + out2 = get(pf, pl2); + out3 = get(pf, pl3); + out4 = get(pf, pl4); + out6 = get(pf, pl6); + out7 = get(pf, pl7); + out8 = get(pf, pl8); + out9 = get(pf, pl9); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the correct value of the output + % + % + + atest = true; + if stest + % + if ~isequal(out1, pf.res), atest = false; end + if ~isequal(out2, pf.poles), atest = false; end + if ~isequal(out3, pf.pmul), atest = false; end + if ~isequal(out4, pf.dir), atest = false; end + if ~eq(out6, pf.iunits), atest = false; end + if ~eq(out7, pf.ounits), atest = false; end + if ~eq(out8, pf.hist), atest = false; end + if ~isequal(out9, pf.name), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests the get method of the parfrac class. + % + % + function result = utp_04 + + % + % + % Test that the get throws an error if the input are more than + % one PARFRAC object. + % + % + + try + % + pf = parfrac([1 2+1i 2-1i], [6 1+3i 1-3i], [1 2 3 4]); + out = get([pf, pf], 'name'); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_getlowerFreq.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_getlowerFreq.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,221 @@ +% UTP_PARFRAC_GETLOWERFREQ a set of UTPs for the parfrac/getlowerFreq method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_getlowerFreq.m,v 1.3 2011/04/04 13:39:11 ingo Exp $ +% + +% +% +% The getlowerFreq method of the parfrac class gets the frequency of the +% lowest pole in the model. This is a very simple method which accepts only +% one parfrac as input thus are the most general units test not possible. +% +% + +function results = utp_parfrac_getlowerFreq(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'getlowerFreq'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Algorithm test + results = [results utp_03]; % Negative test with more than one parfrac + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests the getlowerFreq method of the parfrac class. + % + % + function result = utp_02 + + % + % + % Test that the getlowerFreq returns the lowest frequence of the pole + % in the parfrac object. + % + % + + try + % + p1 = pz(3,2); % f = 3 + p2 = pz(40); % f = 40 + p3 = pz(2,3); % f = 2 + p4 = pz(100); % f = 100 + pole_ri = [p1.ri.', p2.ri.', p3.ri.', p4.ri.']; + res = [1 2 3 4 5 6]; + pf = parfrac(res, pole_ri); + out = getlowerFreq(pf); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + TOL = 1e-15; + if stest + % + if abs(out-2)>TOL, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests the getlowerFreq method of the parfrac class. + % + % + function result = utp_03 + + % + % + % Test that the getlowerFreq throws an error if the input are more than + % one parfrac. + % + % + + try + % + p1 = pz(3,2); % f = 3 + p2 = pz(40); % f = 40 + p3 = pz(2,3); % f = 2 + p4 = pz(100); % f = 100 + pole_ri = [p1.ri.', p2.ri.', p3.ri.', p4.ri.']; + res = [1 2 3 4 5 6]; + pf = parfrac(res, pole_ri, []); + out = getlowerFreq([pf, pf]); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_getupperFreq.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_getupperFreq.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,221 @@ +% UTP_PARFRAC_GETUPPERFREQ a set of UTPs for the parfrac/getupperFreq method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_getupperFreq.m,v 1.3 2011/04/04 13:39:11 ingo Exp $ +% + +% +% +% The getupperFreq method of the parfrac class gets the frequency of the +% lowest pole in the model. This is a very simple method which accepts only +% one parfrac as input thus are the most general units test not possible. +% +% + +function results = utp_parfrac_getupperFreq(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'getupperFreq'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Algorithm test + results = [results utp_03]; % Negative test with more than one parfrac + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests the getupperFreq method of the parfrac class. + % + % + function result = utp_02 + + % + % + % Test that the getupperFreq returns the lowest frequence of the pole + % in the parfrac object. + % + % + + try + % + p1 = pz(3,2); % f = 3 + p2 = pz(40); % f = 40 + p3 = pz(2,3); % f = 2 + p4 = pz(100); % f = 100 + pole_ri = [p1.ri.', p2.ri.', p3.ri.', p4.ri.']; + res = [1 2 3 4 5 6]; + pf = parfrac(res, pole_ri); + out = getupperFreq(pf); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + TOL = 1e-15; + if stest + % + if abs(out-100)>TOL, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests the getupperFreq method of the parfrac class. + % + % + function result = utp_03 + + % + % + % Test that the getupperFreq throws an error if the input are more than + % one parfrac. + % + % + + try + % + p1 = pz(3,2); % f = 3 + p2 = pz(40); % f = 40 + p3 = pz(2,3); % f = 2 + p4 = pz(100); % f = 100 + pole_ri = [p1.ri.', p2.ri.', p3.ri.', p4.ri.']; + res = [1 2 3 4 5 6]; + pf = parfrac(res, pole_ri, []); + out = getupperFreq([pf, pf]); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_index.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_index.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,525 @@ +% UTP_PARFRAC_INDEX a set of UTPs for the parfrac/index method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_index.m,v 1.4 2009/07/28 17:12:38 ingo Exp $ +% + +% +% +% The index method of the parfrac class index into a PARFRAC vector or +% matrix. This properly captures the history. +% +% + +function results = utp_parfrac_index(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'index'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PARFRAC objects + [pf1,pf2,pf3,pfv,pfm] = get_test_objects_parfrac; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test history is working + results = [results utp_06]; % Test the modify call works + results = [results utp_07]; % Test with plist + results = [results utp_08]; % Test select more objects with an index + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('i'), atest = false; end + if ~io(3).plists.isparam('j'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('i')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('j')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('i'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('j'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the index method works with a vector of PARFRAC objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the index method works for a vector of PARFRAC objects as + % input. The following indexing should work: + % I = [ 1 2 3 ] or (I/J) = [(1,1), (1,2), (1,3)] + % + % + + try + % + objvec = [pf1, pf2, pf3]; + out1 = objvec.index(1); + out2 = objvec.index(3); + out3 = objvec.index(1,2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the index method selects the correct object. + % + % + + atest = true; + if stest + % + if ~eq(out1, pf1, ple3), atest = false; end + if ~eq(out2, pf3, ple3), atest = false; end + if ~eq(out3, pf2, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the index method works with a matrix of PARFRAC objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the index method works for a matrix of PARFRAC objects as + % input. The following indexing should work: + % I = [ 1 3 5 ] or (I/J) = [(1,1), (1,2), (1,3)] + % [ 2 4 6 ] [(2,1), (2,2), (2,3)] + % + + try + % + objmat = [pf1, pf2, pf3; ... + pf3, pf1, pf2]; + out1 = objmat.index(5); + out2 = objmat.index(4); + out3 = objmat.index(1,2); + out4 = objmat.index(2,1); + out5 = objmat.index(2,2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the index method selects the correct object. + % + % + + atest = true; + if stest + % + if ~eq(out1, pf3, ple3), atest = false; end + if ~eq(out2, pf1, ple3), atest = false; end + if ~eq(out3, pf2, ple3), atest = false; end + if ~eq(out4, pf3, ple3), atest = false; end + if ~eq(out5, pf1, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the index method works with a list of PARFRAC objects as + % input. + % + % + function result = utp_04 + + % + % + % The index method doesn't work for a list of PARFRAC objects as input. + % + % + + try + % + out = index(pf1,pf2,pf3, 4); + % + stest = false; + catch + stest = true; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the index method properly applies history. + % + % + function result = utp_05 + + % + % + % Test that the result of index have an additional history step. + % + % + + try + % + i = 2; + j = 3; + objmat = [pf1, pf2, pf3; ... + pf3, pf1, pf2]; + out = index(objmat, i, j); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds + % to 'index'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'index'), atest = false; end + % Check that the history-plist contains the used indices. + pl = out.hist.plistUsed; + if pl.find('i') ~= i, atest = false; end + if pl.find('j') ~= j, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the index method works for the modifier command. + % + % + function result = utp_06 + + % + % + % Tests that the index method works for the modifier command. + % + % + + try + % + i = 1; + j = 1; + objmat = [pf1, pf2, pf3; ... + pf3, pf1, pf2]; + out1 = index(objmat, i, j); + out2 = objmat.index(i,j); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history-plist contains the used indices. + % 2) Check that the index method selects the correct object + % + % + + atest = true; + if stest + % + % Check that the history-plist contains the used indices. + pl = out1.hist.plistUsed; + if pl.find('i') ~= i, atest = false; end + if pl.find('j') ~= j, atest = false; end + % Check that the index method selects the correct object + if ~eq(out1, pf1, ple3), atest = false; end + % Check that the history-plist contains the used indices. + pl = out2.hist.plistUsed; + if pl.find('i') ~= i, atest = false; end + if pl.find('j') ~= j, atest = false; end + % Check that the index method selects the correct object + if ~eq(out2, pf1, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Control the method with a plist. + % + % + function result = utp_07 + + % + % + % Test that the index method can be controled with a plist. + % + % + + try + % + i1 = 6; + i2 = 1; + j2 = 3; + objmat = [pf1, pf2, pf3; ... + pf3, pf1, pf2]; + pl1 = plist('i', i1); + pl2 = plist('i', i2, 'j', j2); + out1 = index(objmat, pl1); + out2 = index(objmat, pl2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history-plist contains the used indices. + % 2) Check that the index method selects the correct object + % + % + + atest = true; + if stest + % + % Check that the history-plist contains the used indices. + pl = out1.hist.plistUsed; + if ~isequal(pl.find('i'), i1), atest = false; end + if ~isequal(pl.find('j'), []), atest = false; end + % Check that the index method selects the correct object + if ~eq(out1, pf2, ple3), atest = false; end + % Check that the history-plist contains the used indices. + pl = out2.hist.plistUsed; + if ~isequal(pl.find('i'), i2), atest = false; end + if ~isequal(pl.find('j'), j2), atest = false; end + % Check that the index method selects the correct object + if ~eq(out2, pf3, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test that the index method selects more objects if I have more indices. + % + % + function result = utp_08 + + % + % + % Test that the index method selects more objects if I have more indices. + % + % + + try + % + i = [2 6]; + objmat = [pf1, pf2, pf3; ... + pf3, pf1, pf2]; + pl = plist('i', i); + out1 = objmat.index(i); + out2 = objmat.index(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history-plist contains the used indices. + % 2) Check that the index method selects the correct object + % + % + + atest = true; + if stest + % + % Check that the history-plist contains the used indices. + pl = out1(1).hist.plistUsed; + if ~isequal(pl.find('i'), i), atest = false; end + if ~isequal(pl.find('j'), []), atest = false; end + % Check that the index method selects the correct object + if ~eq(out1(1), pf3, ple3), atest = false; end + if ~eq(out1(2), pf2, ple3), atest = false; end + % Check that the history-plist contains the used indices. + pl = out2(2).hist.plistUsed; + if ~isequal(pl.find('i'), i), atest = false; end + if ~isequal(pl.find('j'), []), atest = false; end + % Check that the index method selects the correct object + if ~eq(out2(1), pf3, ple3), atest = false; end + if ~eq(out2(2), pf2, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_isprop.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_isprop.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,486 @@ +% UTP_PARFRAC_ISPROP a set of UTPs for the parfrac/isprop method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_isprop.m,v 1.3 2011/03/29 13:13:33 ingo Exp $ +% + +% +% +% The isprop method of the parfrac class determine whether input is object +% property. +% +% + +function results = utp_parfrac_isprop(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'isprop'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PARFRAC objects + [pf1,pf2,pf3,pfv,pfm] = get_test_objects_parfrac; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test negative case + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the isprop method works with a vector of PARFRAC objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the isprop method works for a vector of PARFRAC objects as + % input. + % + % + + try + % + out = isprop(pfv, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pfv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pfv)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the isprop method works with a matrix of PARFRAC objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the isprop method works for a matrix of PARFRAC objects as + % input. + % + % + + try + % + out = isprop(pfm, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pfm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pfm)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the isprop method works with a list of PARFRAC objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the isprop method works for a list of PARFRAC objects as + % input. + % + % + + try + % + out = isprop(pf1,pf2,pf3, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the isprop method works with a mix of different shaped + % PARFRAC objects as input. + % + % + function result = utp_05 + + % + % + % Test that the isprop method works with an input of matrices and + % vectors and single PARFRAC objects. + % + % + + try + % + out = isprop(pf1,pfv,pf2,pfm,pf3, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(pfm)+numel(pfv)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the isprop method properly applies history. + % + % + function result = utp_06 + + % + % + % The method isprop doesn't change the object, thus it is not necessary + % to apply history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the isprop method works for each property. + % + % + function result = utp_07 + + % + % + % Test that the isprop method works for the properties: + % 'res', 'poles', 'pmul', 'dir', 'iunits', 'ounits', 'hist', + % 'name' + % + % + + try + % + % copy pf1 to work with + out1 = isprop(pf1, 'res'); + out2 = isprop(pf1, 'poles'); + out3 = isprop(pf1, 'pmul'); + out4 = isprop(pf1, 'dir'); + out6 = isprop(pf1, 'iunits'); + out7 = isprop(pf1, 'ounits'); + out8 = isprop(pf1, 'hist'); + out9 = isprop(pf1, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if ~out1, atest = false; end; + if ~out2, atest = false; end; + if ~out3, atest = false; end; + if ~out4, atest = false; end; + if ~out6, atest = false; end; + if ~out7, atest = false; end; + if ~out8, atest = false; end; + if ~out9, atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the negative case and the not function command. + % + % + function result = utp_08 + + % + % + % Test that the isprop method retrun false for a unknown property and + % for methods of the object. + % + % + + try + % + out1 = isprop(pf2, 'foo'); + out2 = pf2.isprop('foo'); + out3 = pf2.isprop('name'); + out4 = pf2.isprop('type'); + out5 = pf2.isprop('char'); + out6 = pf2.isprop('creator'); + out7 = pf2.isprop('created'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if out1, atest = false; end; + if out2, atest = false; end; + if ~out3, atest = false; end; + if out4, atest = false; end; + if out5, atest = false; end; + if out6, atest = false; end; + if out7, atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_loadobj.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_loadobj.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,151 @@ +% UTP_PARFRAC_LOADOBJ a set of UTPs for the parfrac/loadobj method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_loadobj.m,v 1.2 2009/02/06 14:38:36 ingo Exp $ +% + +% +% +% The loadobj method of the parfrac class will be automatically called by +% MATLAB if an older object is not compatible with the current object structure. +% This happens only for objects which are stored as a MATLAB formatted +% (MAT-file). The load mechanism for XML formated files calls always the +% 'update_struct' method to keep the stored objects up to date. The +% 'update_struct' method convert the read object structure to the object +% structure which is used in the currend LTPDA version. +% This UTP will load old objects which are stored with an older LTPDA version. +% +% REMARK: Since LTPDA version 1.9.2 will be an object which should be saved as a +% MAT file stored as a struct and not as the object. +% +% + +function results = utp_parfrac_loadobj(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'loadobj'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Run the tests + results = [results utp_01]; % getInfo call + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Get all .MAT and .XML files + path = fullfile(fileparts(which(mfilename)), '..', '..', 'utp_test_files'); + + matfiles = utils.prog.filescan(path, '.mat'); + xmlfiles = utils.prog.filescan(path, '.xml'); + + % Load .MAT files + obj_no = 1; + for ii=1:numel(matfiles) + fn = matfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = parfrac(fn); + obj_no = obj_no+1; + end + end + + % Load .XML files + for ii=1:numel(xmlfiles) + fn = xmlfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = parfrac(fn); + obj_no = obj_no+1; + end + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the shape of the loaded objects. + % + % + + atest = true; + if stest + % + for ii = 1:numel(objs) + obj = objs(ii).obj; + fname = objs(ii).fname; + + if ~isempty(strfind(fname, '_vec')) + % Loaded object must be a vector + if ~isvector(obj), atest = false; end + elseif ~isempty(strfind(fname, '_mat')) + % Loaded object must be a matrix + % REMARK: Known error in LTPDA version 1.9.2 + % A saved matrix doesn't keep the shape of the matrix. + if isempty(strfind(fname, '_192')) + if ~(size(obj,1) > 1 && size(obj,2) > 1), atest = false; end + end + else + % Loaded object must be a single object + if ~(size(obj,1) == 1 && size(obj,2) == 1), + atest = false; end + end + + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_ne.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_ne.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,456 @@ +% UTP_PARFRAC_NE a set of UTPs for the parfrac/ne method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_ne.m,v 1.6 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The ne() method of the parfrac class pf1 ~= pf2 compares each element of +% an parfrac object with the corresponding element of an second parfrac +% object and returns a logical 1 (true) where pf1 and pf2 are not equal, or +% logical 0 (false) where they are equal. +% +% + +function results = utp_parfrac_ne(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'ne'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PARFRAC objects + [pf1,pf2,pf3,pfv,pfm] = get_test_objects_parfrac; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test with the exception list 'name' + results = [results utp_08]; % Test exception list in a plist + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the ne method works with a vector of PARFRAC objects as input. + % + % + function result = utp_02 + + % + % + % Test that the ne method works for a vector of PARFRAC objects as input. + % Test the positive and the negative case. + % + % + + try + % + pf = pf3.setName('my name'); + pfv1 = [pf1, pf2, pf3]; + pfv2 = [pf1, pf2, pf]; + out1 = ne(pfv1, pfv1); + out2 = ne(pfv1, pfv2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the ne function. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the ne method works with a matrix of PARFRAC objects as input. + % + % + function result = utp_03 + + % + % + % Test that the ne method works for a matrix of PARFRAC objects as input. + % Test the positive and the negative case. + % + % + + try + % + pf = pf3.setName('my name'); + pfm1 = [pf1, pf2, pf3; pf1, pf2, pf3]; + pfm2 = [pf1, pf2, pf3; pf1, pf2, pf]; + out1 = ne(pfm1, pfm1); + out2 = ne(pfm1, pfm2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the ne function. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the ne method works with a list of PARFRAC objects as input. + % + % + function result = utp_04 + + % + % + % The ne method doesn't works for a list of PARFRAC objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the ne method works with a mix of different shaped PARFRAC + % objects as input. + % + % + function result = utp_05 + + % + % + % The ne method doesn't works for a list of PARFRAC objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the ne method properly applies history. + % + % + function result = utp_06 + + % + % + % The ne method doesn't change the PARFRAC object, thus will no history + % added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the ne method with an exception list. + % The function parfrac/ne use the function parfrac/eq so it is not + % necessary to check all possibilities of the exception list. + % + % + function result = utp_07 + + % + % + % Test the ne method with the exception 'name'. Use the option + % 'internal' to suppress the history. It is necessary to add 'created' + % to the exception list because pf is created at an other time. + % + % + + try + % + pf = testCallerIsMethod(@setName, pf3, 'my name'); + out1 = ne(pf, pf3); + out2 = ne(pf, pf3, 'name', 'created', 'UUID'); + out3 = ne(pf, pf3, 'parfrac/name', 'created', 'UUID'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + if out3 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the ne method with an exception list which is in a plist. + % + % + function result = utp_08 + + % + % + % Test that the ne method uses the exception list in a plist. + % + % + + try + % + pf = testCallerIsMethod(@setName, pf3, 'my name'); + pl = plist('Exceptions', {'name', 'created', 'UUID'}); + out1 = ne(pf, pf3); + out2 = ne(pf, pf3, pl); + out3 = ne(pf, pf3, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + if out3 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_parfrac.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_parfrac.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,1560 @@ +% UTP_PARFRAC_PARFRAC a set of UTPs for the parfrac/parfrac method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_parfrac.m,v 1.21 2011/08/22 05:37:13 hewitson Exp $ +% + +% +% +% The parfrac method of the parfrac class constructs PARFRAC objects. +% +% + +function results = utp_parfrac_parfrac(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'parfrac'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test objects + [pf1,pf2,pf3,pfv,pfm] = get_test_objects_parfrac; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working with empty constructor + results = [results utp_07]; % Test history is working with copy constructor + results = [results utp_08]; % Test history is working with MAT file constructor + results = [results utp_09]; % Test history is working with XML file constructor + results = [results utp_10]; % Test history is working with struct constructor + results = [results utp_11]; % Test history is working with rational-object constructor + results = [results utp_12]; % Test history is working with pzmodel-object constructor + results = [results utp_13]; % Test history is working with plist(filename) constructor + results = [results utp_14]; % Test history is working with plist(hostname) constructor + results = [results utp_15]; % Test history is working with plist(res || poles || dir) constructor + results = [results utp_16]; % Test history is working with plist(pzmodel) constructor + results = [results utp_17]; % Test history is working with plist(rational) constructor + results = [results utp_18]; % Test history is working with plist(plist) constructor + results = [results utp_19]; % Test history is working with conn+Id constructor + results = [results utp_20]; % Test history is working with res + poles + dir constructor + results = [results utp_21]; % Test history is working with res + poles + dir + name constructor + results = [results utp_22]; % Test history is working with res + poles + dir + name + iunits + ounits constructor + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Rational')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Pzmodel')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Residuals/Poles/Direct')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Repository')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From XML File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From MAT File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Built-in Model')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 3, atest = false; end + % Check key + % Check default value + % Check options + %%%%%%%%%% SET 'From MAT File' + pn = 4; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + %%%%%%%%%% SET 'From XML File' + pn = 5; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + %%%%%%%%%% SET 'From Repository' + pn = 6; + if io(pn).plists.nparams ~= 10, atest = false; end + % Check key + if ~io(pn).plists.isparam('hostname'), atest = false; end + if ~io(pn).plists.isparam('id'), atest = false; end + if ~io(pn).plists.isparam('cid'), atest = false; end + if ~io(pn).plists.isparam('database'), atest = false; end + if ~io(pn).plists.isparam('binary'), atest = false; end + if ~io(pn).plists.isparam('username'), atest = false; end + if ~io(pn).plists.isparam('password'), atest = false; end + % Check default value + if ~isEmptyDouble(io(pn).plists.find('id')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('cid')), atest = false; end + if ~isequal(io(pn).plists.find('binary'), 'yes'), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('id'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('cid'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('binary'), {'yes', 'no'}), atest = false; end + %%%%%%%%%% SET 'From Built-in Model' + pn = 7; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('built-in'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('built-in')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('built-in'), {''}), atest = false; end + %%%%%%%%%% SET 'From Rational' + pn = 8; + if io(pn).plists.nparams ~= 6, atest = false; end + % Check key + if ~io(pn).plists.isparam('rational'), atest = false; end + % Check default value + if ~eq(io(pn).plists.find('rational'), rational(), ple1), atest = false; end + % Check options + %%%%%%%%%% SET 'From Pzmodel' + pn = 9; + if io(pn).plists.nparams ~= 6, atest = false; end + % Check key + if ~io(pn).plists.isparam('pzmodel'), atest = false; end + % Check default value + if ~eq(io(pn).plists.find('pzmodel'), pzmodel(), ple1), atest = false; end + % Check options + %%%%%%%%%% SET 'From Residuals/Poles/Direct' + pn = 10; + if io(pn).plists.nparams ~= 8, atest = false; end + % Check key + if ~io(pn).plists.isparam('res'), atest = false; end + if ~io(pn).plists.isparam('poles'), atest = false; end + if ~io(pn).plists.isparam('dir'), atest = false; end + if ~io(pn).plists.isparam('name'), atest = false; end + % Check default value + if ~isEmptyDouble(io(pn).plists.find('res')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('poles')), atest = false; end + if ~isequal(io(pn).plists.find('dir'), 0), atest = false; end + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('res'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('poles'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('dir'), {0}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('name'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the parfrac method works with a vector of PARFRAC objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the parfrac method works with a vector of PARFRAC objects + % as input. + % + % + + try + % + out = parfrac(pfv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output PARFRACs is the same as the + % input shape. + % 2) Check that each output PARFRAC is a copy of the input PARFRAC. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + if stest + % + % Check we have the correct shape + if size(out) ~= size(pfv), atest = false; end + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(pfv(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(pfv(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(pfv(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the parfrac method works with a matrix of PARFRAC objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the parfrac method works with a matrix of PARFRAC objects + % as input. + % + % + + try + % + out = parfrac(pfm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output PARFRACs is the same as the + % input shape. + % 2) Check that each output PARFRAC is a copy of the input PARFRAC. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if size(out) ~= size(pfm), atest = false; end + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(pfm(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(pfm(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(pfm(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the parfrac method works with a list of PARFRAC objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the parfrac method works with a list of PARFRAC objects as + % input. + % + % + + try + % + out = parfrac(pf1,pf2,pf3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same of the + % number in the input. + % 2) Check that each output PARFRAC is a copy of the input PARFRAC. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + pfin = [pf1,pf2,pf3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(pfin(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(pfin(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(pfin(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the parfrac method works with a mix of different shaped + % PARFRACs as input. + % + % + function result = utp_05 + + % + % + % Test that the parfrac method works with a mix of different shaped + % PARFRACs as input. + % + % + + try + % + out = parfrac(pf1,pfv,pf2,pfm,pf3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same of the + % number in the input. + % 2) Check that each output PARFRAC is a copy of the input PARFRAC. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + pfin = [pf1, reshape(pfv, 1, []), pf2, reshape(pfm, 1, []), pf3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3+numel(pfv)+numel(pfm), atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(pfin(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(pfin(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(pfin(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the parfrac method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the parfrac method can be processed + % back. + % + % + + try + % + out = parfrac(pf1); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'parfrac'. + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'parfrac'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the parfrac method properly applies history to the copy + % constructor. + % + % + function result = utp_07 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % Test the constructor with a different number of inputs. + % + % + + try + % + out1 = parfrac(pf1); + out2 = parfrac(pf1, pf2); + out3 = parfrac(pf1, pf2, pf3); + out1.setName('my name'); + out2(1).setName('my name'); + out2(2).setName('my name'); + out3(1).setName('my name'); + out3(2).setName('my name'); + out3(3).setName('my name'); + mout = rebuild(out1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'parfrac'. + % 2) Check that the original objects are not changed by the setter + % function + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + % It is the method 'setName' because we set it in above + if ~strcmp(out1.hist.methodInfo.mname, 'setName'), atest = false; end + % Check next to the last step in the history of 'out' + if ~strcmp(out1.hist.inhists.methodInfo.mname, 'parfrac'), atest = false; end + % Check the originals + if strcmp(pf1, 'my name'), atest = false; end + if strcmp(pf2, 'my name'), atest = false; end + if strcmp(pf3, 'my name'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out1, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the parfrac method properly applies history to the read + % MAT-file constructor. + % + % + function result = utp_08 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + filename = 'pf.mat'; + pf = parfrac(pf3); + save(pf, filename); + + out = parfrac(filename); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the loaded object is the same as the saved object. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the loaded object. + if ~eq(out, pf), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), atest = false; end + % + delete(filename); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + + %% UTP_09 + + % + % + % Tests that the parfrac method properly applies history to the read + % XML-file constructor. + % + % + function result = utp_09 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + filename = 'pfm.xml'; + amat = parfrac(pfm); + save(amat, filename); + + out = parfrac(filename); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the loaded object is the same as the saved object. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the algorithm + for kk = 1:numel(out) + % Check the loaded object. + if ~eq(out(kk), amat(kk)), atest = false; end + end + + % Check the rebuilt object + for kk = 1:numel(out) + if ~eq(mout(kk), out(kk), ple2), atest = false; end + end + % + delete(filename); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Tests that the parfrac method properly doesn't apply history to the + % struct constructor. + % + % + function result = utp_10 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + spf3 = struct(pf3); + spf3.iunits = struct(pf3.iunits); + spf3.ounits = struct(pf3.ounits); + spf3.hist = struct(pf3.hist); + + out1 = parfrac(struct(pf2)); + out2 = parfrac(spf3); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' + % corresponds to 'parfrac'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check that the output is a PARFRAC object + if ~isa(out1,'parfrac'), atest = false; end + if ~isa(out2,'parfrac'), atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'setName'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'setName'), atest = false; end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_11 + + % + % + % Tests that the parfrac method properly applies history to the rational + % constructor. + % + % + function result = utp_11 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + ra = rational([1 2 3], [4 5 6 7], 'my rational', unit('V'), unit('Hz')); + out = parfrac(ra); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'parfrac'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check that the output is a PARFRAC object + if ~isa(out,'parfrac'), atest = false; end + % Check the values of the parfract object + [res, poles, dterms, pmul] = utils.math.cpf('INOPT', 'RAT', 'NUM', ra.num, 'DEN', ra.den, 'MODE', 'SYM'); + if ~isequal(out.res, res), atest = false; end + if ~isequal(out.poles, poles), atest = false; end + if ~isequal(out.dir, dterms), atest = false; end + if ~isequal(out.pmul, pmul), atest = false; end + if ~eq(out.iunits, unit('V')), atest = false; end + if ~eq(out.ounits, unit('Hz')), atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'parfrac'), atest = false; end + if ~strcmp(out.hist.inhists.methodInfo.mname, 'rational'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_11 + + %% UTP_12 + + % + % + % Tests that the parfrac method properly applies history to the pzmodel + % constructor. + % + % + function result = utp_12 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + ps = [pz(1) pz(200)]; + zs = pz(50); + pzm = pzmodel(1, ps, zs, unit('Hz^2'), unit('V^2')); + out = parfrac(pzm); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'parfrac'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check that the output is a PARFRAC object + if ~isa(out,'parfrac'), atest = false; end + % Check the values of the different proerpties + gs = utils.math.getk(vertcat(zs(:).ri),vertcat(ps(:).ri),pzm.gain); + [res, poles, dterms, pmul] = utils.math.cpf('INOPT', 'PZ', 'POLES', vertcat(ps(:).ri), 'ZEROS', vertcat(zs(:).ri), 'GAIN', gs, 'MODE', 'SYM'); + if ~isequal(out.res, res), atest = false; end + if ~isequal(out.poles, poles), atest = false; end + if ~isequal(out.dir, dterms), atest = false; end + if ~isequal(out.pmul, pmul), atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'parfrac'), atest = false; end + if ~strcmp(out.hist.inhists.methodInfo.mname, 'pzmodel'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Tests that the parfrac method properly applies history to the + % plist(filename) constructor. + % + % + function result = utp_13 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + try + % + filename1 = 'pf.xml'; + filename2 = 'pf.mat'; + + f1 = parfrac(pf3); + f2 = parfrac(pf2); + + save(f1, filename1); + save(f2, filename2); + + out1 = parfrac(plist('filename', filename1)); + out2 = parfrac(plist('filename', filename2)); + + rout1 = out1.rebuild; + rout2 = out2.rebuild; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the save method doesn't change the input object + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the input object of the save method + if ~eq(f1, pf3, ple3), atest = false; end + if ~eq(f1.hist.inhists, pf3.hist) , atest = false; end + if ~eq(f2, pf2, ple3) , atest = false; end + if ~eq(f2.hist.inhists, pf2.hist) , atest = false; end + % The load doesn't have two additionally history steps (save + load) + if ~eq(out1, f1), atest = false; end + if ~eq(out2, f2), atest = false; end + % Rebuild object and check the result + if ~eq(rout1, out1, ple2), atest = false; end + if ~eq(rout2, out2, ple2), atest = false; end + % + % delete test file + delete(filename1) + delete(filename2) + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + %% UTP_14 + + % + % + % Tests that the PARFRAC method properly applies history to the + % plist(conn) constructor. + % + % + function result = utp_14 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + conn = utpGetConnection(); + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_parfrac_parfrac_14: submit parfrac vector'; + sinfo.experiment_description = 'utp_parfrac_parfrac_14: &description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + plForAutoTest = plist('no dialog', true, 'use selector', false); + ids = submit(pfv, sinfo, plForAutoTest); + + out = parfrac(plist('hostname', utpGetHostname, 'database', utpGetDatabase, 'conn', conn, 'id', ids)); + % + utpCloseConnection(conn); + stest = true; + catch err + disp(err.message) + % Close connection + utpCloseConnection(conn); + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'parfrac'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + for kk = 1:numel(out) + if ~strcmp(out(kk).hist.methodInfo.mname, 'parfrac'), atest = false; end + end + % Check data values + if ~eq(out, pfv, ple3), atest = false; end + % Rebuild object and check the result + mout = rebuild(out); + if ~eq(mout, out, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_14 + + %% UTP_15 + + % + % + % Tests that the PARFRAC method properly applies history to the + % plist(res || poles || dir) constructor. + % + % + function result = utp_15 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + res = [1; 2+1i; 2-1i]; + ps = [6; 1+3i; 1-3i]; + d = [1; 2]; + pl = plist('res', res, 'poles', ps, 'dir', d); + out = parfrac(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'parfrac'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'parfrac'), atest = false; end + % Check the properties + if ~isequal(out.res, res), atest = false; end + if ~isequal(out.poles, ps), atest = false; end + if ~isequal(out.dir, d), atest = false; end + % Rebuild object and check the result + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_15 + + %% UTP_16 + + % + % + % Tests that the PARFRAC method properly applies history to the + % plist(pzmodel) constructor. + % + % + function result = utp_16 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + ps = [pz(1) pz(200)]; + zs = pz(50); + pzm = pzmodel(1, ps, zs, unit('Hz'), unit('V')); + pl = plist('pzmodel', pzm); + out = parfrac(pl); + + rout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'parfrac'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'parfrac'), atest = false; end + % Check the next to the last step in the history. + % It must be the history of the pole/zero model (here 'pzmodel') + if ~strcmp(out.hist.inhists.methodInfo.mname, 'pzmodel'), atest = false; end + % Check values + gs = utils.math.getk(vertcat(zs(:).ri),vertcat(ps(:).ri),pzm.gain); + [res, poles, dterms, pmul] = utils.math.cpf('INOPT', 'PZ', 'POLES', vertcat(ps(:).ri), 'ZEROS', vertcat(zs(:).ri), 'GAIN', gs, 'MODE', 'SYM'); + if ~isequal(out.res, res), atest = false; end + if ~isequal(out.poles, poles), atest = false; end + if ~isequal(out.dir, dterms), atest = false; end + if ~isequal(out.pmul, pmul), atest = false; end + if ~eq(out.iunits, unit('Hz')), atest = false; end + if ~eq(out.ounits, unit('V')), atest = false; end + % Rebuild object and check the result + if ~eq(rout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_16 + + %% UTP_17 + + % + % + % Tests that the PARFRAC method properly applies history to the + % plist(parfrac) constructor. + % + % + function result = utp_17 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + ra = rational([1 2 3], [4 5 6 7], 'my rational', unit('V'), unit('Hz')); + pl = plist('rational', ra); + out = parfrac(pl); + + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'parfrac'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'parfrac'), atest = false; end + % Check the next to the last step in the history. + % It must be the history of the partial fraction model (here 'parfrac') + if ~strcmp(out.hist.inhists.methodInfo.mname, 'rational'), atest = false; end + % Check values + [res, poles, dterms, pmul] = utils.math.cpf('INOPT', 'RAT', 'NUM', ra.num, 'DEN', ra.den, 'MODE', 'SYM'); + if ~isequal(out.res, res), atest = false; end + if ~isequal(out.poles, poles), atest = false; end + if ~isequal(out.dir, dterms), atest = false; end + if ~isequal(out.pmul, pmul), atest = false; end + if ~eq(out.iunits, unit('V')), atest = false; end + if ~eq(out.ounits, unit('Hz')), atest = false; end + % Rebuild object and check the result + if ~eq(mout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_17 + + %% UTP_18 + + % + % + % Tests that the PARFRAC method properly applies history to the + % plist() constructor. + % + % + function result = utp_18 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + ra = rational([1 2 3], [4 5 6 7], 'my rational', unit('V'), unit('Hz')); + pl = plist('rational', ra); + out1 = parfrac(plist('plist', pl)); + out2 = parfrac(plist('plist', plist())); % empty plist + + rout1 = rebuild(out1); + rout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'parfrac'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~strcmp(out1.hist.methodInfo.mname, 'parfrac'), atest = false; end + % Check the next to the last step in the history. + % It must be the history of the partial fraction model (here 'parfrac') + if ~strcmp(out1.hist.inhists.methodInfo.mname, 'rational'), atest = false; end + % Check values + if ~eq(out1.iunits, unit('V')), atest = false; end + if ~eq(out1.ounits, unit('Hz')), atest = false; end + % Check the last step in the history of 'out2' + if ~strcmp(out2.hist.methodInfo.mname, 'parfrac'), atest = false; end + % Check the next to the last step in the history. + if ~isempty(out2.hist.inhists), atest = false; end + % Rebuild object and check the result + if ~eq(rout1, out1, ple1), atest = false; end + if ~eq(rout2, out2, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_18 + + %% UTP_19 + + % + % + % Tests that the PARFRAC method properly applies history to the conn+Id + % constructor. + % + % + function result = utp_19 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + conn = utpGetConnection + try + % + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_parfrac_parfrac_19: submit parfrac'; + sinfo.experiment_description = 'utp_parfrac_parfrac_19: description'; + sinfo.analysis_description = 'utp_parfrac_parfrac_19'; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + plForAutoTest = plist('no dialog', true, 'use selector', false); + [ids] = submit(pf3, sinfo, plForAutoTest); + + out = parfrac(conn, ids); + % + utpCloseConnection(conn); + stest = true; + catch err + disp(err.message) + % Close connection + utpCloseConnection(conn); + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'parfrac'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'parfrac'), atest = false; end + % Check data values + if ~eq(out,pf3, ple3), atest = false; end + % Check the history except the additional 'submit' + 'retrieve' steps + if ~eq(out.hist.inhists, pf3.hist), atest = false; end + % Check the rebuilt object + mout = rebuild(out); + if ~eq(mout, out, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_19 + + %% UTP_20 + + % + % + % Tests that the PARFRAC method properly applies history to the + % res + poles + direct terms object constructor. + % + % + function result = utp_20 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + res = [1; 2+1i; 2-1i]; + ps = [6; 1+3i; 1-3i]; + d = [1; 2]; + out = parfrac(res, ps, d); + + rout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'parfrac'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'parfrac'), atest = false; end + % Check properties + if ~isequal(out.res, res), atest = false; end + if ~isequal(out.poles, ps), atest = false; end + if ~isequal(out.dir, d), atest = false; end + % Rebuild object and check the result + if ~eq(rout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_20 + + %% UTP_21 + + % + % + % Tests that the PARFRAC method properly applies history to the + % res + poles + direct terms + name object constructor. + % + % + function result = utp_21 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + res = [1; 2+1i; 2-1i]; + ps = [6; 1+3i; 1-3i]; + d = [1; 2]; + name = 'my new crazy name'; + out = parfrac(res, ps, d, name); + + rout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'parfrac'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'parfrac'), atest = false; end + % Check properties + if ~isequal(out.res, res), atest = false; end + if ~isequal(out.poles, ps), atest = false; end + if ~isequal(out.dir, d), atest = false; end + if ~isequal(out.name, name), atest = false; end + % Rebuild object and check the result + if ~eq(rout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_21 + + %% UTP_22 + + % + % + % Tests that the PARFRAC method properly applies history to the + % res + poles + direct terms + name + iunits + ounits object constructor. + % + % + function result = utp_22 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + res = [1; 2+1i; 2-1i]; + ps = [6; 1+3i; 1-3i]; + d = [1; 2]; + name = 'I''m crazy'; + iu = unit('V^2'); + ou = 's^2/3'; + out = parfrac(res, ps, d, name, iu, ou); + + rout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'parfrac'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'parfrac'), atest = false; end + % Check properties + if ~isequal(out.res, res), atest = false; end + if ~isequal(out.poles, ps), atest = false; end + if ~isequal(out.dir, d), atest = false; end + if ~isequal(out.name, name), atest = false; end + if ~eq(out.iunits, iu), atest = false; end + if ~eq(out.ounits, unit(ou), ple1), atest = false; end + % Rebuild object and check the result + if ~eq(rout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_22 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_rebuild.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_rebuild.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,419 @@ +% UTP_PARFRAC_REBUILD a set of UTPs for the parfrac/rebuild method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_rebuild.m,v 1.2 2009/07/23 16:45:23 ingo Exp $ +% + +% +% +% The rebuild method of the parfrac class rebuilds the input objects using the +% history. This method is also intensively tested in the most other UTPs. +% +% + +function results = utp_parfrac_rebuild(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'rebuild'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PARFRAC objects + [pf1,pf2,pf3,pfv,pfm] = get_test_objects_parfrac; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the output + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the rebuild method works with a vector of PARFRAC objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the rebuild method works for a vector of PARFRAC objects as + % input. + % + % + + try + % + out = rebuild(pfv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + % Check the output + if ~isa(out, 'parfrac'), atest = false; end; + for kk = 1:numel(pfv) + if eq(out(kk), pfv(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the rebuild method works with a matrix of PARFRAC objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the rebuild method works for a matrix of PARFRAC objects as + % input. + % + % + + try + % + out = rebuild(pfm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + if ~isa(out, 'parfrac'), atest = false; end; + for kk = 1:numel(pfm) + if eq(out(kk), pfm(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the rebuild method works with a list of PARFRAC objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the rebuild method works for a list of PARFRAC objects as + % input. + % + % + + try + % + out = rebuild(pf1,pf2,pf3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + pfin = [pf1,pf2,pf3]; + if stest + % + if ~isa(out, 'parfrac'), atest = false; end; + for kk = 1:numel(pfin) + if eq(out(kk), pfin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the rebuild method works with a mix of different shaped + % PARFRAC objects as input. + % + % + function result = utp_05 + + % + % + % Test that the rebuild method works with an input of matrices and + % vectors and single PARFRAC objects. + % + % + + try + % + out = rebuild(pf2,pfv,pf1,pfm,pf3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + pfin = [pf2,reshape(pfv,1,[]),pf1,reshape(pfm,1,[]),pf3]; + if stest + % + if ~isa(out, 'parfrac'), atest = false; end; + for kk = 1:numel(pfin) + if eq(out(kk), pfin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the rebuild method properly applies history. + % + % + function result = utp_06 + + % + % + % The method rebuild doesn't change the data, thus it is not possible + % to check the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the rebuild method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = rebuild(pf3, pf1); + o3 = rebuild(pf3, pf1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, pf3, ple2), atest = false; end + if ~eq(o2, pf1, ple2), atest = false; end + if ~eq(o3, [pf3 pf1], ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_resp.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_resp.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,1061 @@ +% UTP_PARFRAC_RESP a set of UTPs for the parfrac/resp method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_resp.m,v 1.6 2011/02/04 10:56:56 luigi Exp $ +% + +% +% +% The resp method of the parfrac class returns the complex response of a +% parfrac TF as an Analysis Object. For a command with no output variables +% plots the method the result into a diagram. +% +% + +function results = utp_parfrac_resp(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'resp'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PARFRAC objects + [pf1,pf2,pf3,pfv,pfm] = get_test_objects_parfrac; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + warning('This UTP needs a complete update'); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test with f = ao.y + results = [results utp_11]; % Test with f + results = [results utp_12]; % Test with f1, f2 and nf + results = [results utp_13]; % Test with f1, f2 and nf AND 'scale' + + % Make surethat all figures are closed + close all; + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'List')), atest = false; end + if ~any(strcmpi(io(2).sets, 'Range')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'List' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('f'), atest = false; end + if ~io(3).plists.isparam('bank'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('f')), atest = false; end + if ~isequal(io(3).plists.find('bank'), 'none'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('f'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('bank'), {'none', 'serial', 'parallel'}), atest = false; end + %%%%%%%%%% SET 'Range' + if io(4).plists.nparams ~= 5, atest = false; end + % Check key + if ~io(4).plists.isparam('f1'), atest = false; end + if ~io(4).plists.isparam('f2'), atest = false; end + if ~io(4).plists.isparam('nf'), atest = false; end + if ~io(4).plists.isparam('scale'), atest = false; end + if ~io(4).plists.isparam('bank'), atest = false; end + % Check default value + if ~isEmptyDouble(io(4).plists.find('f1')), atest = false; end + if ~isEmptyDouble(io(4).plists.find('f2')), atest = false; end + if ~isequal(io(4).plists.find('nf'), 1000), atest = false; end + if ~isequal(io(4).plists.find('scale'), 'log'), atest = false; end + if ~isequal(io(4).plists.find('bank'), 'none'), atest = false; end + % Check options + if ~isequal(io(4).plists.getOptionsForParam('f1'), {[]}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('f2'), {[]}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('nf'), {1000}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('scale'), {'lin', 'log'}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('bank'), {'none', 'serial', 'parallel'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the resp method works with a vector of PARFRAC objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the resp method works for a vector of PARFRAC objects as + % input. Test the method with an output and with no output + % (a diagram must appear) + % + % + + try + % + % Make sure that all figures are closed. + close all; + resp(pfv); + out = resp(pfv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Test the right number of lines in the diagram. + % 2) Check that the number of elements in 'out' is the same as in 'pfv' + % 3) Check that each output PARFRAC contains the correct data. + % + % + + atest = true; + TOL = 1e-13; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + % Check that the diagram have the same number of lines as the output + % object + if max(cellfun('size', lines, 1)) ~= numel(pfv), atest = false; end + % Check the number of output objects. + if ~isequal(size(out), size(pfv)), atest = false; end + % Check each output against the default values for f1, f2 and nf + for ii = 1:numel(out) + f1 = getlowerFreq(pfv(ii))/10; + f2 = getupperFreq(pfv(ii))*10; + nf = 1000; + if ~isa(out(ii), 'ao'), atest = false; end + if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end + if abs(out(ii).x(1) - f1) > TOL, atest = false; end + if abs(out(ii).x(end) - f2) > TOL, atest = false; end + if numel(out(ii).x) ~= nf, atest = false; end + % Compute response + pfparams.type = 'cont'; + pfparams.freq = out(ii).x; + pfparams.res = pfv(ii).res; + pfparams.pol = pfv(ii).poles; + pfparams.pmul = pfv(ii).pmul; + pfparams.dterm = pfv(ii).dir; + pfr = utils.math.pfresp(pfparams); + rsp = pfr.resp; + if ~isequal(out(ii).y, reshape(rsp,size(out(ii).y))), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the resp method works with a matrix of PARFRAC objects as + % input. + % + % + function result = utp_03 + + % + % + % Tests that the resp method works with a matrix of PARFRAC objects as + % input. Test the method with an output and with no output + % (a diagram must appear) + % + % + + try + % + % Make sure that all figures are closed. + close all; + resp(pfm); + out = resp(pfm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Test the right number of lines in the diagram. + % 2) Check that the number of elements in 'out' is the same as in 'pfm' + % 3) Check that each output PARFRAC contains the correct data. + % + % + + atest = true; + TOL = 1e-13; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + % Check that the diagram have the same number of lines as the output + % object + if max(cellfun('size', lines, 1)) ~= numel(pfm), atest = false; end + % Check the number of output objects. + if ~isequal(size(out), size(pfm)), atest = false; end + % Check each output against the default values for f1, f2 and nf + for ii = 1:numel(out) + f1 = getlowerFreq(pfm(ii))/10; + f2 = getupperFreq(pfm(ii))*10; + nf = 1000; + if ~isa(out(ii), 'ao'), atest = false; end + if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end + if abs(out(ii).x(1) - f1) > TOL, atest = false; end + if abs(out(ii).x(end) - f2) > TOL, atest = false; end + if numel(out(ii).x) ~= nf, atest = false; end + % Compute response + pfparams.type = 'cont'; + pfparams.freq = out(ii).x; + pfparams.res = pfm(ii).res; + pfparams.pol = pfm(ii).poles; + pfparams.pmul = pfm(ii).pmul; + pfparams.dterm = pfm(ii).dir; + pfr = utils.math.pfresp(pfparams); + rsp = pfr.resp; + if ~isequal(out(ii).y, reshape(rsp,size(out(ii).y))), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the resp method works with a list of PARFRAC objects as + % input. + % + % + function result = utp_04 + + % + % + % Tests that the resp method works with a list of PARFRAC objects as + % input. Test the method with an output and with no output + % (a diagram must appear) + % + % + + try + % + % Make sure that all figures are closed. + close all; + resp(pf1, pf2, pf3); + out = resp(pf1, pf2, pf3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Test the right number of lines in the diagram. + % 2) Check that the number of elements in 'out' is the same as in 'rain' + % 3) Check that each output PARFRAC contains the correct data. + % + % + + atest = true; + TOL = 1e-13; + rain = [pf1, pf2, pf3]; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + % Check that the diagram have the same number of lines as the output + % object + if max(cellfun('size', lines, 1)) ~= numel(rain), atest = false; end + % Check the number of output objects. + if ~isequal(size(out), size(rain)), atest = false; end + % Check each output against the default values for f1, f2 and nf + for ii = 1:numel(out) + f1 = getlowerFreq(rain(ii))/10; + f2 = getupperFreq(rain(ii))*10; + nf = 1000; + if ~isa(out(ii), 'ao'), atest = false; end + if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end + if abs(out(ii).x(1) - f1) > TOL, atest = false; end + if abs(out(ii).x(end) - f2) > TOL, atest = false; end + if numel(out(ii).x) ~= nf, atest = false; end + % Compute response + pfparams.type = 'cont'; + pfparams.freq = out(ii).x; + pfparams.res = rain(ii).res; + pfparams.pol = rain(ii).poles; + pfparams.pmul = rain(ii).pmul; + pfparams.dterm = rain(ii).dir; + pfr = utils.math.pfresp(pfparams); + rsp = pfr.resp; + if ~isequal(out(ii).y, reshape(rsp,size(out(ii).y))), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the resp method works with a mix of different shaped + % PARFRAC objects as input. + % + % + function result = utp_05 + + % + % + % Tests that the resp method works with a mix of different shaped + % PARFRAC objects as input. Test the method with an output and with no + % output (a diagram must appear) + % + % + + try + % + % Make sure that all figures are closed. + close all; + resp(pf1, pfm, pfv); + out = resp(pf1, pfm, pfv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Test the right number of lines in the diagram. + % 2) Check that the number of elements in 'out' is the same as in 'rain' + % 3) Check that each output PARFRAC contains the correct data. + % + % + + atest = true; + TOL = 1e-13; + rain = [pf1, reshape(pfm, 1, []), reshape(pfv, 1, [])]; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + % Check that the diagram have the same number of lines as the output + % object + if max(cellfun('size', lines, 1)) ~= numel(rain), atest = false; end + % Check the number of output objects. + if ~isequal(size(out), size(rain)), atest = false; end + % Check each output against the default values for f1, f2 and nf + for ii = 1:numel(out) + f1 = getlowerFreq(rain(ii))/10; + f2 = getupperFreq(rain(ii))*10; + nf = 1000; + if ~isa(out(ii), 'ao'), atest = false; end + if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end + if abs(out(ii).x(1) - f1) > TOL, atest = false; end + if abs(out(ii).x(end) - f2) > TOL, atest = false; end + if numel(out(ii).x) ~= nf, atest = false; end + % Compute response + pfparams.type = 'cont'; + pfparams.freq = out(ii).x; + pfparams.res = rain(ii).res; + pfparams.pol = rain(ii).poles; + pfparams.pmul = rain(ii).pmul; + pfparams.dterm = rain(ii).dir; + pfr = utils.math.pfresp(pfparams); + rsp = pfr.resp; + if ~isequal(out(ii).y, reshape(rsp,size(out(ii).y))), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the resp method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the resp method can be processed back. + % + % + + try + % + close all; + resp(pf1); + out = resp(pf1); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'resp'. + % 2) Check that re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + x = get(lines{1}, 'XData'); + y1 = get(lines{1}, 'YData'); + y2 = get(lines{2}, 'YData'); + if ~isequal(x, out.x.'), atest = false; end + if ~isequal(y2, abs(out.y)'), atest = false; end + if ~isequal(y1, utils.math.phase(out.y)'), atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'resp'), atest = false; end + % Run 'test.m' and check the result + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that modify command plots the response into a diagram. + % + % + function result = utp_07 + + % + % + % Tests that modify command plots the response into a diagram. + % + % + + try + % + close all; + pf1.resp(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the response diagram. + % + % + + atest = true; + TOL = 1e-13; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + x = get(lines{1}, 'XData'); + f1 = getlowerFreq(pf1)/10; + f2 = getupperFreq(pf1)*10; + nf = find(pzmodel.getInfo('resp', 'Range').plists, 'nf'); + if abs(x(1) - f1) > TOL, atest = false; end + if abs(x(end) - f2) > TOL, atest = false; end + if numel(x) ~= nf, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the output AO of the resp method keeps the shape of the used + % input f vector. + % + % + + try + % + arow = ao(1:123, linspace(.1, 5, 123)); + acol = arow.'; + f = linspace(.1, 5, 123); + out1 = resp(pf2, arow); + out2 = resp(pf2, acol); + out3 = resp(pf2, f); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,1) ~= 1, atest = false; end + if size(out1.data.y,2) == 1, atest = false; end + if size(out2.data.y,1) == 1, atest = false; end + if size(out2.data.y,2) ~= 1, atest = false; end + if size(out3.data.y,1) ~= 1, atest = false; end + if size(out3.data.y,2) == 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the resp method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [o1, o2] = resp(pf1, pf1); + o3 = resp(pf1, pf1); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the resp method uses the x-data of an input AO for f-vector. + % + % + function result = utp_10 + + % + % + % Call the method with different method to pass an AO in. + % + % + + try + % + f1 = .1; + f2 = 5; + nf = 123; + axy = ao(linspace(f1, f2, nf), randn(nf,1)); + afs = ao(linspace(f1, f2, nf), randn(nf,1), plist('type', 'fsdata')); + out1 = resp(pf3, axy); + out2 = resp(pf3, afs); + out3 = resp(pf3, plist('f', axy)); + out4 = resp(pf3, plist('f', afs)); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the output + if ~isa(out1, 'ao'), atest = false; end + if ~isa(out2, 'ao'), atest = false; end + if ~isa(out3, 'ao'), atest = false; end + if ~isa(out4, 'ao'), atest = false; end + if out1.x(1) ~= f1, atest = false; end + if out1.x(end) ~= f2, atest = false; end + if numel(out1.x) ~= nf, atest = false; end + if out2.x(1) ~= f1, atest = false; end + if out2.x(end) ~= f2, atest = false; end + if numel(out2.x) ~= nf, atest = false; end + if out3.x(1) ~= f1, atest = false; end + if out3.x(end) ~= f2, atest = false; end + if numel(out3.x) ~= nf, atest = false; end + if out4.x(1) ~= f1, atest = false; end + if out4.x(end) ~= f2, atest = false; end + if numel(out4.x) ~= nf, atest = false; end + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + if ~eq(out3, mout3, ple2), atest = false; end + if ~eq(out4, mout4, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_11 + + % + % + % Check that the resp method uses the specified f-vector to compute the + % response. + % + % + function result = utp_11 + + % + % + % Call the method with different method to pass an f-vector in. + % + % + + try + % + f1 = .1; + f2 = 5; + nf = 100; + f = linspace(f1, f2, nf); + out1 = resp(pf3, f); + out2 = resp(pf3, plist('f', f)); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the output + if ~isa(out1, 'ao'), atest = false; end + if ~isa(out2, 'ao'), atest = false; end + if out1.x(1) ~= f1, atest = false; end + if out1.x(end) ~= f2, atest = false; end + if numel(out1.x) ~= nf, atest = false; end + if out2.x(1) ~= f1, atest = false; end + if out2.x(end) ~= f2, atest = false; end + if numel(out2.x) ~= nf, atest = false; end + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_11 + + %% UTP_12 + + % + % + % Check that the resp method uses the specified f1, f2, and nf to compute the response. + % + % + function result = utp_12 + + % + % + % Call the method with different method to pass f1, f2, and nf in. + % + % + + try + % + f1 = .1; + f2 = 5; + nf = 100; + nf2 = 123; + out1 = resp(pf3, f1, f2); + out2 = resp(pf3, f1, f2, nf); + out3 = resp(pf3, plist('f1', f1, 'f2', f2, 'nf', nf)); + out4 = resp(pf3, plist('f1', f1, 'nf', nf2)); + out5 = resp(pf3, plist('f2', f2)); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + mout5 = rebuild(out5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + T = 10e-12; + if stest + % + % Check the output + f1d = getlowerFreq(pf3)/10; + f2d = getupperFreq(pf3)*10; + nfd = find(pzmodel.getInfo('resp', 'Range').plists, 'nf'); + if ~isa(out1, 'ao'), atest = false; end + if ~isa(out2, 'ao'), atest = false; end + if ~isa(out3, 'ao'), atest = false; end + if ~isa(out4, 'ao'), atest = false; end + if ~isa(out5, 'ao'), atest = false; end + if out1.x(1) ~= f1, atest = false; end + if abs(out1.x(end)-f2)>T, atest = false; end + if numel(out1.x) ~= nfd, atest = false; end % Default values + if out2.x(1) ~= f1, atest = false; end + if abs(out2.x(end)-f2)>T, atest = false; end + if numel(out2.x) ~= nf, atest = false; end + if out3.x(1) ~= f1, atest = false; end + if abs(out3.x(end)-f2)>T, atest = false; end + if numel(out3.x) ~= nf, atest = false; end + if out4.x(1) ~= f1, atest = false; end + if abs(out4.x(end) - f2d) > T, atest = false; end % Default values + if numel(out4.x) ~= nf2, atest = false; end + if abs(out5.x(1) -f1d)>T, atest = false; end % Default values + if abs(out5.x(end)-f2)>T, atest = false; end + if numel(out5.x) ~= nfd, atest = false; end % Default values + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + if ~eq(out3, mout3, ple2), atest = false; end + if ~eq(out4, mout4, ple2), atest = false; end + if ~eq(out5, mout5, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Check that the resp method uses the specified f1, f2, and nf to compute + % the response. + % + % + function result = utp_13 + + % + % + % Call the method with different method to pass f1, f2, and nf in. + % + % + + try + % + f1 = .1; + f2 = 5; + nf = 123; + out1 = resp(pf3, plist('f1', f1, 'f2', f2, 'nf', nf, 'scale', 'lin')); + out2 = resp(pf3, plist('f1', f1, 'f2', f2, 'nf', nf, 'scale', 'log')); + out3 = resp(pf3, plist('scale', 'lin')); + out4 = resp(pf3, plist('scale', 'log')); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the output + f1d = getlowerFreq(pf3)/10; + f2d = getupperFreq(pf3)*10; + nfd = find(pzmodel.getInfo('resp', 'Range').plists, 'nf'); + if ~isa(out1, 'ao'), atest = false; end + if ~isa(out2, 'ao'), atest = false; end + if ~isa(out3, 'ao'), atest = false; end + if ~isa(out4, 'ao'), atest = false; end + xlin1 = linspace(f1, f2, nf); + xlin2 = linspace(f1d, f2d, nfd); + xlog1 = logspace(log10(f1), log10(f2), nf); + xlog2 = logspace(log10(f1d), log10(f2d), nfd); + if ~isequal(xlin1, out1.x'), atest = false; end + if ~isequal(xlin2, out3.x'), atest = false; end + if ~isequal(xlog1, out2.x'), atest = false; end + if ~isequal(xlog2, out4.x'), atest = false; end + + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + if ~eq(out3, mout3, ple2), atest = false; end + if ~eq(out4, mout4, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_save.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_save.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,649 @@ +% UTP_PARFRAC_SAVE a set of UTPs for the parfrac/save method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_save.m,v 1.7 2010/08/31 09:43:48 hewitson Exp $ +% + +% +% +% The save method of the parfrac class saves a parfrac object to disk. Save +% stores the variables in a MATLAB formatted file (MAT-file) named +% filename.mat or in a XML fromat named filename.xml +% +% + +function results = utp_parfrac_save(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'save'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PARFRAC objects + [pf1,pf2,pf3,pfv,pfm] = get_test_objects_parfrac; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test plist contains the filename + results = [results utp_09]; % Test with different complex PARFRAC objects + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(3).plists.isparam('filename'), atest = false; end + if ~io(3).plists.isparam('prefix'), atest = false; end + if ~io(3).plists.isparam('postfix'), atest = false; end + if ~io(3).plists.isparam('individual files'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('filename'), ''), atest = false; end + if ~isequal(io(3).plists.find('prefix'), ''), atest = false; end + if ~isequal(io(3).plists.find('postfix'), ''), atest = false; end + if ~isequal(io(3).plists.find('individual files'), false), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('filename'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the save method works with a vector of PARFRAC objects as input. + % + % + function result = utp_02 + + % + % + % Test that the save method works for a vector of PARFRAC objects as input. + % Test both formats 'xml' and 'mat'. + % + % + + try + % + save(pfv, 'test.xml'); + save(pfv, 'test.mat'); + out1 = parfrac('test.xml'); + out2 = parfrac('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the + % same as in 'pfv' + % 2) Check that the loaded objects are the same as the saved objects. + % 3) The outputs 'out1' and 'out2' must be the same. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(pfv)), atest = false; end + if ~isequal(size(out2), size(pfv)), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(pfv(kk), out1(kk), ple1), atest = false; end + if ~eq(pfv(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the save method works with a matrix of PARFRAC objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the save method works for a matrix of PARFRAC objects as + % input. Test both formats 'xml' and 'mat'. + % + % + + try + % + save(pfm, 'test.xml'); + save(pfm, 'test.mat'); + out1 = parfrac('test.xml'); + out2 = parfrac('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the + % same as in 'pfm' + % 2) Check that the loaded objects are the same as the saved objects. + % 3) The outputs 'out1' and 'out2' must be the same. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(pfm)), atest = false; end + if ~isequal(size(out2), size(pfm)), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(pfm(kk), out1(kk), ple1), atest = false; end + if ~eq(pfm(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the save method works with a list of PARFRAC objects as input. + % + % + function result = utp_04 + + % + % + % Test that the save method works for a list of PARFRAC objects as input. + % Test both formats 'xml' and 'mat'. + % + % + + try + % + save(pf1, pf2, pf3, 'test.xml'); + save(pf1, pf2, pf3, 'test.mat'); + out1 = parfrac('test.xml'); + out2 = parfrac('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the + % same as in the list + % 2) Check that the loaded objects are the same as the saved objects. + % 3) The outputs 'out1' and 'out2' must be the same. + % + % + + atest = true; + pfin = [pf1, pf2, pf3]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 3, atest = false; end + if numel(out2) ~= 3, atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(pfin(kk), out1(kk), ple1), atest = false; end + if ~eq(pfin(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the save method works with a mix of different shaped PARFRAC + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the save method works with an input of matrices and vectors + % and single PARFRAC objects. Test both formats 'xml' and 'mat'. + % + % + + try + % + save(pf1,pfv,pf2, 'test.xml'); + save(pf1,pfv,pf2, 'test.mat'); + out1 = parfrac('test.xml'); + out2 = parfrac('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output PARFRAC object contains the correct data. + % + % + + atest = true; + pfin = [pf1, reshape(pfv, 1, []), pf2]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 2+numel(pfv), atest = false; end + if numel(out2) ~= 2+numel(pfv), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(pfin(kk), out1(kk), ple1), atest = false; end + if ~eq(pfin(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the save method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the save method can be processed back + % to an m-file. Do this for both extensions 'mat' and 'xml' + % + % + + try + % + out1 = save(pf3, 'test.xml'); + out2 = save(pf2, 'test.mat'); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history applies to the output object. Check that + % save doesn't add a history step to the input object. + % 2) Check that the read object doesn't contain the save + load history steps. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % The last history step is the save method + if strcmp(out1.hist.methodInfo.mname, 'save'), atest = false; end + if strcmp(out2.hist.methodInfo.mname, 'save'), atest = false; end + % The histories must be the same + if ~eq(out1.hist, pf3.hist), atest = false; end + if ~eq(out2.hist, pf2.hist), atest = false; end + % check the history steps of the read object (load + save) + % The steps (save + load) shouldn't add history + outr1 = parfrac('test.xml'); + outr2 = parfrac('test.mat'); + if strcmp(outr1.hist, pf3.hist), atest = false; end + if strcmp(outr2.hist, pf2.hist), atest = false; end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + % delete test file + delete('test.xml') + delete('test.mat') + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the save method works with the modify command. + % + % + function result = utp_07 + + % + % + % Use the save method with the modifier command. + % + % + + try + % + % copy pf1 to work with + iir_mat = parfrac(pf1); + iir_mat.save('test.mat'); + iir_xml = parfrac(pf1); + iir_xml.save('test.xml'); + out1 = parfrac('test.mat'); + out2 = parfrac('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the save method doesn't apply the history. + % 2) Check the output against the input. + % 3) Check the history of the output against the input. + % + % + + atest = true; + if stest + % + % Check that the modified object doesn't have the 'save' method as + % the last history step + if strcmp(iir_xml.hist.methodInfo.mname, 'save'), atest = false; end + if strcmp(iir_mat.hist.methodInfo.mname, 'save'), atest = false; end + % Check the output + if ~eq(iir_mat, out1, ple1), atest = false; end + if ~eq(iir_xml, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the save method uses the filename which is stored in a plist. + % + % + + try + % + pl1 = plist('filename', 'test.mat'); + pl2 = plist('filename', 'test.xml'); + save(pf3, pl1); + save(pf3, pl2); + out1 = parfrac('test.mat'); + out2 = parfrac('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + % Check the output + if ~eq(pf3, out1, ple1), atest = false; end + if ~eq(pf3, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test the save method with different complex PARFRAC objects + % + % + function result = utp_09 + + % + % + % Test the save method with different complex PARFRAC objects + % + % + + try + % + pzm = pzmodel(1, [pz(1,1), pz(1+3i), pz(10)], [{[2 1],1, 5-2i}, 4, {3+3i}]); + r = rational([ 1 2 3], [2 -4 5]); + p1 = parfrac(pzm); + p2 = parfrac(r); + p3 = parfrac([1 2+1i 2-1i], [6 1+3i 1-3i], [1 2]); + + save(p1, 'test_p1.mat'); % highpass + save(p1, 'test_p1.xml'); % highpass + save(p2, 'test_p2.mat'); % lowpass + save(p2, 'test_p2.xml'); % lowpass + save(p3, 'test_p3.mat'); % bandpass + save(p3, 'test_p3.xml'); % bandpass + out1 = parfrac('test_p1.mat'); + out2 = parfrac('test_p1.xml'); + out3 = parfrac('test_p2.mat'); + out4 = parfrac('test_p2.xml'); + out5 = parfrac('test_p3.mat'); + out6 = parfrac('test_p3.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + % Check highpass + if ~eq(p1, out1, ple1), atest = false; end + if ~eq(p1, out2, ple1), atest = false; end + if ~eq(p2, out3, ple1), atest = false; end + if ~eq(p2, out4, ple1), atest = false; end + if ~eq(p3, out5, ple1), atest = false; end + if ~eq(p3, out6, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + if ~eq(out3, out4, ple2), atest = false; end + if ~eq(out5, out6, ple2), atest = false; end + % + delete('test_p1.mat'); + delete('test_p1.xml'); + delete('test_p2.mat'); + delete('test_p2.xml'); + delete('test_p3.mat'); + delete('test_p3.xml'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_setIunits.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_setIunits.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,568 @@ +% UTP_PARFRAC_SETIUNITS a set of UTPs for the parfrac/setIunits method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_setIunits.m,v 1.4 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The setIunits method of the parfrac class sets the iunits property. +% +% + +function results = utp_parfrac_setIunits(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'setIunits'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PARFRAC objects + [pf1,pf2,pf3,pfv,pfm] = get_test_objects_parfrac; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('iunits'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('iunits')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('iunits'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setIunits method works with a vector of PARFRAC objects + % as input. + % + % + function result = utp_02 + + % + % + % Test that the setIunits method works for a vector of PARFRAC objects + % as input. + % + % + + try + % + out = setIunits(pfv, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pfv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pfv)), atest = false; end + % Check iunits field of each output + for kk=1:numel(out) + if ~eq(out(kk).iunits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setIunits method works with a matrix of PARFRAC objects + % as input. + % + % + function result = utp_03 + + % + % + % Test that the setIunits method works for a matrix of PARFRAC objects + % as input. + % + % + + try + % + out = setIunits(pfm, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pfm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pfm)), atest = false; end + % Check iunits field of each output + for kk=1:numel(out) + if ~eq(out(kk).iunits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setIunits method works with a list of PARFRAC objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the setIunits method works for a list of PARFRAC objects as + % input. + % + % + + try + % + out = setIunits(pf1,pf2,pf3, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~eq(out(1).iunits, unit('Hz')), atest = false; end + if ~eq(out(2).iunits, unit('Hz')), atest = false; end + if ~eq(out(3).iunits, unit('Hz')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setIunits method works with a mix of different shaped + % PARFRAC objects as input. + % + % + function result = utp_05 + + % + % + % Test that the setIunits method works with an input of matrices and + % vectors and single PARFRAC objects. + % + % + + try + % + out = setIunits(pf1,pfv,pf2,pfm,pf3, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(pfm)+numel(pfv)), atest = false; end + for kk=1:numel(out) + if ~eq(out(kk).iunits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setIunits method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setIunits method can be + % processed back to an m-file. + % + % + + try + % + out1 = setIunits(pf3, unit('Hz')); + out2 = testCallerIsMethod(@setIunits, pf3, unit('Hz')); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setIunits'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setIunits'. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setIunits') && ... + eq(out1.hist.plistUsed, plist('iunits', unit('Hz')), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('iunits', unit('Hz')), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple1), atest = false; end + e = ple1.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'iunits'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setIunits method can modify the input PARFRAC object. + % + % + function result = utp_07 + + % + % + % Test that the setIunits method can modify the input PARFRAC object + % by calling with no output. + % + % + + try + % + % copy pf3 to work with + ain = parfrac(pf3); + % modify ain + aout = ain.setIunits(unit('Hz')); + ain.setIunits(unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'pf3' and 'ain' are now different. + % 2) Check that 'ain' has the correct iunits field + % + % + + atest = true; + if stest + % + % Check that setIunits modified the input by comparing to the copy + if eq(parfrac(pf3), ain, ple1), atest = false; end + % Check that setIunits doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~eq(ain.iunits, unit('Hz')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setIunits method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setIunits method can modify the property 'iunits' + % with a value in a plist. + % + % + + try + % + pl = plist('iunits', unit('Hz')); + out = pf3.setIunits(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct iunits field + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'iunits' + if ~eq(out.iunits, unit('Hz')), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setIunits method pass back the output objects to a list + % of output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [o1, o2] = setIunits(pf3, pf2, unit('mol')); + o3 = setIunits(pf3, pf2, unit('mol')); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_setName.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_setName.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,568 @@ +% UTP_PARFRAC_SETNAME a set of UTPs for the parfrac/setName method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_setName.m,v 1.4 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The setName method of the parfrac class sets the name property. +% +% + +function results = utp_parfrac_setName(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'setName'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PARFRAC objects + [pf1,pf2,pf3,pfv,pfm] = get_test_objects_parfrac; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('name'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('name')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('name'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setName method works with a vector of PARFRAC objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the setName method works for a vector of PARFRAC objects as + % input. + % + % + + try + % + out = setName(pfv, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pfv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pfv)), atest = false; end + % Check name field of each output + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setName method works with a matrix of PARFRAC objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the setName method works for a matrix of PARFRAC objects as + % input. + % + % + + try + % + out = setName(pfm, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pfm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pfm)), atest = false; end + % Check name field of each output + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setName method works with a list of PARFRAC objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the setName method works for a list of PARFRAC objects as + % input. + % + % + + try + % + out = setName(pf1,pf2,pf3, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~strcmp(out(1).name, 'my name'), atest = false; end + if ~strcmp(out(2).name, 'my name'), atest = false; end + if ~strcmp(out(3).name, 'my name'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setName method works with a mix of different shaped + % PARFRAC objects as input. + % + % + function result = utp_05 + + % + % + % Test that the setName method works with an input of matrices and + % vectors and single PARFRAC objects. + % + % + + try + % + out = setName(pf1,pfv,pf2,pfm,pf3, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(pfm)+numel(pfv)), atest = false; end + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setName method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setName method can be processed + % back to an m-file. + % + % + + try + % + out1 = setName(pf3, 'my name'); + out2 = testCallerIsMethod(@setName, pf3, 'my name'); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setName'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setName'. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setName') && ... + eq(out1.hist.plistUsed, plist('name', 'my name'), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('name', 'my name'), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple1), atest = false; end + e = ple1.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'name'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setName method can modify the input PARFRAC object. + % + % + function result = utp_07 + + % + % + % Test that the setName method can modify the input PARFRAC object + % by calling with no output. + % + % + + try + % + % copy pf3 to work with + ain = parfrac(pf3); + % modify ain + aout = ain.setName('my name'); + ain.setName('my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'pf3' and 'ain' are now different. + % 2) Check that 'ain' has the correct name field + % + % + + atest = true; + if stest + % + % Check that setName modified the input by comparing to the copy + if eq(parfrac(pf3), ain, ple1), atest = false; end + % Check that setName doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~strcmp(ain.name, 'my name'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setName method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setName method can modify the property 'name' + % with a value in a plist. + % + % + + try + % + pl = plist('name', 'my name'); + out = pf3.setName(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct name field + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'name' + if ~strcmp(out.name, 'my name'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setName method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [o1, o2] = setName(pf3, pf2, 'new name'); + o3 = setName(pf3, pf2, 'new name'); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_setOunits.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_setOunits.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,568 @@ +% UTP_PARFRAC_SETOUNITS a set of UTPs for the parfrac/setOunits method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_setOunits.m,v 1.4 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The setOunits method of the parfrac class sets the ounits property. +% +% + +function results = utp_parfrac_setOunits(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'setOunits'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PARFRAC objects + [pf1,pf2,pf3,pfv,pfm] = get_test_objects_parfrac; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('ounits'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('ounits')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('ounits'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setOunits method works with a vector of PARFRAC objects + % as input. + % + % + function result = utp_02 + + % + % + % Test that the setOunits method works for a vector of PARFRAC objects + % as input. + % + % + + try + % + out = setOunits(pfv, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pfv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pfv)), atest = false; end + % Check ounits field of each output + for kk=1:numel(out) + if ~eq(out(kk).ounits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setOunits method works with a matrix of PARFRAC objects + % as input. + % + % + function result = utp_03 + + % + % + % Test that the setOunits method works for a matrix of PARFRAC objects + % as input. + % + % + + try + % + out = setOunits(pfm, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pfm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pfm)), atest = false; end + % Check ounits field of each output + for kk=1:numel(out) + if ~eq(out(kk).ounits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setOunits method works with a list of PARFRAC objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the setOunits method works for a list of PARFRAC objects as + % input. + % + % + + try + % + out = setOunits(pf1,pf2,pf3, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~eq(out(1).ounits, unit('Hz')), atest = false; end + if ~eq(out(2).ounits, unit('Hz')), atest = false; end + if ~eq(out(3).ounits, unit('Hz')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setOunits method works with a mix of different shaped + % PARFRAC objects as input. + % + % + function result = utp_05 + + % + % + % Test that the setOunits method works with an input of matrices and + % vectors and single PARFRAC objects. + % + % + + try + % + out = setOunits(pf1,pfv,pf2,pfm,pf3, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(pfm)+numel(pfv)), atest = false; end + for kk=1:numel(out) + if ~eq(out(kk).ounits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setOunits method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setOunits method can be + % processed back to an m-file. + % + % + + try + % + out1 = setOunits(pf3, unit('Hz')); + out2 = testCallerIsMethod(@setOunits, pf3, unit('Hz')); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setOunits'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setOunits'. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setOunits') && ... + eq(out1.hist.plistUsed, plist('ounits', unit('Hz')), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('ounits', unit('Hz')), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple1), atest = false; end + e = ple1.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'ounits'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setOunits method can modify the input PARFRAC object. + % + % + function result = utp_07 + + % + % + % Test that the setOunits method can modify the input PARFRAC object + % by calling with no output. + % + % + + try + % + % copy pf3 to work with + ain = parfrac(pf3); + % modify ain + aout = ain.setOunits(unit('Hz')); + ain.setOunits(unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'pf3' and 'ain' are now different. + % 2) Check that 'ain' has the correct ounits field + % + % + + atest = true; + if stest + % + % Check that setOunits modified the input by comparing to the copy + if eq(parfrac(pf3), ain, ple1), atest = false; end + % Check that setOunits doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~eq(ain.ounits, unit('Hz')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setOunits method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setOunits method can modify the property 'ounits' + % with a value in a plist. + % + % + + try + % + pl = plist('ounits', unit('Hz')); + out = pf3.setOunits(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct ounits field + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'ounits' + if ~eq(out.ounits, unit('Hz')), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setOunits method pass back the output objects to a list + % of output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [o1, o2] = setOunits(pf3, pf2, unit('mol')); + o3 = setOunits(pf3, pf2, unit('mol')); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_string.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_string.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,435 @@ +% UTP_PARFRAC_STRING a set of UTPs for the parfrac/string method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_string.m,v 1.5 2011/04/04 13:39:11 ingo Exp $ +% + +% +% +% The string method of the parfrac class writes a command string that can +% be used to recreate the input object(s). But the object should not have +% more than one history step. +% +% + +function results = utp_parfrac_string(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'string'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + pf1 = parfrac([1 2], [4, 6+2i]); + pf2 = parfrac([-3 6 7], [2 3-4i 3+4i], [1 -4.5]); + pfv = [pf1, pf2, pf1]; + pfm = [pf1, pf2, pf1; pf1, pf2, pf1]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Negative test: The object have more than one history step. + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the string method works with a vector of PARFRAC objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the string method works for a vector of PARFRAC objects as + % input. + % + % + + try + % + out = string(pfv); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end; + if ~isa(rout, 'parfrac'), atest = false; end + if numel(rout) ~= numel(pfv), atest = false; end + for kk = 1:numel(pfv) + if eq(rout(kk), pfv(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the string method works with a matrix of PARFRAC objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the string method works for a matrix of PARFRAC objects as + % input. + % + % + + try + % + out = string(pfm); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'parfrac'), atest = false; end + if numel(rout) ~= numel(pfm), atest = false; end + for kk = 1:numel(pfm) + if eq(rout(kk), pfm(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the string method works with a list of PARFRAC objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the string method works for a list of PARFRAC objects as + % input. + % + % + + try + % + out = string(pf1,pf2); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + pfin = [pf1, pf2]; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'parfrac'), atest = false; end + if numel(rout) ~= numel(pfin), atest = false; end + for kk = 1:numel(pfin) + if eq(rout(kk), pfin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the string method works with a mix of different shaped + % PARFRAC objects as input. + % + % + function result = utp_05 + + % + % + % Test that the string method works with an input of matrices and + % vectors and single PARFRAC objects. + % + % + + try + % + out = string(pf1,pfm,pf2); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + pfin = [pf1, reshape(pfm, 1, []), pf2]; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'parfrac'), atest = false; end + if numel(rout) ~= numel(pfin), atest = false; end + for kk = 1:numel(pfin) + if eq(rout(kk), pfin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the string method properly applies history. + % + % + function result = utp_06 + + % + % + % The method string doesn't change the data, thus it is not possible to + % check the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the string method doesn't work if the PARFRAC object have + % more than one history step. + % + % + function result = utp_07 + + % + % + % The method string throws an error because the input object have more + % than one history step. + % + % + + try + % + pzm = pzmodel(12, {2, [3 5], 7}, {1+2i 5}); + pf3 = parfrac(pzm); + pf3.setName('Second history step'); + out = pf3.string(); + % + stest = false; + catch err + stest = true; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_submit.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_submit.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,528 @@ +% UTP_PARFRAC_SUBMIT a set of UTPs for the parfrac/submit method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_submit.m,v 1.14 2010/08/18 09:25:55 ingo Exp $ +% + +% +% +% The bsubmit method of the parfrac class submits a collection of objects +% in XML form to an LTPDA Repository. The type of the objects are +% independent. +% +% + +function results = utp_parfrac_submit(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'submit'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + [pf1,pf2,pf3,pfv,pfm] = get_test_objects_parfrac; + plForAutoTest = plist('no dialog', true, 'use selector', false); + + try + conn = utpGetConnection(); + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_parfrac_submit: submit parfrac'; + sinfo.experiment_description = 'utp_parfrac_submit: description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test output of the data + catch + end + + % Close connection + utpCloseConnection(conn) + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 16, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('sinfo filename'), atest = false; end + if ~io(3).plists.isparam('binary'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isEmptyChar(io(3).plists.find('sinfo filename')), atest = false; end + if ~isequal(io(3).plists.find('binary'), false), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the submit method works with a vector of PARFRAC objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the submit method works for a vector of PARFRAC objects as + % input. + % + % + + try + % + [ids, cids] = submit(pfv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + robjs3 = ltpda_uo.retrieve(conn, ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(pfv), atest = false; end + if numel(robjs2) ~= numel(pfv), atest = false; end + if numel(robjs3) ~= numel(pfv), atest = false; end + % Check the retrieved object against the submitted + if ~eq(pfv, [robjs1{:}]), atest = false; end + if ~eq(pfv, [robjs2{:}]), atest = false; end + if ~eq(pfv, [robjs3{:}]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the submit method works with a matrix of PARFRAC objects as + % input. + % + % + function result = utp_03 + + % + % + % Tests that the submit method works with a matrix of PARFRAC objects + % as input. + % + % + + try + % + [ids, cids] = submit(pfm, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + robjs3 = ltpda_uo.retrieve(conn, ids(1), ids(2), ids(3), ids(4), ids(5), ids(6)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(pfm), atest = false; end + if numel(robjs2) ~= numel(pfm), atest = false; end + if numel(robjs3) ~= numel(pfm), atest = false; end + % Check the retrieved object against the submitted + if ~eq(pfm, reshape([robjs1{:}], size(pfm))), atest = false; end + if ~eq(pfm, reshape([robjs2{:}], size(pfm))), atest = false; end + if ~eq(pfm, reshape([robjs3{:}], size(pfm))), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the submit method works with a list of PARFRAC objects as + % input. + % + % + function result = utp_04 + + % + % + % Tests that the submit method works with a list of PARFRAC objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = submit(pf1, pl, iir, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + robjs3 = ltpda_uo.retrieve(conn, ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 3, atest = false; end + if numel(robjs2) ~= 3, atest = false; end + if numel(robjs3) ~= 3, atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, pf1), atest = false; end + if ~eq(robjs1{3}, pl), atest = false; end + if ~eq(robjs1{2}, iir), atest = false; end + % Check robjs2 + if ~eq(robjs2{1}, pf1), atest = false; end + if ~eq(robjs2{3}, pl), atest = false; end + if ~eq(robjs2{2}, iir), atest = false; end + % Check robjs3 + if ~eq(robjs3{1}, pf1), atest = false; end + if ~eq(robjs3{3}, pl), atest = false; end + if ~eq(robjs3{2}, iir), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the abs method works with a mix of different shaped PARFRAC + % objects as input. + % + % + function result = utp_05 + + % + % + % Tests that the submit method works with a list of PARFRAC objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = submit(pl, pfm, iir, pfv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 2 + numel(pfm) + numel(pfv), atest = false; end + if numel(robjs2) ~= 2 + numel(pfm) + numel(pfv), atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, pfm(1)), atest = false; end + if ~eq(robjs1{2}, pfm(2)), atest = false; end + if ~eq(robjs1{3}, pfm(3)), atest = false; end + if ~eq(robjs1{4}, pfm(4)), atest = false; end + if ~eq(robjs1{5}, pfm(5)), atest = false; end + if ~eq(robjs1{6}, pfm(6)), atest = false; end + if ~eq(robjs1{7}, iir), atest = false; end + if ~eq(robjs1{8}, pfv(1)), atest = false; end + if ~eq(robjs1{9}, pfv(2)), atest = false; end + if ~eq(robjs1{10}, pfv(3)), atest = false; end + if ~eq(robjs1{11}, pl), atest = false; end + % Check robjs2 + if ~isequalwithequalnans(robjs1, robjs2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tthe submit method properly applies history. + % + % + function result = utp_06 + + % + % + % Tthe submit method properly applies history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the submit method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [ids, cids] = submit(pf1, pf2, sinfo, plForAutoTest); + + [o1, o2] = ltpda_uo.retrieve(conn, 'Collection', cids); + o3 = ltpda_uo.retrieve(conn, 'Collection', cids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the output + if ~eq(o1, pf1), atest = false; end + if ~eq(o2, pf2), atest = false; end + if ~eq(o3{1}, pf1), atest = false; end + if ~eq(o3{2}, pf2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_type.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_type.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,401 @@ +% UTP_PARFRAC_TYPE a set of UTPs for the parfrac/type method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_type.m,v 1.2 2009/07/23 16:45:24 ingo Exp $ +% + +% +% +% The type method of the parfrac class converts the input objects to +% MATLAB functions that reproduce the processing steps that led to the +% input objects. +% +% + +function results = utp_parfrac_type(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'type'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PARFRAC objects + [pf1,pf2,pf3,pfv,pfm] = get_test_objects_parfrac; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % DEfine the filename + filename = 'test_parfrac_type.m'; + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('filename'), atest = false; end + if ~io(3).plists.isparam('stop_option'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('filename')), atest = false; end + if ~isequal(io(3).plists.find('stop_option'), 'full'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('filename'), {''}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('stop_option'), {'full', 'File', 'Repo', 'File Repo', 'N'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the type method works with a vector of PARFRAC objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the type method works for a vector of PARFRAC objects as + % input. + % + % + + try + % + type(pfv, filename); + type(pfv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + if ~eq(pfv, mout, ple2), atest = false; end; + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the type method works with a matrix of PARFRAC objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the type method works for a matrix of PARFRAC objects as + % input. + % + % + + try + % + type(pfm, filename); + type(pfm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + % Type doesn't keep the shape + for ii = 1:numel(pfm) + if ~eq(pfm(ii), mout(ii), ple2), atest = false; end; + end + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the type method works with a list of PARFRAC objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the type method works for a list of PARFRAC objects as + % input. + % + % + + try + % + type(pf1,pf2,pf3, filename); + type(pf1,pf2,pf3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + pfin = [pf1,pf2,pf3]; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + % Type doesn't keep the shape + for ii = 1:numel(pfin) + if ~eq(pfin(ii), mout(ii), ple2), atest = false; end; + end + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the type method works with a mix of different shaped PARFRAC + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the type method works with an input of matrices and vectors + % and single PARFRAC objects. + % + % + + try + % + type(pf1,pfv,pf2,pfm,pf3, filename); + type(pf1,pfv,pf2,pfm,pf3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + pfin = [pf1,reshape(pfv,1,[]),pf2,reshape(pfm,1,[]),pf3]; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + % Type doesn't keep the shape + for ii = 1:numel(pfin) + if ~eq(pfin(ii), mout(ii), ple2), atest = false; end; + end + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the type method properly applies history. + % + % + function result = utp_06 + + % + % + % The method type doesn't change the data, thus it is not possible to + % check the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/parfrac/utp_parfrac_update.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/parfrac/utp_parfrac_update.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,387 @@ +% UTP_PARFRAC_UPDATE a set of UTPs for the parfrac/update method +% +% M Hewitson 06-08-08 +% +% $Id: utp_parfrac_update.m,v 1.13 2010/08/18 09:25:55 ingo Exp $ +% + +% +% +% The update method of the parfrac class updates (replace) an LTPDA object +% in the repository with the given replacement object. It is only possible +% to update one object. This is the reason why the general UTPs are not +% possible. +% +% + +function results = utp_parfrac_update(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'parfrac'; + mthd = 'update'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + obj = parfrac([1 2+1i 2-1i], [6 1+3i 1-3i], [1 2 3 4], 'my par frac', unit('V'), unit('Hz')); + obj.setName(); + + plForAutoTest = plist('no dialog', true, 'use selector', false); + try + conn = utpGetConnection(); + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_parfrac_update: update parfrac'; + sinfo.experiment_description = 'utp_parfrac_update: description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + [ids, cids] = submit(obj, sinfo, plForAutoTest); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Test with conn + results = [results utp_03]; % Test with sinfo + results = [results utp_04]; % Test update of an binary file + results = [results utp_05]; % Test replace with other object + catch + end + + % Close connection + utpCloseConnection(conn) + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 15, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('binary'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isequal(io(3).plists.find('binary'), false), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_02 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Use a database object (conn) to establish the connection. + % + % + + try + % + % Make some changes to the object. + uobj = obj.setName('I was updated (conn)'); + update(uobj, ids, conn, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_03 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Use a database info structure (sinfo) to establish the connection. + % + % + + try + % + % Make some changes to the object. + uobj = obj.setName('I was updated (sinfo)'); + update(uobj, ids, sinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_04 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Check that the update method also updates objects which are stored as + % a binary file. + % + % + + try + % + % Submit the object as a binary + [ids_bin, cids] = bsubmit(obj, sinfo, plForAutoTest); + % Make some changes to the object. + uobj = obj.setName('I was updated (sinfo)'); + update(uobj, ids_bin, sinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids_bin' + robj = ltpda_uo.retrieve(conn, ids_bin); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the update method replaces the object in the repository with + % a completely other object. + % + % + function result = utp_05 + + % + % + % Tests that the update method replaces the object in the repository + % with a completely other object. + % Replace the parfrac object with a filter object. + % + % + + try + % + % Make some changes to the object. + uobj = miir(plist('type', 'lowpass')); + update(uobj, ids, sinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pest/utp_pest_copy.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pest/utp_pest_copy.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,50 @@ +% UTP_PEST_COPY a set of UTPs for the pest/copy method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pest_copy.m,v 1.1 2010/02/07 15:11:03 ingo Exp $ +% + +% +% +% The copy method of the pest class copies the input object depending of the +% second input. +% +% + +function results = utp_pest_copy(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pest'; + mthd = 'copy'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_69(class, 1, 1, ple2)]; + results = [results utp_69(class, 1, 3, ple2)]; + results = [results utp_69(class, 2, 3, ple2)]; + + 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 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pest/utp_pest_loadobj.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pest/utp_pest_loadobj.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,153 @@ +% UTP_PEST_LOADOBJ a set of UTPs for the pest/loadobj method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pest_loadobj.m,v 1.1 2010/05/12 15:58:16 ingo Exp $ +% + +% +% +% The loadobj method of the pest class will be automatically called by +% MATLAB if an older object is not compatible with the current object structure. +% This happens only for objects which are stored as a MATLAB formatted +% (MAT-file). The load mechanism for XML formated files calls always the +% 'update_struct' method to keep the stored objects up to date. The +% 'update_struct' method convert the read object structure to the object +% structure which is used in the currend LTPDA version. +% This UTP will load old objects which are stored with an older LTPDA version. +% +% REMARK: Since LTPDA version 1.9.2 will be an object which should be saved as a +% MAT file stored as a struct and not as the object. +% +% + +function results = utp_pest_loadobj(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pest'; + mthd = 'loadobj'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Run the tests + results = [results utp_01]; % getInfo call + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Get all .MAT and .XML files + path = fullfile(fileparts(which(mfilename)), '..', '..', 'utp_test_files'); + + matfiles = utils.prog.filescan(path, '.mat'); + xmlfiles = utils.prog.filescan(path, '.xml'); + + % Load .MAT files + obj_no = 1; + for ii=1:numel(matfiles) + fn = matfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = pest(fn); + obj_no = obj_no+1; + end + end + + % Load .XML files + for ii=1:numel(xmlfiles) + fn = xmlfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = pest(fn); + obj_no = obj_no+1; + end + end + % + stest = true; + catch err + disp(objs(obj_no).fname) + disp(fn) + disp(err.message) + stest = false; + end + + % + % + % 1) Check the shape of the loaded objects. + % + % + + atest = true; + if stest + % + for ii = 1:numel(objs) + obj = objs(ii).obj; + fname = objs(ii).fname; + + if ~isempty(strfind(fname, '_vec')) + % Loaded object must be a vector + if ~isvector(obj), atest = false; end + elseif ~isempty(strfind(fname, '_mat')) + % Loaded object must be a matrix + % REMARK: Known error in LTPDA version 1.9.2 + % A saved matrix doesn't keep the shape of the matrix. + if isempty(strfind(fname, '_192')) + if ~(size(obj,1) > 1 && size(obj,2) > 1), atest = false; end + end + else + % Loaded object must be a single object + if ~(size(obj,1) == 1 && size(obj,2) == 1), + atest = false; end + end + + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pest/utp_pest_pest.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pest/utp_pest_pest.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,203 @@ +% UTP_PEST_PEST a set of UTPs for the pest/pest method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pest_pest.m,v 1.3 2011/08/22 05:37:13 hewitson Exp $ +% + +% +% +% The pest method of the pest class constructs pest objects. +% +% + +function results = utp_pest_pest(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pest'; + mthd = 'pest'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test objects + pe1 = pest([8, 9]); + pe1.setName; + pe2 = pest([1 2]); + pe2.setName; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the general tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, [pe1 pe2 pe1], [], [], ple3)]; % Vector input + results = [results utp_03(mthd, [pe1 pe2 pe1; pe2 pe2 pe1], [], [], ple3)]; % Matrix input + results = [results utp_04(mthd, pe1, pe2, pe1, [], [], ple3)]; % List input + results = [results utp_05(mthd, pe1, [pe1 pe2], [pe1 pe2 pe1; pe2 pe2 pe1], [], [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, pe1, [], ple2)]; % Test history is working + % constructor specific tests + results = [results utp_60(class, pe1, ple2)]; % Test history is properly handled with MAT file constructor + results = [results utp_61(class, pe1, ple2)]; % Test history is properly handled with XML file constructor + results = [results utp_62(class, pe1, pe2, ple2)]; % Test history is working with struct constructor + results = [results utp_64(class, pe1, ple2, ple2)]; % Test history is working with plist(filename) constructor + results = [results utp_65(class, pe2, ple3)]; % Test history is working with plist(hostname) constructor + results = [results utp_68(class, pe1, ple3)]; % Test history is working with conn+Id constructor + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From MAT File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From XML File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Repository')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Built-in Model')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Values')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + pn = 3; + if io(pn).plists.nparams ~= 3, atest = false; end + % Check key + % Check default value + % Check options + %%%%%%%%%% SET 'From MAT File' + pn = 4; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + %%%%%%%%%% SET 'From XML File' + pn = 5; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + %%%%%%%%%% SET 'From Repository' + pn = 6; + if io(pn).plists.nparams ~= 10, atest = false; end + % Check key + if ~io(pn).plists.isparam('hostname'), atest = false; end + if ~io(pn).plists.isparam('id'), atest = false; end + if ~io(pn).plists.isparam('cid'), atest = false; end + if ~io(pn).plists.isparam('database'), atest = false; end + if ~io(pn).plists.isparam('binary'), atest = false; end + if ~io(pn).plists.isparam('username'), atest = false; end + if ~io(pn).plists.isparam('password'), atest = false; end + % Check default value + if ~isEmptyDouble(io(pn).plists.find('id')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('cid')), atest = false; end + if ~isequal(io(pn).plists.find('binary'), 'yes'), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('id'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('cid'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('binary'), {'yes', 'no'}), atest = false; end + %%%%%%%%%% SET 'From Built-in Model' + pn = 7; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('BUILT-IN'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('built-in')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('built-in'), {''}), atest = false; end + %%%%%%%%%% SET 'From Expression' + pn = 8; + if io(pn).plists.nparams ~= 12, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('y'), atest = false; end + if ~io(pn).plists.isparam('paramnames'), atest = false; end + if ~io(pn).plists.isparam('dy'), atest = false; end + if ~io(pn).plists.isparam('cov'), atest = false; end + if ~io(pn).plists.isparam('chi2'), atest = false; end + if ~io(pn).plists.isparam('dof'), atest = false; end + if ~io(pn).plists.isparam('models'), atest = false; end + if ~io(pn).plists.isparam('pdf'), atest = false; end + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pest/utp_pest_setChain.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pest/utp_pest_setChain.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,108 @@ +% UTP_PEST_SETCHAIN a set of UTPs for the pest/setChain method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pest_setChain.m,v 1.3 2011/04/06 19:14:54 ingo Exp $ +% + +% +% +% The setChain method of the pest class sets the chain property. +% +% + +function results = utp_pest_setChain(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pest'; + mthd = 'setChain'; + prop = 'chain'; + + 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 = 11; + val2 = plist(prop, 12); + + % 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_genericAnyShapeInternal(mthd, pev, val1, @algoTestsInternal); % test internal vector call + results(5) = utp_genericAnyShape(mthd, pem, val1, @algoTests); % test matrix call + results(6) = utp_genericAnyShape(mthd, pem, val2, @algoTests); % test matrix call with plist + results(7) = utp_genericAnyShapeInternal(mthd, pem, val1, @algoTestsInternal); % test internal matrix call + results(8) = utp_genericList(mthd, pe1, pe2, pe3, val1, @algoTests); % test list + results(9) = utp_genericList(mthd, pe1, pe2, pe3, val2, @algoTests); % test list with plist + results(10) = utp_genericList(mthd, pe1, pev, pem, val1, @algoTests); % test mixed shape of input objs + results(11) = utp_genericHistory(mthd, pe1, val1, ple2); % test the history + results(12) = utp_genericModify(mthd, pe1, val1, @algoTests, ple1); % test the modifier call + results(13) = 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 'chain' + 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 'chain' 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), value.find(prop)), atest = false; end + else + if ~isequal(out(idx).(prop), 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 'chain' 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), value), atest = false; end + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pest/utp_pest_setChi2.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pest/utp_pest_setChi2.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,109 @@ +% UTP_PEST_SETCHI2 a set of UTPs for the pest/setChi2 method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pest_setChi2.m,v 1.3 2011/04/06 19:14:54 ingo Exp $ +% + +% +% +% The setChi2 method of the pest class sets the chi2 property. +% +% + +function results = utp_pest_setChi2(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pest'; + mthd = 'setChi2'; + prop = 'chi2'; + + 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 = 11; + val2 = plist(prop, 12); + + % 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_genericAnyShapeInternal(mthd, pev, val1, @algoTestsInternal); % test internal vector call + results(5) = utp_genericAnyShape(mthd, pem, val1, @algoTests); % test matrix call + results(6) = utp_genericAnyShape(mthd, pem, val2, @algoTests); % test matrix call with plist + results(7) = utp_genericAnyShapeInternal(mthd, pem, val1, @algoTestsInternal); % test internal matrix call + results(8) = utp_genericList(mthd, pe1, pe2, pe3, val1, @algoTests); % test list + results(9) = utp_genericList(mthd, pe1, pe2, pe3, val2, @algoTests); % test list with plist + results(10) = utp_genericList(mthd, pe1, pev, pem, val1, @algoTests); % test mixed shape of input objs + results(11) = utp_genericHistory(mthd, pe1, val1, ple2); % test the history + results(12) = utp_genericModify(mthd, pe1, val1, @algoTests, ple1); % test the modifier call + results(13) = 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 'chi2' + 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 'chi2' 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), value.find(prop)), atest = false; end + else + if ~isequal(out(idx).(prop), 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 'chi2' 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), value), atest = false; end + end + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pest/utp_pest_setCorr.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pest/utp_pest_setCorr.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,109 @@ +% UTP_PEST_SETCORR a set of UTPs for the pest/setCorr method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pest_setCorr.m,v 1.3 2011/04/06 19:14:54 ingo Exp $ +% + +% +% +% The setCorr method of the pest class sets the corr property. +% +% + +function results = utp_pest_setCorr(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pest'; + mthd = 'setCorr'; + prop = 'corr'; + + 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 = magic(2); + val2 = plist(prop, magic(3)); + + % 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_genericAnyShapeInternal(mthd, pev, val1, @algoTestsInternal); % test internal vector call + results(5) = utp_genericAnyShape(mthd, pem, val1, @algoTests); % test matrix call + results(6) = utp_genericAnyShape(mthd, pem, val2, @algoTests); % test matrix call with plist + results(7) = utp_genericAnyShapeInternal(mthd, pem, val1, @algoTestsInternal); % test internal matrix call + results(8) = utp_genericList(mthd, pe1, pe2, pe3, val1, @algoTests); % test list + results(9) = utp_genericList(mthd, pe1, pe2, pe3, val2, @algoTests); % test list with plist + results(10) = utp_genericList(mthd, pe1, pev, pem, val1, @algoTests); % test mixed shape of input objs + results(11) = utp_genericHistory(mthd, pe1, val1, ple2); % test the history + results(12) = utp_genericModify(mthd, pe1, val1, @algoTests, ple1); % test the modifier call + results(13) = 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 'corr' + 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 'corr' 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), value.find(prop)), atest = false; end + else + if ~isequal(out(idx).(prop), 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 'corr' 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), value), atest = false; end + end + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pest/utp_pest_setCov.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pest/utp_pest_setCov.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,109 @@ +% UTP_PEST_SETCOV a set of UTPs for the pest/setCov method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pest_setCov.m,v 1.3 2011/04/06 19:14:54 ingo Exp $ +% + +% +% +% The setCov method of the pest class sets the cov property. +% +% + +function results = utp_pest_setCov(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pest'; + mthd = 'setCov'; + prop = 'cov'; + + 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 = magic(2); + val2 = plist(prop, rand(2,2)); + + % 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_genericAnyShapeInternal(mthd, pev, val1, @algoTestsInternal); % test internal vector call + results(5) = utp_genericAnyShape(mthd, pem, val1, @algoTests); % test matrix call + results(6) = utp_genericAnyShape(mthd, pem, val2, @algoTests); % test matrix call with plist + results(7) = utp_genericAnyShapeInternal(mthd, pem, val1, @algoTestsInternal); % test internal matrix call + results(8) = utp_genericList(mthd, pe1, pe2, pe3, val1, @algoTests); % test list + results(9) = utp_genericList(mthd, pe1, pe2, pe3, val2, @algoTests); % test list with plist + results(10) = utp_genericList(mthd, pe1, pev, pem, val1, @algoTests); % test mixed shape of input objs + results(11) = utp_genericHistory(mthd, pe1, val1, ple2); % test the history + results(12) = utp_genericModify(mthd, pe1, val1, @algoTests, ple1); % test the modifier call + results(13) = 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 'cov' + 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 'cov' 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), value.find(prop)), atest = false; end + else + if ~isequal(out(idx).(prop), 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 'cov' 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), value), atest = false; end + end + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pest/utp_pest_setDof.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pest/utp_pest_setDof.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,109 @@ +% UTP_PEST_SETDOF a set of UTPs for the pest/setDof method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pest_setDof.m,v 1.3 2011/04/06 19:14:54 ingo Exp $ +% + +% +% +% The setDof method of the pest class sets the dof property. +% +% + +function results = utp_pest_setDof(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pest'; + mthd = 'setDof'; + prop = 'dof'; + + 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 = 11; + val2 = plist(prop, 12); + + % 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_genericAnyShapeInternal(mthd, pev, val1, @algoTestsInternal); % test internal vector call + results(5) = utp_genericAnyShape(mthd, pem, val1, @algoTests); % test matrix call + results(6) = utp_genericAnyShape(mthd, pem, val2, @algoTests); % test matrix call with plist + results(7) = utp_genericAnyShapeInternal(mthd, pem, val1, @algoTestsInternal); % test internal matrix call + results(8) = utp_genericList(mthd, pe1, pe2, pe3, val1, @algoTests); % test list + results(9) = utp_genericList(mthd, pe1, pe2, pe3, val2, @algoTests); % test list with plist + results(10) = utp_genericList(mthd, pe1, pev, pem, val1, @algoTests); % test mixed shape of input objs + results(11) = utp_genericHistory(mthd, pe1, val1, ple2); % test the history + results(12) = utp_genericModify(mthd, pe1, val1, @algoTests, ple1); % test the modifier call + results(13) = 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 'dof' + 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 'dof' 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), value.find(prop)), atest = false; end + else + if ~isequal(out(idx).(prop), 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 'dof' 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), value), atest = false; end + end + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pest/utp_pest_setDy.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pest/utp_pest_setDy.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,109 @@ +% UTP_PEST_SETDY a set of UTPs for the pest/setDy method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pest_setDy.m,v 1.3 2011/04/06 19:14:54 ingo Exp $ +% + +% +% +% The setDy method of the pest class sets the dy property. +% +% + +function results = utp_pest_setDy(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pest'; + mthd = 'setDy'; + prop = 'dy'; + + 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 = [0 0]; + val2 = plist(prop, [1 2]); + + % 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_genericAnyShapeInternal(mthd, pev, val1, @algoTestsInternal); % test internal vector call + results(5) = utp_genericAnyShape(mthd, pem, val1, @algoTests); % test matrix call + results(6) = utp_genericAnyShape(mthd, pem, val2, @algoTests); % test matrix call with plist + results(7) = utp_genericAnyShapeInternal(mthd, pem, val1, @algoTestsInternal); % test internal matrix call + results(8) = utp_genericList(mthd, pe1, pe2, pe3, val1, @algoTests); % test list + results(9) = utp_genericList(mthd, pe1, pe2, pe3, val2, @algoTests); % test list with plist + results(10) = utp_genericList(mthd, pe1, pev, pem, val1, @algoTests); % test mixed shape of input objs + results(11) = utp_genericHistory(mthd, pe1, val1, ple2); % test the history + results(12) = utp_genericModify(mthd, pe1, val1, @algoTests, ple1); % test the modifier call + results(13) = 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 'dy' + 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 'dy' 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), reshape(value.find(prop), [], 1)), atest = false; end + else + if ~isequal(out(idx).(prop), reshape(value, [], 1)), 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 'dy' 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), reshape(value, [], 1)), atest = false; end + end + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pest/utp_pest_setModels.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pest/utp_pest_setModels.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,109 @@ +% UTP_PEST_SETMODELS a set of UTPs for the pest/setModels method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pest_setModels.m,v 1.3 2011/04/06 19:14:54 ingo Exp $ +% + +% +% +% The setModels method of the pest class sets the models property. +% +% + +function results = utp_pest_setModels(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pest'; + mthd = 'setModels'; + prop = 'models'; + + 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 = smodel('a+b'); + val2 = plist(prop, smodel('a+b')); + + % 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_genericAnyShapeInternal(mthd, pev, val1, @algoTestsInternal); % test internal vector call + results(5) = utp_genericAnyShape(mthd, pem, val1, @algoTests); % test matrix call + results(6) = utp_genericAnyShape(mthd, pem, val2, @algoTests); % test matrix call with plist + results(7) = utp_genericAnyShapeInternal(mthd, pem, val1, @algoTestsInternal); % test internal matrix call + results(8) = utp_genericList(mthd, pe1, pe2, pe3, val1, @algoTests); % test list + results(9) = utp_genericList(mthd, pe1, pe2, pe3, val2, @algoTests); % test list with plist + results(10) = utp_genericList(mthd, pe1, pev, pem, val1, @algoTests); % test mixed shape of input objs + results(11) = utp_genericHistory(mthd, pe1, val1, ple2); % test the history + results(12) = utp_genericModify(mthd, pe1, val1, @algoTests, ple1); % test the modifier call + results(13) = 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 'models' + 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 'models' 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 ~eq(out(idx).(prop), value.find(prop), ple1), atest = false; end + else + if ~eq(out(idx).(prop), value, ple1), 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 'models' 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 ~eq(out(idx).(prop), value, ple1), atest = false; end + end + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pest/utp_pest_setNames.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pest/utp_pest_setNames.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,111 @@ +% 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 $ +% + +% +% +% The setNames method of the pest class sets the names property. +% +% + +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 diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pest/utp_pest_setPdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pest/utp_pest_setPdf.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,109 @@ +% UTP_PEST_SETPDF a set of UTPs for the pest/setPdf method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pest_setPdf.m,v 1.3 2011/04/06 19:14:54 ingo Exp $ +% + +% +% +% The setPdf method of the pest class sets the pdf property. +% +% + +function results = utp_pest_setPdf(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pest'; + mthd = 'setPdf'; + prop = 'pdf'; + + 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 = randn(2,2); + val2 = plist(prop, randn(3,3)); + + % 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_genericAnyShapeInternal(mthd, pev, val1, @algoTestsInternal); % test internal vector call + results(5) = utp_genericAnyShape(mthd, pem, val1, @algoTests); % test matrix call + results(6) = utp_genericAnyShape(mthd, pem, val2, @algoTests); % test matrix call with plist + results(7) = utp_genericAnyShapeInternal(mthd, pem, val1, @algoTestsInternal); % test internal matrix call + results(8) = utp_genericList(mthd, pe1, pe2, pe3, val1, @algoTests); % test list + results(9) = utp_genericList(mthd, pe1, pe2, pe3, val2, @algoTests); % test list with plist + results(10) = utp_genericList(mthd, pe1, pev, pem, val1, @algoTests); % test mixed shape of input objs + results(11) = utp_genericHistory(mthd, pe1, val1, ple2); % test the history + results(12) = utp_genericModify(mthd, pe1, val1, @algoTests, ple1); % test the modifier call + results(13) = 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 'pdf' + 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 'pdf' 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), value.find(prop)), atest = false; end + else + if ~isequal(out(idx).(prop), 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 'pdf' 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), value), atest = false; end + end + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pest/utp_pest_setY.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pest/utp_pest_setY.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,109 @@ +% UTP_PEST_SETY a set of UTPs for the pest/setY method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pest_setY.m,v 1.3 2011/04/06 19:14:54 ingo Exp $ +% + +% +% +% The setY method of the pest class sets the y property. +% +% + +function results = utp_pest_setY(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pest'; + mthd = 'setY'; + prop = 'y'; + + 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 = [11 212]; + val2 = plist(prop, [1e4 1e-4]); + + % 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_genericAnyShapeInternal(mthd, pev, val1, @algoTestsInternal); % test internal vector call + results(5) = utp_genericAnyShape(mthd, pem, val1, @algoTests); % test matrix call + results(6) = utp_genericAnyShape(mthd, pem, val2, @algoTests); % test matrix call with plist + results(7) = utp_genericAnyShapeInternal(mthd, pem, val1, @algoTestsInternal); % test internal matrix call + results(8) = utp_genericList(mthd, pe1, pe2, pe3, val1, @algoTests); % test list + results(9) = utp_genericList(mthd, pe1, pe2, pe3, val2, @algoTests); % test list with plist + results(10) = utp_genericList(mthd, pe1, pev, pem, val1, @algoTests); % test mixed shape of input objs + results(11) = utp_genericHistory(mthd, pe1, val1, ple2); % test the history + results(12) = utp_genericModify(mthd, pe1, val1, @algoTests, ple1); % test the modifier call + results(13) = 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 'y' + 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 'y' 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), reshape(value.find(prop), [], 1)), atest = false; end + else + if ~isequal(out(idx).(prop), reshape(value, [], 1)), 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 'y' 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), reshape(value, [], 1)), atest = false; end + end + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pest/utp_pest_setYunits.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pest/utp_pest_setYunits.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,124 @@ +% 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 $ +% + +% +% +% The setYunits method of the pest class sets the yunits property. +% +% + +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 diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_append.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_append.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,573 @@ +% UTP_PLIST_APPEND a set of UTPs for the plist/append method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_append.m,v 1.4 2009/07/22 14:02:25 ingo Exp $ +% + +% +% +% The append method of the plist class append a param-object, plist-object +% or a key/value pair to the parameter list. +% +% + +function results = utp_plist_append(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'append'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PLIST objects + pl1 = plist('a', 1); + pl2 = plist('b', 2); + pl3 = plist('c', 3); + pl4 = plist('d', 4, 'e', 5); + plv = [pl1, pl2, pl3]; + plm = [pl1, pl2; pl3 pl4]; + + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test the modify call works + results = [results utp_07]; % Test with different inputs for the key/value pair + results = [results utp_08]; % Test capital letter of the key + results = [results utp_09]; % Test negative case. + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the append method works with a vector of PLIST objects as input. + % + % + function result = utp_02 + + % + % + % Test that the append method appends all input PLIST objects to one object. + % + % + + try + % + out = append(plv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is one PLIST object. + % 2) Check that the output PLIST contains all key/value pairs. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isa(out, 'plist') && numel(out) ==1, atest = false; end + % Check that the output have all key/value pairs + for ii = 1:numel(plv) + for kk = 1:plv(ii).nparams + pp = plv(ii).params(kk); + if ~isequal(out.find(pp.key), pp.getVal), atest = false; end + end + end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the append method works with a matrix of PLIST objects as input. + % + % + function result = utp_03 + + % + % + % Test that the append method appends all input PLIST objects to one object. + % + % + + try + % + out = append(plm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is one PLIST object. + % 2) Check that the output PLIST contains all key/value pairs. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isa(out, 'plist') && numel(out) ==1, atest = false; end + % Check that the output have all key/value pairs + for ii = 1:numel(plm) + for kk = 1:plm(ii).nparams + pp = plm(ii).params(kk); + if ~isequal(out.find(pp.key), pp.getVal), atest = false; end + end + end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the append method works with a list of PLIST objects as input. + % + % + function result = utp_04 + + % + % + % Test that the append method appends all input PLIST objects to one object. + % + % + + try + % + out = append(pl1, pl2, pl3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is one PLIST object. + % 2) Check that the output PLIST contains all key/value pairs. + % + % + + atest = true; + plin = [pl1, pl2, pl3]; + if stest + % + % Check we have the correct number of outputs + if ~isa(out, 'plist') && numel(out) ==1, atest = false; end + % Check that the output have all key/value pairs + for ii = 1:numel(plin) + for kk = 1:plin(ii).nparams + pp = plin(ii).params(kk); + if ~isequal(out.find(pp.key), pp.getVal), atest = false; end + end + end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the append method works with a mix of different shaped PLIST + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the append method appends all input PLIST objects to one object. + % + % + + try + % + out = append(plm, plist('aa', 1)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is one PLIST object. + % 2) Check that the output PLIST contains all key/value pairs. + % + % + + atest = true; + plin = [reshape(plm, 1, []), plist('aa', 1)]; + if stest + % + % Check we have the correct number of outputs + if ~isa(out, 'plist') && numel(out) ==1, atest = false; end + % Check that the output have all key/value pairs + for ii = 1:numel(plin) + for kk = 1:plin(ii).nparams + pp = plin(ii).params(kk); + if ~isequal(out.find(pp.key), pp.getVal), atest = false; end + end + end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the append method applies the modify command + % + % + function result = utp_06 + + % + % + % Test that the append method can modify the input PLIST by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at1 to work with + plin = plist(pl1); + % modify ain + out = plin.append('aa', 1); + plin.append('aa', 1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'pl1' and 'plin' are now different. + % 2) Check that 'ain' append the key/value pair. + % + % + + atest = true; + if stest + % + % Check that append modified the input by comparing to the copy + if eq(plist(pl1), plin, ple1), atest = false; end + % Check that append doesn't modified the input for the function notation + if ~eq(out, plin, ple1), atest = false; end + % Check that the modified input have the new key/value pairs + if ~isequal(plin.find('aa'), 1), atest = false; end + if ~isequal(plin.find('a'), 1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the append method with different input variants for the key/value pair. + % + % + function result = utp_07 + + % + % + % Test that the append method accepts plists-objects, param-objects or + % direct key/value pairs as an input. + % + % + + try + % + p1 = param('p1', 1); + p2 = param('p2', 2); + p3 = param('p3', 3); + out1 = pl1.append([p1, p2], p3); + out2 = pl1.append('aa', 1, 'bb', 2); + out3 = pl1.append(pl2, p1, 'aa', 1, [p2 p3], 'bb', 2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output have all key/value pairs. + % + % + + atest = true; + if stest + % + % Check the key 'a' + if ~isequal(out1.find('a'), 1), atest = false; end + if ~isequal(out2.find('a'), 1), atest = false; end + if ~isequal(out3.find('a'), 1), atest = false; end + % Check the key 'b' + if ~isequal(out3.find('b'), 2), atest = false; end + % Check the key 'p1' + if ~isequal(out1.find('p1'), 1), atest = false; end + if ~isequal(out3.find('p1'), 1), atest = false; end + % Check the key 'p2' + if ~isequal(out1.find('p2'), 2), atest = false; end + if ~isequal(out3.find('p2'), 2), atest = false; end + % Check the key 'p3' + if ~isequal(out1.find('p3'), 3), atest = false; end + if ~isequal(out3.find('p3'), 3), atest = false; end + % Check the key 'aa' + if ~isequal(out2.find('aa'), 1), atest = false; end + if ~isequal(out3.find('aa'), 1), atest = false; end + % Check the key 'bb' + if ~isequal(out2.find('bb'), 2), atest = false; end + if ~isequal(out3.find('bb'), 2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test that the append method appends the key always in capital letter + % + % + function result = utp_08 + + % + % + % Test that the append method appends the key always in capital letter + % + % + + try + % + out = pl2.append('This_Id_A_NeW_Key', 1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the key is in capital letters + % + % + + atest = true; + if stest + % + for ii = 1:out.nparams + found = false; + if strcmp(out.params(ii).key, 'THIS_ID_A_NEW_KEY') + found = true; + end + end + if ~found, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test the append method in a negative case. + % + % + function result = utp_09 + + % + % + % The append method throwns an error if a user tries to append a key + % which already exist. + % + % + + try + % + pl1.append('a', 2); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Check that the negative case doesn't change the input object. + % + % + + atest = true; + if stest + % + if pl1.nparams ~= 1, atest = false; end; + if ~isequal(pl1.find('a'),1), atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_bsubmit.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_bsubmit.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,526 @@ +% UTP_PLIST_BSUBMIT a set of UTPs for the plist/bsubmit method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_bsubmit.m,v 1.13 2010/08/18 09:25:55 ingo Exp $ +% + +% +% +% The bsubmit method of the plist class submits a collection of objects +% in binary form to an LTPDA Repository. The type of the objects are +% independent. +% +% + +function results = utp_plist_bsubmit(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'bsubmit'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + [pl1, pl2, pl3, pl4, plv, plm] = get_test_objects_plist; + plForAutoTest = plist('no dialog', true, 'use selector', false); + + try + conn = utpGetConnection(); + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_plist_bsubmit: submit plist'; + sinfo.experiment_description = 'utp_plist_bsubmit: description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test output of the data + catch + end + + % Close connection + utpCloseConnection(conn) + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 15, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('sinfo filename'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isEmptyChar(io(3).plists.find('sinfo filename')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the bsubmit method works with a vector of PLIST objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the bsubmit method works for a vector of PLIST objects as + % input. + % + % + + try + % + [ids, cids] = bsubmit(plv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(plv), atest = false; end + if numel(robjs2) ~= numel(plv), atest = false; end + if numel(robjs3) ~= numel(plv), atest = false; end + % Check the retrieved object against the submitted + if ~eq(plv, [robjs1{:}]), atest = false; end + if ~eq(plv, [robjs2{:}]), atest = false; end + if ~eq(plv, [robjs3{:}]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the bsubmit method works with a matrix of PLIST objects as + % input. + % + % + function result = utp_03 + + % + % + % Tests that the bsubmit method works with a matrix of PLIST objects + % as input. + % + % + + try + % + [ids, cids] = bsubmit(plm, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3), ids(4), ids(5), ids(6)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(plm), atest = false; end + if numel(robjs2) ~= numel(plm), atest = false; end + if numel(robjs3) ~= numel(plm), atest = false; end + % Check the retrieved object against the submitted + if ~eq(plm, [robjs1{:}]), atest = false; end + if ~eq(plm, [robjs2{:}]), atest = false; end + if ~eq(plm, [robjs3{:}]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the bsubmit method works with a list of PLIST objects as + % input. + % + % + function result = utp_04 + + % + % + % Tests that the bsubmit method works with a list of PLIST objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = bsubmit(pl1, pl, iir, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 3, atest = false; end + if numel(robjs2) ~= 3, atest = false; end + if numel(robjs3) ~= 3, atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{2}, pl1), atest = false; end + if ~eq(robjs1{3}, pl), atest = false; end + if ~eq(robjs1{1}, iir), atest = false; end + % Check robjs2 + if ~eq(robjs2{2}, pl1), atest = false; end + if ~eq(robjs2{3}, pl), atest = false; end + if ~eq(robjs2{1}, iir), atest = false; end + % Check robjs3 + if ~eq(robjs3{2}, pl1), atest = false; end + if ~eq(robjs3{3}, pl), atest = false; end + if ~eq(robjs3{1}, iir), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the abs method works with a mix of different shaped PLIST + % objects as input. + % + % + function result = utp_05 + + % + % + % Tests that the bsubmit method works with a list of PLIST objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = bsubmit(pl, plm, iir, plv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 2 + numel(plm) + numel(plv), atest = false; end + if numel(robjs2) ~= 2 + numel(plm) + numel(plv), atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, iir), atest = false; end + if ~eq(robjs1{2}, pl), atest = false; end + if ~eq(robjs1{3}, plm(1)), atest = false; end + if ~eq(robjs1{4}, plm(2)), atest = false; end + if ~eq(robjs1{5}, plm(3)), atest = false; end + if ~eq(robjs1{6}, plm(4)), atest = false; end + if ~eq(robjs1{7}, plm(5)), atest = false; end + if ~eq(robjs1{8}, plm(6)), atest = false; end + if ~eq(robjs1{9}, plv(1)), atest = false; end + if ~eq(robjs1{10}, plv(2)), atest = false; end + if ~eq(robjs1{11}, plv(3)), atest = false; end + % Check robjs2 + if ~isequalwithequalnans(robjs1, robjs2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tthe bsubmit method properly applies history. + % + % + function result = utp_06 + + % + % + % Tthe bsubmit method properly applies history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the bsubmit method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [ids, cids] = bsubmit(pl1, pl2, sinfo, plForAutoTest); + + [o1, o2] = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + o3 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the output + if ~eq(o1, pl1), atest = false; end + if ~eq(o2, pl2), atest = false; end + if ~eq(o3{1}, pl1), atest = false; end + if ~eq(o3{2}, pl2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_char.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_char.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,318 @@ +% UTP_PLIST_CHAR a set of UTPs for the plist/char method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_char.m,v 1.2 2009/07/22 14:02:25 ingo Exp $ +% + +% +% +% The char method of the plist class converts the objects into one character string +% which contains information of the object. +% +% + +function results = utp_plist_char(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'char'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PLIST objects + [pl1, pl2, pl3, pl4, plv, plm] = get_test_objects_plist; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the char method works with a vector of PLIST objects as input. + % + % + function result = utp_02 + + % + % + % Test that the char method works for a vector of PLIST objects as input. + % + % + + try + % + out = char(plv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end; + for kk = 1:numel(plv) + if isempty(strfind(out, char(plv(kk)))), atest = false; end + end + % Find Brackets +% a = regexp(out, '\(([^\(\)]*|[^\(\)]*\([^\(\)]*?\)[^\(\)]*)\)', 'match'); +% if numel(a) ~= numel(plv), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the char method works with a matrix of PLIST objects as input. + % + % + function result = utp_03 + + % + % + % Test that the char method works for a matrix of PLIST objects as input. + % + % + + try + % + out = char(plm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(plm) + if isempty(strfind(out, char(plm(kk)))), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the char method works with a list of PLIST objects as input. + % + % + function result = utp_04 + + % + % + % Test that the char method works for a list of PLIST objects as input. + % + % + + try + % + out = char(pl1,pl2,pl3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + plin = [pl1,pl2,pl3]; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(plin) + if isempty(strfind(out, char(plin(kk)))), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the char method works with a mix of different shaped PLIST objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the char method works with an input of matrices and vectors + % and single PLIST objects. + % + % + + try + % + out = char(pl1,plv,pl2,plm,pl3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + plin = [pl1,reshape(plv,1,[]),pl2,reshape(plm,1,[]),pl3]; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(plin) + if isempty(strfind(out, char(plin(kk)))), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_combine.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_combine.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,468 @@ +% UTP_PLIST_COMBINE a set of UTPs for the plist/combine method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_combine.m,v 1.3 2009/07/22 14:02:25 ingo Exp $ +% + +% +% +% The combine method of the plist class combine multiple parameter lists +% (PLIST) objects into a single PLIST object. +% +% + +function results = utp_plist_combine(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'combine'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PLIST objects + pl1 = plist('a', 1); + pl2 = plist('b', 2); + pl3 = plist('c', 3); + pl4 = plist('d', 4, 'e', 5); + plv = [pl1, pl2, pl3]; + plm = [pl1, pl2; pl3 pl4]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test the modify call works + results = [results utp_07]; % Test with different inputs for the key/value pair + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the combine method works with a vector of PLIST objects as input. + % + % + function result = utp_02 + + % + % + % Test that the combine method combines all input PLIST objects to one object. + % + % + + try + % + out = combine(plv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is one PLIST object. + % 2) Check that the output PLIST contains all key/value pairs. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isa(out, 'plist') && numel(out) ==1, atest = false; end + % Check that the output have all key/value pairs + for ii = 1:numel(plv) + for kk = 1:plv(ii).nparams + pp = plv(ii).params(kk); + if ~isequal(out.find(pp.key), pp.getVal), atest = false; end + end + end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the combine method works with a matrix of PLIST objects as input. + % + % + function result = utp_03 + + % + % + % Test that the combine method combines all input PLIST objects to one object. + % + % + + try + % + out = combine(plm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is one PLIST object. + % 2) Check that the output PLIST contains all key/value pairs. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isa(out, 'plist') && numel(out) ==1, atest = false; end + % Check that the output have all key/value pairs + for ii = 1:numel(plm) + for kk = 1:plm(ii).nparams + pp = plm(ii).params(kk); + if ~isequal(out.find(pp.key), pp.getVal), atest = false; end + end + end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the combine method works with a list of PLIST objects as input. + % + % + function result = utp_04 + + % + % + % Test that the combine method combines all input PLIST objects to one object. + % + % + + try + % + out = combine(pl1, pl2, pl3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is one PLIST object. + % 2) Check that the output PLIST contains all key/value pairs. + % + % + + atest = true; + plin = [pl1, pl2, pl3]; + if stest + % + % Check we have the correct number of outputs + if ~isa(out, 'plist') && numel(out) ==1, atest = false; end + % Check that the output have all key/value pairs + for ii = 1:numel(plin) + for kk = 1:plin(ii).nparams + pp = plin(ii).params(kk); + if ~isequal(out.find(pp.key), pp.getVal), atest = false; end + end + end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the combine method works with a mix of different shaped PLIST + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the combine method combines all input PLIST objects to one object. + % + % + + try + % + out = combine(plm, plist('aa', 1)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is one PLIST object. + % 2) Check that the output PLIST contains all key/value pairs. + % + % + + atest = true; + plin = [reshape(plm, 1, []), plist('aa', 1)]; + if stest + % + % Check we have the correct number of outputs + if ~isa(out, 'plist') && numel(out) ==1, atest = false; end + % Check that the output have all key/value pairs + for ii = 1:numel(plin) + for kk = 1:plin(ii).nparams + pp = plin(ii).params(kk); + if ~isequal(out.find(pp.key), pp.getVal), atest = false; end + end + end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the combine method applies the modify command + % + % + function result = utp_06 + + % + % + % Test that the combine method can modify the input PLIST by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at1 to work with + plin = plist(pl1); + % modify ain + out = plin.combine(pl2); + plin.combine(pl2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'pl1' and 'plin' are now different. + % 2) Check that 'ain' combine the key/value pair. + % + % + + atest = true; + if stest + % + % Check that combine modified the input by comparing to the copy + if eq(plist(pl1), plin, ple1), atest = false; end + % Check that combine doesn't modified the input for the function notation + if ~eq(out, plin, ple1), atest = false; end + % Check that the modified input have the new key/value pairs + if ~isequal(plin.find('a'), 1), atest = false; end + if ~isequal(plin.find('b'), 2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the combine method doen't overwrite existing keys. + % + % + function result = utp_07 + + % + % + % Duplicate parameters which are given priority in the order in which + % they appear in the input. + % + % + + try + % + pl1 = plist('a', 1, 'b', 2, 'c', 3); + pl2 = plist('b', 'new b', 'd', 4, 'c', 'new c'); + pl3 = plist('b', 'newer b', 'e', 5, 'd', 'new d'); + out = combine(pl1, pl2, pl3); + pl1.combine(pl2, pl3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output have all key/value pairs in the order they + % appear. + % + % + + atest = true; + if stest + % + % Check number of params + if out.nparams ~= 5, atest = false; end + if pl1.nparams ~= 5, atest = false; end + % Check the params + if ~isequal(out.find('a'), 1), atest = false; end + if ~isequal(out.find('b'), 2), atest = false; end + if ~isequal(out.find('c'), 3), atest = false; end + if ~isequal(out.find('d'), 4), atest = false; end + if ~isequal(out.find('e'), 5), atest = false; end + if ~isequal(pl1.find('a'), 1), atest = false; end + if ~isequal(pl1.find('b'), 2), atest = false; end + if ~isequal(pl1.find('c'), 3), atest = false; end + if ~isequal(pl1.find('d'), 4), atest = false; end + if ~isequal(pl1.find('e'), 5), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_copy.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_copy.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,50 @@ +% UTP_PLIST_COPY a set of UTPs for the plist/copy method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_copy.m,v 1.4 2009/08/08 12:21:40 hewitson Exp $ +% + +% +% +% The copy method of the plist class copies the input object depending of the +% second input. +% +% + +function results = utp_plist_copy(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'copy'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_69(class, 1, 1, ple2)]; + results = [results utp_69(class, 1, 3, ple2)]; + results = [results utp_69(class, 2, 3, ple2)]; + + 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 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_display.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_display.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,319 @@ +% UTP_PLIST_DISPLAY a set of UTPs for the plist/display method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_display.m,v 1.2 2009/07/22 14:02:26 ingo Exp $ +% + +% +% +% The display method of the plist class prints defined values of an PLIST object. +% MATLAB calls display when it interprets an object that is not terminated +% by a semicolon. +% +% + +function results = utp_plist_display(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'display'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PLIST objects + [pl1, pl2, pl3, pl4, plv, plm] = get_test_objects_plist; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the display method works with a vector of PLIST objects as input. + % + % + function result = utp_02 + + % + % + % Test that the display method works for a vector of PLIST objects as input. + % + % + + try + % + plv + out = display(plv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + % Check the output + if ~iscell(out), atest = false; end; + for kk = 1:numel(plv) + if isempty(strfind(out, plv(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the display method works with a matrix of PLIST objects as input. + % + % + function result = utp_03 + + % + % + % Test that the display method works for a matrix of PLIST objects as input. + % + % + + try + % + plm + out = display(plm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(plm) + if isempty(strfind(out, plm(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the display method works with a list of PLIST objects as input. + % + % + function result = utp_04 + + % + % + % Test that the display method works for a list of PLIST objects as input. + % + % + + try + % + pl1,pl2,pl3, pl4 + out = display(pl1,pl2,pl3, pl4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + plin = [pl1,pl2,pl3, pl4]; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(plin) + if isempty(strfind(out, plin(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the display method works with a mix of different shaped + % PLIST objects as input. + % + % + function result = utp_05 + + % + % + % Test that the display method works with an input of matrices and vectors + % and single PLIST objects as. + % + % + + try + % + out = display(pl4,plv,pl3,plm,pl2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + plin = [pl4,reshape(plv,1,[]),pl3,reshape(plm,1,[]),pl2]; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(plin) + if isempty(strfind(out, plin(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_eq.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_eq.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,423 @@ +% UTP_PLIST_EQ a set of UTPs for the plist/eq method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_eq.m,v 1.5 2010/11/19 12:33:33 ingo Exp $ +% + +% +% +% The eq() method of the plist class pl1 == pl2 compares each element of an +% plist object with the corresponding element of an second plist object and returns +% a logical 1 (true) where pl1 and pl2 are equal, or logical 0 (false) +% where they are not equal. +% +% + +function results = utp_plist_eq(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'eq'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PLIST objects + [pl1, pl2, pl3, pl4, plv, plm] = get_test_objects_plist; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test with the exception list 'name' + results = [results utp_07]; % Test exception list in a plist + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check number of SETS + if numel(io(2).sets) ~= 1, atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + % SET 'Default' + % Check key + if ~io(3).plists.isparam('Exceptions'), atest = false; end + if ~io(3).plists.isparam('Tol'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('Exceptions'), {}), atest = false; end + if ~isequal(io(3).plists.find('Tol'), eps(1)), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('Exceptions'), {{}}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('Tol'), {eps(1)}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the eq method works with a vector of PLIST objects as input. + % + % + function result = utp_02 + + % + % + % Test that the eq method works for a vector of PLIST objects as input. + % Test the positive and the negative case. + % + % + + try + % + pl = pl1.setName('my name'); + plv1 = [pl1, pl3, pl2, pl4]; + plv2 = [pl1, pl3, pl2, pl]; + out1 = eq(plv1, plv1); + out2 = eq(plv1, plv2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the eq function. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the eq method works with a matrix of PLIST objects as input. + % + % + function result = utp_03 + + % + % + % Test that the eq method works for a matrix of PLIST objects as input. + % Test the positive and the negative case. + % + % + + try + % + pl = pl4.setName('my name'); + plm1 = [pl1, pl3, pl4, pl4, pl2, pl1]; + plm2 = [pl1, pl3, pl; pl4, pl2, pl1]; + out1 = eq(plm1, plm1); + out2 = eq(plm1, plm2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the eq function. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the eq method works with a list of PLIST objects as input. + % + % + function result = utp_04 + + % + % + % The eq method doesn't works for a list of PLIST objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the eq method works with a mix of different shaped PLIST objects + % as input. + % + % + function result = utp_05 + + % + % + % The eq method doesn't works for a list of PLIST objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_06 + + % + % + % Test the eq method with the exception 'name'. It is necessary to add + % 'created' to the exception list because pl is created at an other time. + % + % + + try + % + pl = pl4.setName('my name'); + out1 = eq(pl, pl4); + out2 = eqLocal(pl, pl4, 'name'); + out3 = eqLocal(pl, pl4, 'plist/name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the eq method with an exception list which is in a plist. + % + % + function result = utp_07 + + % + % + % Test that the eq method uses the exception list in a plist. + % + % + + try + % + pl = pl4.setName('my name'); + out1 = eq(pl, pl4); + out2 = eq(pl, pl4, ple2); + out3 = eq(pl, pl4, ple2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + function res = eqLocal(obj1, obj2, ex) + e = ple1.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {ex}]); + + res = eq(obj1, obj2, ple); + end +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_find.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_find.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,278 @@ +% UTP_PLIST_FIND a set of UTPs for the plist/find method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_find.m,v 1.3 2009/07/22 14:02:26 ingo Exp $ +% + +% +% +% The find method of the plist class returns the value corresponding to +% the first parameters in the list with the search-key. +% +% + +function results = utp_plist_find(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'find'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PLIST objects + [pl1, pl2, pl3, pl4, plv, plm] = get_test_objects_plist; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Test the modify call works + results = [results utp_03]; % Test with different inputs for the key/value pair + results = [results utp_04]; % Test negative case. + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('key'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('key')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('key'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the find method applies the modify command. + % + % + function result = utp_02 + + % + % + % Test that it is possible to use modify command and show that this + % method ignoring case. + % + % + + try + % + % modify ain + out1 = pl4.find('spec'); + out2 = pl4.find('sPeC'); + out3 = pl4.find('SPEC'); + pl4.find('spec') + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that out1..3 have all the same object. + % + % + + atest = true; + if stest + % + % Find the right object + for ii = 1:pl4.nparams + if strcmpi(pl4.params(ii).key, 'SPEC') + obj = pl4.params(ii).getVal; + break + end + end + if ~eq(obj, out1), atest = false; end + if ~eq(obj, out2), atest = false; end + if ~eq(obj, out3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Test that the find method accepts a plist. + % + % + function result = utp_03 + + % + % + % Test that the find method take the 'key' from a 'search' plist. + % + % + + try + % + out = pl4.find(plist('key', 'spec')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output have the correct value. + % + % + + atest = true; + if stest + % + for ii = 1:pl4.nparams + if strcmpi(pl4.params(ii).key, 'SPEC') + obj = pl4.params(ii).getVal; + break + end + end + if ~eq(obj, out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Test the find method returns an empty array if the 'key' doesn't + % exist in the PLIST. + % + % + function result = utp_04 + + % + % + % Test the find method returns an empty array if the 'key' doesn't + % exist in the PLIST. + % + % + + try + % + out = pl4.find('non_existing_key'); + stest = true; + % + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is an empty array. + % + % + + atest = true; + if stest + % + if ~isempty(out), atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_get.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_get.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,264 @@ +% UTP_PLIST_GET a set of UTPs for the plist/get method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_get.m,v 1.5 2011/03/29 13:03:29 ingo Exp $ +% + +% +% +% The get method of the plist class returns the value of an object +% property. This is a very simple method which accepts only one plist as +% input thus are the most general units test not possible. +% +% + +function results = utp_plist_get(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'get'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Algorithm test + results = [results utp_03]; % Algorithm test with a plist + results = [results utp_04]; % Negative test with more than one plist + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('property'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('property')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('property'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests the get method of the plist class. + % + % + function result = utp_02 + + % + % + % Test that the get returns returns the value of the specified + % property. Do this for all properties of the PLIST object. + % + % + + try + % + pl = plist('a', 1, 'b', 2, 'c', 3); + out1 = get(pl, 'params'); + out5 = get(pl, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the correct value of the output + % + % + + atest = true; + if stest + % + if ~eq(out1, pl.params), atest = false; end + if ~isequal(out5, pl.name), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the get method works with a plist. + % + % + function result = utp_03 + + % + % + % Test that the get returns returns the value of the specified + % property which is defined in a plist. + % + % + + try + % + pl = plist('a', 1, 'b', 2, 'c', 3); + pl1 = plist('property', 'params'); + pl5 = plist('property', 'name'); + out1 = get(pl, pl1); + out5 = get(pl, pl5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the correct value of the output + % + % + + atest = true; + if stest + % + if ~eq(out1, pl.params), atest = false; end + if ~isequal(out5, pl.name), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests the get method of the plist class. + % + % + function result = utp_04 + + % + % + % Test that the get throws an error if the input are more than + % one PLIST object. + % + % + + try + % + pl = plist('a', 1, 'b', 2, 'c', 3); + out = get([pl, pl], 'name'); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_isparam.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_isparam.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,423 @@ +% UTP_PLIST_ISPARAM a set of UTPs for the plist/isparam method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_isparam.m,v 1.4 2009/07/22 14:02:26 ingo Exp $ +% + +% +% +% The isparam method of the plist class look for a given key in the +% parameter lists. Exist the key in the parameter list then is the result 1 +% otherwise 0. +% +% + +function results = utp_plist_isparam(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'isparam'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PLIST objects + [pl1, pl2, pl3, pl4, plv, plm] = get_test_objects_plist; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test the modify call works + results = [results utp_07]; % Test positiv match. + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the isparam method works with a vector of PLIST objects as input. + % + % + function result = utp_02 + + % + % + % Tests that the isparam method works with a vector of PLIST objects as + % input. + % + % + + try + % + out = isparam(plv, 'non_existing_key'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output have the same size as the input. + % 2) Check the output. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if size(out) ~= size(plv), atest = false; end + % Check the output. All must be zero because the key doesn't exit. + if any(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the isparam method works with a matrix of PLIST objects as + % input. + % + % + function result = utp_03 + + % + % + % Tests that the isparam method works with a matrix of PLIST objects as + % input. + % + % + + try + % + out = isparam(plm, 'non_existing_key'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output have the same size as the input. + % 2) Check the output. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if size(out) ~= size(plm), atest = false; end + % Check the output. All must be zero because the key doesn't exit. + if any(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the isparam method works with a list of PLIST objects as + % input. + % + % + function result = utp_04 + + % + % + % Tests that the isparam method works with a list of PLIST objects as + % input. + % + % + + try + % + out = isparam(pl1, pl2, pl3, 'non_existing_key'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output have the same size as the input. + % 2) Check the output. + % + % + + atest = true; + plin = [pl1, pl2, pl3]; + if stest + % + % Check we have the correct number of outputs + if size(out) ~= size(plin), atest = false; end + % Check the output. All must be zero because the key doesn't exit. + if any(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the isparam method works with a mix of different shaped PLIST + % objects as input. + % + % + function result = utp_05 + + % + % + % Tests that the isparam method works with a mix of different shaped + % PLIST objects as input. + % + % + + try + % + out = isparam(pl1, plv, plm, pl3, 'non_existing_key'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output have the same size as the input. + % 2) Check the output. + % + % + + atest = true; + plin = [pl1, reshape(plv, 1, []), reshape(plm, 1, []), pl3]; + if stest + % + % Check we have the correct number of outputs + if size(out) ~= size(plin), atest = false; end + % Check the output. All must be zero because the key doesn't exit. + if any(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the isparam method applies the modify command + % + % + function result = utp_06 + + % + % + % Test that the isparam method can used in the modifier form. + % + % + + try + % + plin = plist(pl3); + plin.isparam('non_existing_key'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Test that plin doesn't change. + % + % + + atest = true; + if stest + % + if ~eq(plin, pl3, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the isparam method with a positiv match. + % + % + function result = utp_07 + + % + % + % Test the isparam method with different input. + % + % + + try + % + out1 = pl2.isparam(pl2, 'a'); + out2 = pl2.isparam(pl2, 'b'); + out3 = pl2.isparam(pl2, 'c'); + out4 = pl2.isparam(pl2, 'd'); + out5 = isparam(pl1, pl2, pl3, 'cell'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 0, atest = false; end + if ~isequal(out5,[0 0 1]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_isprop.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_isprop.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,422 @@ +% UTP_PLIST_ISPROP a set of UTPs for the plist/isprop method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_isprop.m,v 1.6 2011/03/29 13:13:33 ingo Exp $ +% + +% +% +% The isprop method of the plist class determine whether input is object property. +% +% + +function results = utp_plist_isprop(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'isprop'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PLIST objects + [pl1, pl2, pl3, pl4, plv, plm] = get_test_objects_plist; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test the modify call works + results = [results utp_07]; % Test negative case + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the isprop method works with a vector of PLIST objects as input. + % + % + function result = utp_02 + + % + % + % Test that the isprop method works for a vector of PLIST objects as input. + % + % + + try + % + out = isprop(plv, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'plv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(plv)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the isprop method works with a matrix of PLIST objects as input. + % + % + function result = utp_03 + + % + % + % Test that the isprop method works for a matrix of PLIST objects as input. + % + % + + try + % + out = isprop(plm, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'plm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(plm)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the isprop method works with a list of PLIST objects as input. + % + % + function result = utp_04 + + % + % + % Test that the isprop method works for a list of PLIST objects as input. + % + % + + try + % + out = isprop(pl4,pl3,pl2, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the isprop method works with a mix of different shaped + % PLIST objects as input. + % + % + function result = utp_05 + + % + % + % Test that the isprop method works with an input of matrices and vectors + % and single PLIST objects. + % + % + + try + % + out = isprop(pl4,plv,pl3,plm,pl2, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(plm)+numel(plv)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the isprop method works for each property. + % + % + function result = utp_06 + + % + % + % Test that the isprop method works for the properties: + % 'params', 'created', 'creator', 'name' + % + % + + try + % + % copy pl4 to work with + out1 = isprop(pl4, 'params'); + out5 = isprop(pl4, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if ~out1, atest = false; end; + if ~out5, atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the negative case and the not function command. + % + % + function result = utp_07 + + % + % + % Test that the isprop method retrun false for a unknown property and for + % methods of the object. + % + % + + try + % + out1 = isprop(pl2, 'foo'); + out2 = pl2.isprop('foo'); + out3 = pl2.isprop('name'); + out4 = pl2.isprop('type'); + out5 = pl2.isprop('char'); + % REMARK: In the ltpda_uoh class are the properties 'created' and + % 'creator' methods which gets the value from the history + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if out1, atest = false; end; + if out2, atest = false; end; + if ~out3, atest = false; end; + if out4, atest = false; end; + if out5, atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_loadobj.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_loadobj.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,151 @@ +% UTP_PLIST_LOADOBJ a set of UTPs for the plist/loadobj method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_loadobj.m,v 1.1 2009/01/08 16:46:24 ingo Exp $ +% + +% +% +% The loadobj method of the plist class will be automatically called by +% MATLAB if an older object is not compatible with the current object structure. +% This happens only for objects which are stored as a MATLAB formatted +% (MAT-file). The load mechanism for XML formated files calls always the +% 'update_struct' method to keep the stored objects up to date. The +% 'update_struct' method convert the read object structure to the object +% structure which is used in the currend LTPDA version. +% This UTP will load old objects which are stored with an older LTPDA version. +% +% REMARK: Since LTPDA version 1.9.2 will be an object which should be saved as a +% MAT file stored as a struct and not as the object. +% +% + +function results = utp_plist_loadobj(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'loadobj'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Run the tests + results = [results utp_01]; % getInfo call + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Get all .MAT and .XML files + path = fullfile(fileparts(which(mfilename)), '..', '..', 'utp_test_files'); + + matfiles = utils.prog.filescan(path, '.mat'); + xmlfiles = utils.prog.filescan(path, '.xml'); + + % Load .MAT files + obj_no = 1; + for ii=1:numel(matfiles) + fn = matfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = plist(fn); + obj_no = obj_no+1; + end + end + + % Load .XML files + for ii=1:numel(xmlfiles) + fn = xmlfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = plist(fn); + obj_no = obj_no+1; + end + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the shape of the loaded objects. + % + % + + atest = true; + if stest + % + for ii = 1:numel(objs) + obj = objs(ii).obj; + fname = objs(ii).fname; + + if ~isempty(strfind(fname, '_vec')) + % Loaded object must be a vector + if ~isvector(obj), atest = false; end + elseif ~isempty(strfind(fname, '_mat')) + % Loaded object must be a matrix + % REMARK: Known error in LTPDA version 1.9.2 + % A saved matrix doesn't keep the shape of the matrix. + if isempty(strfind(fname, '_192')) + if ~(size(obj,1) > 1 && size(obj,2) > 1), atest = false; end + end + else + % Loaded object must be a single object + if ~(size(obj,1) == 1 && size(obj,2) == 1), + atest = false; end + end + + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_ne.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_ne.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,453 @@ +% UTP_PLIST_NE a set of UTPs for the plist/ne method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_ne.m,v 1.3 2009/07/22 14:02:26 ingo Exp $ +% + +% +% +% The ne() method of the plist class pl1 ~= pl2 compares each element of an +% plist object with the corresponding element of an second plist object and returns +% a logical 1 (true) where pl1 and pl2 are not equal, or logical 0 (false) +% where they are equal. +% +% + +function results = utp_plist_ne(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'ne'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PLIST objects + [pl1, pl2, pl3, pl4, plv, plm] = get_test_objects_plist; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test with the exception list 'name' + results = [results utp_08]; % Test exception list in a plist + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the ne method works with a vector of PLIST objects as input. + % + % + function result = utp_02 + + % + % + % Test that the ne method works for a vector of PLIST objects as input. + % Test the positive and the negative case. + % + % + + try + % + pl = pl4.setName('my name'); + plv1 = [pl1, pl2, pl3, pl4]; + plv2 = [pl1, pl2, pl3, pl]; + out1 = ne(plv1, plv1); + out2 = ne(plv1, plv2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the ne function. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the ne method works with a matrix of PLIST objects as input. + % + % + function result = utp_03 + + % + % + % Test that the ne method works for a matrix of PLIST objects as input. + % Test the positive and the negative case. + % + % + + try + % + pl = pl4.setName('my name'); + plm1 = [pl1, pl2, pl4, pl4, pl3, pl1]; + plm2 = [pl1, pl2, pl; pl4, pl3, pl1]; + out1 = ne(plm1, plm1); + out2 = ne(plm1, plm2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the ne function. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the ne method works with a list of PLIST objects as input. + % + % + function result = utp_04 + + % + % + % The ne method doesn't works for a list of PLIST objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the ne method works with a mix of different shaped PLIST objects + % as input. + % + % + function result = utp_05 + + % + % + % The ne method doesn't works for a list of PLIST objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the ne method properly applies history. + % + % + function result = utp_06 + + % + % + % The ne method doesn't change the PLIST object, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the ne method with an exception list. + % The function plist/ne use the function plist/eq so it is not necessary to check + % all possibilities of the exception list. + % + % + function result = utp_07 + + % + % + % Test the ne method with the exception 'name'. It is necessary to add + % 'created' to the exception list because pl is created at an other time. + % + % + + try + % + pl = pl4.setName('my name'); + out1 = ne(pl, pl4); + out2 = ne(pl, pl4, 'name', 'created', 'UUID'); + out3 = ne(pl, pl4, 'plist/name', 'created', 'UUID'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + if out3 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the ne method with an exception list which is in a plist. + % + % + function result = utp_08 + + % + % + % Test that the ne method uses the exception list in a plist. + % + % + + try + % + pl = pl4.setName('my name'); + out1 = ne(pl, pl4); + out2 = ne(pl, pl4, ple2); + out3 = ne(pl, pl4, ple2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + if out3 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_nparams.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_nparams.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,380 @@ +% UTP_PLIST_NPARAMS a set of UTPs for the plist/nparams method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_nparams.m,v 1.3 2009/07/22 14:02:26 ingo Exp $ +% + +% +% +% The nparams method of the plist class returns the number of param objects +% in the list +% +% + +function results = utp_plist_nparams(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'nparams'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PLIST objects + [pl1, pl2, pl3, pl4, plv, plm] = get_test_objects_plist; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test the modify call works + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the nparams method works with a vector of PLIST objects as input. + % + % + function result = utp_02 + + % + % + % Test that the nparams method returns the number of PARAM objects in + % the PLIST objects. + % + % + + try + % + out = nparams(plv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of outputs is the same as the number of + % input PLIST objects. + % 2) Check the output. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(plv), atest = false; end + % Check the output + for ii = 1:numel(plv) + if numel(plv(ii).params) ~= out(ii), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the nparams method works with a vector of PLIST objects as input. + % + % + function result = utp_03 + + % + % + % Test that the nparams method returns the number of PARAM objects in + % the PLIST objects. + % + % + + try + % + out = nparams(plm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of outputs is the same as the number of + % input PLIST objects. + % 2) Check the output. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(plm), atest = false; end + % Check the output + for ii = 1:numel(plm) + if numel(plm(ii).params) ~= out(ii), atest = false; end + end + % + else + atest = false; + end + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the nparams method works with a list of PLIST objects as input. + % + % + function result = utp_04 + + % + % + % Test that the nparams method returns the number of PARAM objects in + % the PLIST objects. + % + % + + try + % + out = nparams(pl1, pl2, pl3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of outputs is the same as the number of + % input PLIST objects. + % 2) Check the output. + % + % + + atest = true; + plin = [pl1, pl2, pl3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(plin), atest = false; end + % Check the output + for ii = 1:numel(plin) + if numel(plin(ii).params) ~= out(ii), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the nparams method works with a mix of different shaped PLIST + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the nparams method returns the number of PARAM objects in + % the PLIST objects. + % + % + + try + % + out = nparams(plm, pl1, plv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of outputs is the same as the number of + % input PLIST objects. + % 2) Check the output. + % + % + + atest = true; + plin = [reshape(plm, 1, []), pl1, reshape(plv, 1, [])]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(plin), atest = false; end + % Check the output + for ii = 1:numel(plin) + if numel(plin(ii).params) ~= out(ii), atest = false; end + end + + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the nparams method applies the modify command + % + % + function result = utp_06 + + % + % + % Test that the nparams method can used in the modifier style. + % + % + + try + % + out1 = pl1.nparams(); + out2 = plv.nparams(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= numel(pl1.params), atest = false; end + if out2 ~= [3 6 4], atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_parse.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_parse.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,472 @@ +% UTP_PLIST_PARSE a set of UTPs for the plist/parse method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_parse.m,v 1.3 2009/07/22 14:02:26 ingo Exp $ +% + +% +% +% The append method of the plist class parse a plist for strings which can +% be converted into numbers depending on the default plist. +% +% + +function results = utp_plist_parse(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'parse'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test non-dependent elements + results = [results utp_07]; % Test dependent elements + results = [results utp_08]; % Test upper/lower case doesn't matter + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the parse method works with a vector of PLIST objects as input. + % + % + function result = utp_02 + + % + % + % The parse method is an internal method and it doesn't work for vector + % of PLIST objects as an input. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the parse method works with a matrix of PLIST objects as input. + % + % + function result = utp_03 + + % + % + % The parse method is an internal method and it doesn't work for matrix + % of PLIST objects as an input. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the parse method works with a list of PLIST objects as input. + % + % + function result = utp_04 + + % + % + % The parse method is an internal method and it doesn't work for list + % of PLIST objects as an input. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the parse method works with a mix of different shaped PLIST + % objects as input. + % + % + function result = utp_05 + + % + % + % The parse method is an internal method and it doesn't work for + % different shaped PLIST objects as input. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the parse method with non-dependent elements. + % + % + function result = utp_06 + + % + % + % Test that the parse method can convert non-dependent elements. + % + % + + try + % + pl = plist('convert pi', 'pi', ... + 'equation', 'sin(pi/2)', ... + 'convert not pi', 'pi', ... + 'randn', 'randn(12,1)'); + pld = plist('convert pi', [], ... + 'equation', [], ... + 'randn', [], ... + 'other param in def. pl', 'yes'); + out = parse(pl, pld); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the right number of parameter in out. + % 2) Check that the correct values are converted. + % + % + + atest = true; + if stest + % + % The output must have all parameter in the parse-PLIST (here: 3) + % plus all parameter which are in the in the default plist and not in + % the parse-PLIST (here: 1). + if out.nparams ~= 5, atest = false; end + if ~out.isparam('convert pi'), atest = false; end + if ~out.isparam('equation'), atest = false; end + if ~out.isparam('convert not pi'), atest = false; end + if ~out.isparam('other param in def. pl'), atest = false; end + if ~out.isparam('randn'), atest = false; end + % Check the parsed elements. + if ~isequal(out.find('convert pi'), pi), atest = false; end + if ~isequal(out.find('equation'), sin(pi/2)), atest = false; end + if ~isequal(out.find('convert not pi'), 'pi'), atest = false; end + if ~isequal(out.find('other param in def. pl'), 'yes'), atest = false; end + if numel(out.find('randn')) ~= 12, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the parse method with dependent elements. + % + % + function result = utp_07 + + % + % + % Test that the parse method can convert dependent elements. + % + % + + try + % + pl1 = plist('a', '1+d', 'b', 2, 'c', 'a+b', 'd', 'b+c'); + pl2 = plist('a', '1+d', 'b', 2, 'c', 'a+b', 'd', 'b'); + pld = plist('a', [], 'b', [], 'c', [], 'd', []); + out1 = parse(pl1, pld); + out2 = parse(pl2, pld); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the right number of parameter in out. + % 2) Check that the correct values are converted. + % + % + + atest = true; + if stest + % + % All parameters in the first plist are dependent to each other. It + % is not possible to solve this equations. + if ~isequal(out1.find('a'), '1+d'), atest = false; end + if ~isequal(out1.find('b'), 2), atest = false; end + if ~isequal(out1.find('c'), 'a+b'), atest = false; end + if ~isequal(out1.find('d'), 'b+c'), atest = false; end + % It should be possible to solve the dependent in the second plist. + if ~isequal(out2.find('a'), 3), atest = false; end + if ~isequal(out2.find('b'), 2), atest = false; end + if ~isequal(out2.find('c'), 5), atest = false; end + if ~isequal(out2.find('d'), 2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that upper/lower case doesn't matter in the parse method. + % + % + function result = utp_08 + + % + % + % Tests that upper/lower case doesn't matter in the parse method. + % + % + + try + % + pl = plist('FirsT', '1', 'SecoNd', 2, 'Third', 'Fourth + SECond + First', 'fourth', 'SECOND'); + pld = plist('first', [], 'second', [], 'third', [], 'fourth', []); + out = parse(pl, pld); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the right number of parameter in out. + % 2) Check that the correct values are converted. + % + % + + atest = true; + if stest + % + % Check the converted values. + if ~isequal(out.find('first'), 1), atest = false; end + if ~isequal(out.find('second'), 2), atest = false; end + if ~isequal(out.find('third'), 5), atest = false; end + if ~isequal(out.find('fourth'), 2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_plist.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_plist.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,835 @@ +% UTP_PLIST_PLIST a set of UTPs for the plist/plist method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_plist.m,v 1.14 2011/03/01 11:31:53 ingo Exp $ +% + +% +% +% The plist method of the plist class constructs PLIST objects. +% +% + +function results = utp_plist_plist(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'plist'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PLIST objects + [pl1, pl2, pl3, pl4, plv, plm] = get_test_objects_plist; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working with MAT file constructor + results = [results utp_07]; % Test history is working with XML file constructor + results = [results utp_08]; % Test struct constructor + results = [results utp_09]; % Test param-object constructor + results = [results utp_10]; % Test plist(filename) constructor + results = [results utp_11]; % Test plist(hostname) constructor + results = [results utp_12]; % Test history is working with conn+Id constructor + results = [results utp_13]; % Test history is working with a + b + fs constructor + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From MAT File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From XML File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Repository')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + %%%%%%%%%% SET 'From MAT File' + pn = 4; + if io(pn).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + %%%%%%%%%% SET 'From XML File' + pn = 5; + if io(pn).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + %%%%%%%%%% SET 'From Repository' + pn = 6; + if io(pn).plists.nparams ~= 7, atest = false; end + % Check key + if ~io(pn).plists.isparam('hostname'), atest = false; end + if ~io(pn).plists.isparam('id'), atest = false; end + if ~io(pn).plists.isparam('cid'), atest = false; end + if ~io(pn).plists.isparam('database'), atest = false; end + if ~io(pn).plists.isparam('binary'), atest = false; end + if ~io(pn).plists.isparam('username'), atest = false; end + if ~io(pn).plists.isparam('password'), atest = false; end + % Check default value + if ~isEmptyDouble(io(pn).plists.find('id')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('cid')), atest = false; end + if ~isequal(io(pn).plists.find('binary'), 'yes'), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('id'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('cid'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('binary'), {'yes', 'no'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the plist method works with a vector of PLIST objects as input. + % + % + function result = utp_02 + + % + % + % Test that the plist method works with a vector of PLIST objects as input. + % + % + + try + % + out = plist(plv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output PLISTs is the same as the input shape. + % 2) Check that each output PLIST is a copy of the input PLIST. + % + % + + atest = true; + if stest + % + % Check we have the correct shape + if size(out) ~= size(plv), atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same + if ~eq(plv(ii), out(ii), ple1), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(plv(ii), out(ii), ple1), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the plist method works with a matrix of PLIST objects as input. + % + % + function result = utp_03 + + % + % + % Test that the plist method works with a matrix of PLIST objects as input. + % + % + + try + % + out = plist(plm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output PLISTs is the same as the input shape. + % 2) Check that each output PLIST is a copy of the input PLIST. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if size(out) ~= size(plm), atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same + if ~eq(plm(ii), out(ii), ple1), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(plm(ii), out(ii), ple1), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the plist method works with a list of PLIST objects as input. + % + % + function result = utp_04 + + % + % + % Test that the plist method works with a list of PLIST objects as input. + % + % + + try + % + out = plist(pl1, pl2, pl3, pl4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same of the + % number in the input. + % 2) Check that each output PLIST is a copy of the input PLIST. + % + % + + atest = true; + plin = [pl1, pl2, pl3, pl4]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(plin), atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same + if ~eq(plin(ii), out(ii), ple1), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(plin(ii), out(ii), ple1), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the plist method works with a mix of different shaped PLISTs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the plist method works with a mix of different shaped PLISTs as + % input. + % + % + + try + % + out = plist(pl1,plv,pl2,plm,pl3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same of the + % number in the input. + % 2) Check that each output PLIST is a copy of the input PLIST. + % + % + + atest = true; + plin = [pl1, reshape(plv, 1, []), pl2, reshape(plm, 1, []), pl3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3+numel(plv)+numel(plm), atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same + if ~eq(plin(ii), out(ii), ple1), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(plin(ii), out(ii), ple1), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests the MAT-file constructor. + % + % + function result = utp_06 + + % + % + % Tests the MAT-file constructor. + % + % + + try + % + filename = 'pl.mat'; + save(pl3, filename); + out = plist(filename); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the saved object is the same as the loaded object. + % + % + + atest = true; + if stest + % + if ~eq(out, pl3), atest = false; end + % + delete(filename); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + + %% UTP_07 + + % + % + % Tests the XML-file constructor. + % + % + function result = utp_07 + + % + % + % Tests the XML-file constructor. + % + % + + try + % + filename = 'pl.xml'; + save(pl3, filename); + out = plist(filename); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the saved object is the same as the loaded object. + % + % + + atest = true; + if stest + % + if ~eq(out, pl3), atest = false; end + % + delete(filename); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + + %% UTP_08 + + % + % + % Tests that the plist method for a struct as an input. + % + % + function result = utp_08 + + % + % + % Tests that the plist method for a struct as an input. + % + % + + try + % + + spl = utils.prog.rstruct(pl2); + + out1 = plist(struct(pl4)); + out2 = plist(spl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 2) Check the built object. + % + % + + atest = true; + if stest + % + if ~eq(out1, pl4), atest = false; end + if ~eq(out2, pl2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Tests the param constructor. + % + % + function result = utp_09 + + % + % + % Tests the param constructor. + % + % + + try + % + p1 = param('a', 1); + p2 = param('b', 2); + p3 = param('c', 3); + out1 = plist(p1); + out2 = plist([p1 p2 p3]); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the input parameter objects + % + % + + atest = true; + if stest + % + % Check that the output is a PLIST object + if ~isa(out1,'plist'), atest = false; end + if ~isa(out2,'plist'), atest = false; end + % Check the number of parameter objects in the PLIST + if out1.nparams ~= 1, atest = false; end + if out2.nparams ~= 3, atest = false; end + % Check that the parameter objects exist in the plist object + if ~isequal(out1.find('a'), 1), atest = false; end + if ~isequal(out2.find('a'), 1), atest = false; end + if ~isequal(out2.find('b'), 2), atest = false; end + if ~isequal(out2.find('c'), 3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Tests the plist(filename) constructor. + % + % + function result = utp_10 + + % + % + % Tests the plist(filename) constructor. + % + % + + try + % + filename1 = 'pl.xml'; + filename2 = 'pl.mat'; + + save(pl1, filename1); + save(pl2, filename2); + + out1 = plist(plist('filename', filename1)); + out2 = plist(plist('filename', filename2)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the loaded object is the same as the saved object + % + % + + atest = true; + if stest + % + if ~eq(out1, pl1), atest = false; end + if ~eq(out2, pl2), atest = false; end + % + % delete test file + delete(filename1) + delete(filename2) + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_11 + + % + % + % Tests the plist(conn) constructor. + % + % + function result = utp_11 + + % + % + % Tests the plist(conn) constructor. + % + % + + try + % + conn = utpGetConnection(); + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_plist_plist_11: submit plist vector'; + sinfo.experiment_description = 'utp_plist_plist_11: &description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + plForAutoTest = plist('no dialog', true, 'use selector', false); + ids = submit(plv, sinfo, plForAutoTest); + + out = plist(plist('hostname', utpGetHostname, 'database', utpGetDatabase, 'conn', conn, 'id', ids)); + % + utpCloseConnection(conn); + stest = true; + catch err + disp(err.message) + % Close connection + utpCloseConnection(conn); + stest = false; + end + + % + % + % 1) Check the retrieved object against the submitted object. + % + % + + atest = true; + if stest + % + if ~eq(out, plv), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_11 + + %% UTP_12 + + % + % + % Tests the conn+Id constructor. + % + % + function result = utp_12 + + % + % + % Tests the conn+Id constructor. + % + % + + try + % + conn = utpGetConnection(); + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_plist_plist_12: submit plist'; + sinfo.experiment_description = 'utp_plist_plist_12: description'; + sinfo.analysis_description = 'utp_plist_plist_12'; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + plForAutoTest = plist('no dialog', true, 'use selector', false); + [ids] = submit(pl3, sinfo, plForAutoTest); + + out = plist(conn, ids); + % + utpCloseConnection(conn); + stest = true; + catch err + disp(err.message) + utpCloseConnection(conn); + stest = false; + end + + % + % + % 1) Check the retrieved object against the submitted object. + % + % + + atest = true; + if stest + % + if ~eq(out, pl3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Tests the key/value constructor + % + % + function result = utp_13 + + % + % + % Tests the key/value constructor + % + % + + try + % + out1 = plist('a', 1); + out2 = plist('a', 1, 'b', 2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the right number of parameter in the PLIST object + % 2) Check the parameter in the PLIST object + % 3) Check that the key is in capital letter. + % + % + + atest = true; + if stest + % + % Check the right number of parameter in the PLIST object + if out1.nparams ~= 1, atest = false; end + if out2.nparams ~= 2, atest = false; end + % Check the parameter in the PLIST object + if ~isequal(out1.find('a'), 1), atest = false; end + if ~isequal(out2.find('a'), 1), atest = false; end + if ~isequal(out2.find('b'), 2), atest = false; end + % Check that the key is in capital letter. + if ~isequal(out1.params(1).key, 'A'), atest = false; end + if ~isequal(out2.params(1).key, 'A'), atest = false; end + if ~isequal(out2.params(2).key, 'B'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_plist2cmds.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_plist2cmds.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,466 @@ +% UTP_PLIST_PLIST2CMDS a set of UTPs for the plist/plist2cmds method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_plist2cmds.m,v 1.4 2009/08/24 17:23:10 ingo Exp $ +% + +% +% +% The plist2cmds method of the plist class convert a plist to a set of +% commands. +% +% + +function results = utp_plist_plist2cmds(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'plist2cmds'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PLIST objects + [pl1, pl2, pl3, pl4, plv, plm] = get_test_objects_plist; + + % Exception list for the UTPs: + % [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test different objects for 'val' + + 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 + +end + + +%% UTP_01 + +% +% +% Tests that the getInfo call works for this method. +% +% +function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + class = 'plist'; + mthd = 'plist2cmds'; + + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_01 + +%% UTP_02 + +% +% +% Tests that the plist2cmds method works with a vector of PLIST objects as input. +% +% +function result = utp_02 + + % + % + % The plist2cmds method doesn't works for a vector of PLIST objects as input. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_02 + +%% UTP_03 + +% +% +% Tests that the plist2cmds method works with a matrix of PLIST objects as input. +% +% +function result = utp_03 + + % + % + % The plist2cmds method doesn't works for a matrix of PLIST objects as input. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_03 + +%% UTP_04 + +% +% +% Tests that the plist2cmds method works with a list of PLIST objects as input. +% +% +function result = utp_04 + + % + % + % The plist2cmds method doesn't works for a list of PLIST objects as input. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_04 + +%% UTP_05 + +% +% +% Tests that the plist2cmds method works with a mix of different shaped +% PLIST objects as input. +% +% +function result = utp_05 + + % + % + % The plist2cmds method doesn't works with an input of matrices and vectors + % and single PLIST objects. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_05 + +%% UTP_06 + +% +% +% Tests that the plist2cmds method accepts different objects for the 'val' property. +% +% +function result = utp_06 + + % + % + % Create a plist with all possible objects for the 'val' property. + % + % + + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + try + % + iir = miir(plist('type', 'lowpass')); + a = 'char'; + b = [1 2i 3; 4i 5 6]; + c = [true false true; false true false]; + d = java.util.TimeZone.getTimeZone('UTC'); + e = sym('[a b c; d e f]'); + f = plist('a', 'char', 'b', ao(8)+ao(9)); + g = iir.resp; + h = unit('m^-1/2 kg V^3/7'); + ii = [pz(3) pz(1,2) pz(1-2i) pz(-3)]; + j = [time(123) time('14:00:00')]; + k = [specwin('Kaiser', 10, 100) specwin('Hanning', 100)]; + % --- CHAR + pl1 = plist('key', 'this is a char'); + % --- NUMERIC + pl2 = plist('key', [1 2i 3; 4i 5 6]); + % --- LOGICAL + pl3 = plist('key', [true false true; false true false]); + % --- JAVA (timezone) + pl4 = plist('key', java.util.TimeZone.getTimeZone('UTC')); + % --- SYM + pl5 = plist('key', sym('[a b c; d e f]')); + % --- PLIST + pl6 = plist('key', plist('a', 'char')); + % --- CELL + cellval = {a b c d e f g h ii j k (ao(8) + ao(9))}; + pl7 = plist('key', cellval); + % --- STRUCT + structval.a = a; + structval.b = b; + structval.c = c; + structval.d = d; + structval.e = e; + structval.f = f; + structval.g = g; + structval.h = h; + structval.ii = ii; + structval.j = j; + structval.k = k; + pl8 = plist('key', structval); + % --- LTPDA_NUO + % ------ HISTORY + iir = miir(plist('type', 'lowpass')); + pl9 = plist('key', iir.hist); + % ------ UNITS + pl10 = plist('key', unit('m^-1/2 kg V^3/7')); + % ------ PARAM + pl11 = plist('key', param('a', 'char')); + % ------ PROVENANCE + pl12 = plist('key', provenance); + % ------ PZ + pl13 = plist('key', [pz(3) pz(1,2) pz(1-2i) pz(-3)]); + % ------ TIME + pl14 = plist('key', [time(123) time('14:00:00')]); + % ------ SPECWIN + pl15 = plist('key', [specwin('Kaiser', 10, 100) specwin('Hanning', 100)]); + + pl = plist(); + % Evaluate the commands + % The result is stored in the variable 'pl'. + out1 = pl1.plist2cmds; + eval(out1{1}); + out1 = pl; + out2 = pl2.plist2cmds; + eval(out2{1}) + out2 = pl; + out3 = pl3.plist2cmds; + eval(out3{1}) + out3 = pl; + out4 = pl4.plist2cmds; + eval(out4{1}) + out4 = pl; + out5 = pl5.plist2cmds; + eval(out5{1}) + out5 = pl; + out6 = pl6.plist2cmds; + eval(out6{1}) + out6 = pl; + out7 = pl7.plist2cmds; + for pp = numel(out7):-1:1 + eval(out7{pp}) + end + out7 = pl; + out8 = pl8.plist2cmds; + for pp = numel(out8):-1:1 + eval(out8{pp}) + end + out8 = pl; + out9 = pl9.plist2cmds; + for pp = numel(out9):-1:1 + eval(out9{pp}) + end + out9 = pl; + out10 = pl10.plist2cmds; + eval(out10{1}) + out10 = pl; + out11 = pl11.plist2cmds; + eval(out11{1}) + out11 = pl; + out12 = pl12.plist2cmds; + eval(out12{1}) + out12 = pl; + out13 = pl13.plist2cmds; + eval(out13{1}) + out13 = pl; + out14 = pl14.plist2cmds; + eval(out14{1}) + out14 = pl; + out15 = pl15.plist2cmds; + eval(out15{1}) + out15 = pl; + % + stest = true; + catch err + stest = false; + end + + % + % + % 1) Check that the output is a executable plist2cmds + % + % + + atest = true; + if stest + % + if ~eq(pl1, out1, ple2), atest = false; end + if ~eq(pl2, out2, ple2), atest = false; end + if ~eq(pl3, out3, ple2), atest = false; end + if ~eq(pl4, out4, ple2), atest = false; end + if ~eq(pl5, out5, ple2), atest = false; end + if ~eq(pl6, out6, ple2), atest = false; end + if ~eq(pl7, out7, ple2), atest = false; end + if ~eq(pl8, out8, ple2), atest = false; end + if ~eq(pl10, out10, ple2), atest = false; end + if ~eq(pl11, out11, ple2), atest = false; end + if ~eq(pl12, out12, ple2), atest = false; end + if ~eq(pl13, out13, ple2), atest = false; end + if ~eq(pl14, out14, ple2), atest = false; end + if ~eq(pl15, out15, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); +end % END UTP_06 + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_pset.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_pset.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,577 @@ +% UTP_PLIST_PSET a set of UTPs for the plist/pset method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_pset.m,v 1.4 2010/09/02 17:50:44 nicolodi Exp $ +% + +% +% +% The pset method of the plist class set or add a key/value pair a +% param-object into the parameter list. Exist the key in the parameter list +% then becomes the value the new value. +% +% + +function results = utp_plist_pset(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'pset'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PLIST objects + pl1 = plist('a', 1); + pl2 = plist('b', 2); + pl3 = plist('c', 3); + pl4 = plist('d', 4, 'e', 5); + plv = [pl1, pl2, pl3]; + plm = [pl1, pl2; pl3 pl4]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test the modify call works + results = [results utp_07]; % Test with different inputs for the key/value pair + results = [results utp_08]; % Test setting and appending case. + results = [results utp_09]; % Test capital letter of the key. + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the pset method works with a vector of PLIST objects as input. + % + % + function result = utp_02 + + % + % + % Test that the pset method set or add a key/value pair to all PLIST + % objects in the vector. + % + % + + try + % + out = pset(plv, 'new key', 'val'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output is the same as the shape of the input + % 2) Check that the output PLIST contains the new key/value pair. + % + % + + atest = true; + if stest + % + % Check that the shape of the output is the same as the shape of the input + if ~isa(out, 'plist') && size(out) == size(plv), atest = false; end + % Check that the output have all key/value pairs + for ii = 1:numel(plv) + % The method plist/find is tested in the UTP utp_plist_find + if ~isequal(out(ii).find('new key'), 'val'), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the pset method works with a matrix of PLIST objects as input. + % + % + function result = utp_03 + + % + % + % Test that the pset method set or add a key/value pair to all PLIST + % objects in the matrix. + % + % + + try + % + out = pset(plm, 'new key', 'val'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output is the same as the shape of the input + % 2) Check that the output PLIST contains the new key/value pair. + % + % + + atest = true; + if stest + % + % Check that the shape of the output is the same as the shape of the input + if ~isa(out, 'plist') && size(out) == size(plm), atest = false; end + % Check that the output have all key/value pairs + for ii = 1:numel(plm) + % The method plist/find is tested in the UTP utp_plist_find + if ~isequal(out(ii).find('new key'), 'val'), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the pset method works with a list of PLIST objects as input. + % + % + function result = utp_04 + + % + % + % Test that the pset method set or add a key/value pair to all PLIST + % objects in the input. + % + % + + try + % + out = pset(pl1, pl2, pl3, 'new key', 'val'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output is the same as the shape of the input + % 2) Check that the output PLIST contains the new key/value pair. + % + % + + atest = true; + plin = [pl1, pl2, pl3]; + if stest + % + % Check that the shape of the output is the same as the shape of the input + if ~isa(out, 'plist') && size(out) == size(plin), atest = false; end + % Check that the output have all key/value pairs + for ii = 1:numel(plin) + % The method plist/find is tested in the UTP utp_plist_find + if ~isequal(out(ii).find('new key'), 'val'), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the pset method works with a mix of different shaped PLIST + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the pset method set or add a key/value pair to all PLIST + % objects in the input. + % + % + + try + % + out = pset(plm, pl2, plv, 'new key', 'val'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output is the same as the shape of the input + % 2) Check that the output PLIST contains the new key/value pair. + % + % + + atest = true; + plin = [reshape(plm, 1, []), pl2, reshape(plv, 1, [])]; + if stest + % + % Check that the shape of the output is the same as the shape of the input + if ~isa(out, 'plist') && size(out) == size(plin), atest = false; end + % Check that the output have all key/value pairs + for ii = 1:numel(plin) + % The method plist/find is tested in the UTP utp_plist_find + if ~isequal(out(ii).find('new key'), 'val'), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the pset method applies the modify command + % + % + function result = utp_06 + + % + % + % Test that the pset method can modify the input PLIST by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at1 to work with + pleq = plist(pl1); + plmo = plist(pl1); + % modify ain + out = pleq.pset('new key', 'val'); + plmo.pset('new key', 'val'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'out' and 'pleq' are now different. + % 2) Check that 'plmo' and 'out' are the same. + % 3) Check that 'out' and 'plmo' have the new key/value pair + % 4) Check that pleq don't have the new key/value pair + % + % + + atest = true; + if stest + % + % Check that 'out' and 'pleq' are not the same + if eq(out, pleq, ple1), atest = false; end + % Check that 'out' have the new key/value pair and 'pleq' not + if ~isequal(out.find('new key'), 'val'), atest = false; end + if isequal(pleq.find('new key'), 'val'), atest = false; end + % Check 'plmo' have the new key/value pair + if ~isequal(plmo.find('new key'), 'val'), atest = false; end + % Check that 'out' and plmo are the same + if ~eq(out, plmo, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the pset method works for different input variants for the key/value + % pair. + % + % + function result = utp_07 + + % + % + % Test that the pset method accepts param-objects or direct key/value + % pairs as an input. + % + % + + try + % + p1 = param('p1', 1); + p2 = param('p2', 2); + p3 = param('p3', 3); + out1 = pl1.pset([p1, p2], p3); + out2 = pl1.pset('aa', 1, 'bb', 2); + % In this case overwirtes the key 'p3' the value of the param p3 + out3 = pl1.pset(p1, 'aa', 1, [p2 p3], 'p3', 13); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output have all key/value pairs. + % + % + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % + % Check the key 'p1' + assert(isequal(out1.find('p1'), 1)); + assert(isequal(out3.find('p1'), 1)); + % Check the key 'p2' + assert(isequal(out1.find('p2'), 2)); + assert(isequal(out3.find('p2'), 2)); + % Check the key 'p3' + assert(isequal(out1.find('p3'), 3)); + assert(isequal(out3.find('p3'), 13)); + % Check the key 'aa' + assert(isequal(out2.find('aa'), 1)); + assert(isequal(out3.find('aa'), 1)); + % Check the key 'bb' + assert(isequal(out2.find('bb'), 2)); + % + catch ex + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the pset method in the setting and appending case. + % + % + function result = utp_08 + + % + % + % Create an example where the pset method set a key to a new value and + % an example where pset append the new key/value pair + % + % + + try + % + pl_set = plist('a', 1, 'b', 2, 'c', 3); + pl_app = plist('a', 1, 'b', 2, 'c', 3); + pl_set.pset('a', 13); + pl_app.pset('d', 13); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of parametes in the output. + % 2) Check the new key/value pair + % + % + + atest = true; + if stest + % + % Check the correct number of paramter in the output + if pl_set.nparams ~= 3, atest = false; end + if pl_app.nparams ~= 4, atest = false; end + % Check the new key/value pair + if ~isequal(pl_set.find('a'), 13), atest = false; end + if ~isequal(pl_app.find('d'), 13), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test that the pset method sets the key always in capital letter + % + % + function result = utp_09 + + % + % + % Test that the pset method sets the key always in capital letter + % + % + + try + % + out = pl2.pset('This_Id_A_NeW_Key', 1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the key is in capital letters + % + % + + atest = true; + if stest + % + for ii = 1:out.nparams + found = false; + if strcmp(out.params(ii).key, 'THIS_ID_A_NEW_KEY') + found = true; + end + end + if ~found, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_remove.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_remove.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,504 @@ +% UTP_PLIST_REMOVE a set of UTPs for the plist/remove method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_remove.m,v 1.2 2009/07/22 14:02:26 ingo Exp $ +% + +% +% +% The remove method of the plist class remove a parameter from the +% parameter list. +% +% + +function results = utp_plist_remove(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'remove'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PLIST objects + pl1 = plist('a', 1, 'b', 2, 'c', 3); + pl2 = plist('b', 2, 'd', 4); + pl3 = plist('c', 3, 'b', 2); + plv = [pl1, pl2, pl3]; + plm = [pl1, pl2; pl3 pl1]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test the modify call works + results = [results utp_07]; % Test with different inputs for the key/value pair + results = [results utp_08]; % Test negative case. + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('key'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('key')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('key'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the remove method works with a vector of PLIST objects as input. + % + % + function result = utp_02 + + % + % + % Test that the remove method remove the 'key' from all PLIST objects + % in the vector. + % + % + + try + % + out = remove(plv, 'b'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output is the same as the shape of the input + % 2) Check that the output PLIST doesn't contains the key. + % + % + + atest = true; + if stest + % + % Check that the shape of the output is the same as the shape of the input + if ~isa(out, 'plist') && size(out) == size(plv), atest = false; end + % Check that the output doesn't have the key + for ii = 1:numel(out) + if ~isempty(out(ii).find('b')), atest = false; end + if ~isnumeric(out(ii).find('b')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the remove method works with a matrix of PLIST objects as input. + % + % + function result = utp_03 + + % + % + % Test that the remove method remove the 'key' from all PLIST objects + % in the matrix. + % + % + + try + % + out = remove(plm, 'b'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output is the same as the shape of the input + % 2) Check that the output PLIST doesn't contains the key. + % + % + + atest = true; + if stest + % + % Check that the shape of the output is the same as the shape of the input + if ~isa(out, 'plist') && size(out) == size(plm), atest = false; end + % Check that the output doesn't have the key + for ii = 1:numel(out) + if ~isempty(out(ii).find('b')), atest = false; end + if ~isnumeric(out(ii).find('b')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the remove method works with a list of PLIST objects as input. + % + % + function result = utp_04 + + % + % + % Test that the remove method remove the 'key' from all PLIST objects + % of the input. + % + % + + try + % + out = remove(pl1, pl2, pl3, 'b'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output is the same as the shape of the input + % 2) Check that the output PLIST doesn't contains the key. + % + % + + atest = true; + plin = [pl1, pl2, pl3]; + if stest + % + % Check that the shape of the output is the same as the shape of the input + if ~isa(out, 'plist') && size(out) == size(plin), atest = false; end + % Check that the output doesn't have the key + for ii = 1:numel(out) + if ~isempty(out(ii).find('b')), atest = false; end + if ~isnumeric(out(ii).find('b')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the remove method works with a mix of different shaped PLIST + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the remove method remove the 'key' from all PLIST objects + % of the input. + % + % + + try + % + out = remove(plm, plv, pl1, 'b'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output is the same as the shape of the input + % 2) Check that the output PLIST doesn't contains the key. + % + % + + atest = true; + plin = [reshape(plm, 1, []), reshape(plv, 1, []), pl1]; + if stest + % + % Check that the shape of the output is the same as the shape of the input + if ~isa(out, 'plist') && size(out) == size(plin), atest = false; end + % Check that the output doesn't have the key + for ii = 1:numel(out) + if ~isempty(out(ii).find('b')), atest = false; end + if ~isnumeric(out(ii).find('b')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the remove method applies the modify command + % + % + function result = utp_06 + + % + % + % Test that the remove method can modify the input PLIST by calling with no + % output and that the method doesn't change the input of the function + % notation (with a equal sign). + % + % + + try + % + % copy at1 to work with + pleq = plist(pl1); + plmo = plist(pl1); + % modify ain + out = pleq.remove('b'); + plmo.remove('b'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'out' and 'pleq' are now different. + % 2) Check that 'plmo' and 'out' are the same. + % 3) Check that 'out' and 'plmo' don't have the key + % 4) Check that pleq doesn't have the key + % + % + + atest = true; + if stest + % + % Check that 'out' and 'pleq' are not the same + if eq(out, pleq, ple1), atest = false; end + % Check that 'out' don't have key and 'pleq' still have it + if ~isempty(out.find('b')), atest = false; end + if isempty(pleq.find('b')), atest = false; end + % Check 'plmo' don't have the key + if ~isempty(plmo.find('b')), atest = false; end + % Check that 'out' and plmo are the same + if ~eq(out, plmo, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the remove method that it removes the parameter which is defined + % as an index or as a key + % + % + function result = utp_07 + + % + % + % Test the remove method that it removes the parameter which is defined + % as an index or as a key + % + % + + try + % + idx = 2; + out1 = pl1.remove('b'); + out2 = pl1.remove(idx); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + % Check the correct number of parameter + if out1.nparams ~= pl1.nparams - 1, atest = false; end + if out2.nparams ~= pl1.nparams - 1, atest = false; end + % Check the correct number of parameter + if ~isempty(out1.find('b')), atest = false; end + key = pl1.params(idx).key; + if ~isempty(out1.find(key)), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the remove method in a negative case that the key is not in the + % paramter list. + % + % + function result = utp_08 + + % + % + % The remove method doesn't throwns an error if the key doesn't exist + % in the parameter list. + % + % + + try + % + pl1.remove('key'); + stest = true; + % + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_save.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_save.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,497 @@ +% UTP_PLIST_SAVE a set of UTPs for the plist/save method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_save.m,v 1.4 2010/08/31 09:43:48 hewitson Exp $ +% + +% +% +% The save method of the plist class saves a plist object to disk. Save stores +% the variables in a MATLAB formatted file (MAT-file) named filename.mat or in a +% XML fromat named filename.xml +% +% + +function results = utp_plist_save(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'save'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PLIST objects + [pl1, pl2, pl3, pl4, plv, plm] = get_test_objects_plist; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test the modify call works + results = [results utp_07]; % Test plist contains the filename + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(3).plists.isparam('filename'), atest = false; end + if ~io(3).plists.isparam('prefix'), atest = false; end + if ~io(3).plists.isparam('postfix'), atest = false; end + if ~io(3).plists.isparam('individual files'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('filename'), ''), atest = false; end + if ~isequal(io(3).plists.find('prefix'), ''), atest = false; end + if ~isequal(io(3).plists.find('postfix'), ''), atest = false; end + if ~isequal(io(3).plists.find('individual files'), false), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('filename'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the save method works with a vector of PLIST objects as input. + % + % + function result = utp_02 + + % + % + % Test that the save method works for a vector of PLIST objects as input. + % Test both formats 'xml' and 'mat'. + % + % + + try + % + save(plv, 'test.xml'); + save(plv, 'test.mat'); + out1 = plist('test.xml'); + out2 = plist('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the same + % as in 'plv' + % 2) Check that the loaded objects are the same as the saved objects. + % 3) The outputs 'out1' and 'out2' must be the same. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(plv)), atest = false; end + if ~isequal(size(out2), size(plv)), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(plv(kk), out1(kk), ple1), atest = false; end + if ~eq(plv(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the save method works with a matrix of PLIST objects as input. + % + % + function result = utp_03 + + % + % + % Test that the save method works for a matrix of PLIST objects as input. + % Test both formats 'xml' and 'mat'. + % + % + + try + % + save(plm, 'test.xml'); + save(plm, 'test.mat'); + out1 = plist('test.xml'); + out2 = plist('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the same + % as in 'plm' + % 2) Check that the loaded objects are the same as the saved objects. + % 3) The outputs 'out1' and 'out2' must be the same. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(plm)), atest = false; end + if ~isequal(size(out2), size(plm)), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(plm(kk), out1(kk), ple1), atest = false; end + if ~eq(plm(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the save method works with a list of PLIST objects as input. + % + % + function result = utp_04 + + % + % + % Test that the save method works for a list of PLIST objects as input. + % Test both formats 'xml' and 'mat'. + % + % + + try + % + save(pl2, pl3, pl4, 'test.xml'); + save(pl2, pl3, pl4, 'test.mat'); + out1 = plist('test.xml'); + out2 = plist('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the same + % as in the list + % 2) Check that the loaded objects are the same as the saved objects. + % 3) The outputs 'out1' and 'out2' must be the same. + % + % + + atest = true; + plin = [pl2, pl3, pl4]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 3, atest = false; end + if numel(out2) ~= 3, atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(plin(kk), out1(kk), ple1), atest = false; end + if ~eq(plin(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the save method works with a mix of different shaped PLIST objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the save method works with an input of matrices and vectors + % and single PLIST objects. Test both formats 'xml' and 'mat'. + % + % + + try + % + save(pl2,plv,pl3, 'test.xml'); + save(pl2,plv,pl3, 'test.mat'); + out1 = plist('test.xml'); + out2 = plist('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output PLIST object contains the correct data. + % + % + + atest = true; + plin = [pl2, reshape(plv, 1, []), pl3]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 2+numel(plv), atest = false; end + if numel(out2) ~= 2+numel(plv), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(plin(kk), out1(kk), ple1), atest = false; end + if ~eq(plin(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the save method works with the modify command. + % + % + function result = utp_06 + + % + % + % Use the save method with the modifier command. + % + % + + try + % + % copy pl2 to work with + pl = plist(pl2); + pl.save('test.mat'); + pl.save('test.xml'); + out1 = plist('test.mat'); + out2 = plist('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the save method doesn't change the input PLIST object. + % 2) Check the output against the input except. + % + % + + atest = true; + if stest + % + % Check that save doesn't modified the input + if ~eq(plist(pl2), pl, ple1), atest = false; end + % Check the output + if ~eq(pl, out1, ple1), atest = false; end + if ~eq(pl, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Control the method with a plist. + % + % + function result = utp_07 + + % + % + % Test that the save method uses the filename which is stored in a plist. + % + % + + try + % + pl1 = plist('filename', 'test.mat'); + pl2 = plist('filename', 'test.xml'); + save(pl3, pl1); + save(pl3, pl2); + out1 = plist('test.mat'); + out2 = plist('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + % Check the output + if ~eq(pl3, out1, ple1), atest = false; end + if ~eq(pl3, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple1), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_setName.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_setName.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,482 @@ +% UTP_PLIST_SETNAME a set of UTPs for the plist/setName method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_setName.m,v 1.2 2009/07/22 14:02:26 ingo Exp $ +% + +% +% +% The setName method of the plist class sets the name property. +% +% + +function results = utp_plist_setName(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'setName'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PLIST objects + [pl1, pl2, pl3, pl4, plv, plm] = get_test_objects_plist; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test the modify call works + results = [results utp_07]; % Set the property with a plist + results = [results utp_08]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('name'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('name')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('name'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setName method works with a vector of PLIST objects as input. + % + % + function result = utp_02 + + % + % + % Test that the setName method works for a vector of PLIST objects as input. + % + % + + try + % + out = setName(plv, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'plv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(plv)), atest = false; end + % Check name field of each output + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setName method works with a matrix of PLIST objects as input. + % + % + function result = utp_03 + + % + % + % Test that the setName method works for a matrix of PLIST objects as input. + % + % + + try + % + out = setName(plm, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'plm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(plm)), atest = false; end + % Check name field of each output + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setName method works with a list of PLIST objects as input. + % + % + function result = utp_04 + + % + % + % Test that the setName method works for a list of PLIST objects as input. + % + % + + try + % + out = setName(pl2,pl3,pl4, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~strcmp(out(1).name, 'my name'), atest = false; end + if ~strcmp(out(2).name, 'my name'), atest = false; end + if ~strcmp(out(3).name, 'my name'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setName method works with a mix of different shaped PLIST + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the setName method works with an input of matrices and vectors + % and single PLIST objects. + % + % + + try + % + out = setName(pl2,plv,pl3,plm,pl4, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(plm)+numel(plv)), atest = false; end + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setName method can modify the input PLIST object. + % + % + function result = utp_06 + + % + % + % Test that the setName method can modify the input PLIST object + % by calling with no output. + % + % + + try + % + % copy pl2 to work with + ain = plist(pl2); + % modify ain + aout = ain.setName('my name'); + ain.setName('my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'pl2' and 'ain' are now different. + % 2) Check that 'ain' has the correct name field + % + % + + atest = true; + if stest + % + % Check that setName modified the input by comparing to the copy + if eq(plist(pl2), ain, ple1), atest = false; end + % Check that setName doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~strcmp(ain.name, 'my name'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setName method can set the property with a plist. + % + % + function result = utp_07 + + % + % + % Test that the setName method can modify the property 'name' + % with a value in a plist. + % + % + + try + % + pl = plist('name', 'my name'); + out = pl2.setName(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct name field + % + % + + atest = true; + if stest + % + % Check the field 'name' + if ~strcmp(out.name, 'my name'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Check that the setName method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_08 + + % + % + % Call the method with a list of output variables and with a single output + % variable. + % + % + + try + % + [o1, o2] = setName(pl2, pl1, 'new name'); + o3 = setName(pl2, pl1, 'new name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_string.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_string.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,510 @@ +% UTP_PLIST_STRING a set of UTPs for the plist/string method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_string.m,v 1.2 2009/07/22 14:02:26 ingo Exp $ +% + +% +% +% The string method of the plist class writes a command string that can be +% used to recreate the input object(s). But the object should not have more than +% one history step. +% +% + +function results = utp_plist_string(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'string'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PLIST objects + [pl1, pl2, pl3, pl4, plv, plm] = get_test_objects_plist; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Negative test: The object have more than one history step. + results = [results utp_07]; % Test different objects for 'val' + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the string method works with a vector of PLIST objects as input. + % + % + function result = utp_02 + + % + % + % Test that the string method works for a vector of PLIST objects as input. + % + % + + try + % + out = string(plv); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end; + if ~isa(rout, 'plist'), atest = false; end + if numel(rout) ~= numel(plv), atest = false; end + for kk = 1:numel(plv) + if eq(rout(kk), plv(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the string method works with a matrix of PLIST objects as input. + % + % + function result = utp_03 + + % + % + % Test that the string method works for a matrix of PLIST objects as input. + % + % + + try + % + out = string(plm); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'plist'), atest = false; end + if numel(rout) ~= numel(plm), atest = false; end + for kk = 1:numel(plm) + if eq(rout(kk), plm(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the string method works with a list of PLIST objects as input. + % + % + function result = utp_04 + + % + % + % Test that the string method works for a list of PLIST objects as input. + % + % + + try + % + out = string(pl4,pl3); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + plin = [pl4, pl3]; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'plist'), atest = false; end + if numel(rout) ~= numel(plin), atest = false; end + for kk = 1:numel(plin) + if eq(rout(kk), plin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the string method works with a mix of different shaped PLIST objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the string method works with an input of matrices and vectors + % and single PLIST objects. + % + % + + try + % + out = string(pl4,plm,pl3); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + plin = [pl4, reshape(plm, 1, []), pl3]; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'plist'), atest = false; end + if numel(rout) ~= numel(plin), atest = false; end + for kk = 1:numel(plin) + if eq(rout(kk), plin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the string method doesn't work if the PLIST object have more + % than one history step. + % + % + function result = utp_06 + + % + % + % The method string throws an error because the input object have more than + % one history step. + % + % + + try + % + iir = miir(plist('type', 'bandpass')); + iir.setName('Second history step'); + pl = plist('filter', iir); + out = pl.string(); + % + stest = false; + catch err + stest = true; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the string method accepts different objects for the 'val' property. + % + % + function result = utp_07 + + % + % + % Create a plist with all possible objects for the 'val' property. + % + % + + try + % + iir = miir(plist('type', 'lowpass')); + a = 'char'; + b = [1 2i 3; 4i 5 6]; + c = [true false true; false true false]; + d = java.util.TimeZone.getTimeZone('UTC'); + e = sym('[a b c; d e f]'); + f = plist('a', 'char'); + h = unit('m^-1/2 kg V^3/7'); + ii = [pz(3) pz(1,2) pz(1-2i) pz(-3)]; + j = [time(123) time('14:00:00')]; + k = [specwin('Kaiser', 10, 100) specwin('Hanning', 100)]; + % --- CHAR + pl1 = plist('key', 'this is a char'); + % --- NUMERIC + pl2 = plist('key', [1 2i 3; 4i 5 6]); + % --- LOGICAL + pl3 = plist('key', [true false true; false true false]); + % --- JAVA (timezone) + pl4 = plist('key', java.util.TimeZone.getTimeZone('UTC')); + % --- SYM + pl5 = plist('key', sym('[a b c; d e f]')); + % --- PLIST + pl6 = plist('key', plist('a', 'char')); + % --- CELL + cellval = {a b c d e f h ii j k}; + pl7 = plist('key', cellval); + % --- STRUCT + structval.a = a; + structval.b = b; + structval.c = c; + structval.d = d; + structval.e = e; + structval.f = f; + structval.h = h; + structval.ii = ii; + structval.j = j; + structval.k = k; + pl8 = plist('key', structval); + % --- LTPDA_NUO + % ------ HISTORY + iir = miir(plist('type', 'lowpass')); + pl9 = plist('key', iir.hist); + % ------ UNITS + pl10 = plist('key', unit('m^-1/2 kg V^3/7')); + % ------ PARAM + pl11 = plist('key', param('a', 'char')); + % ------ PROVENANCE + pl12 = plist('key', provenance); + % ------ PZ + pl13 = plist('key', [pz(3) pz(1,2) pz(1-2i) pz(-3)]); + % ------ TIME + pl14 = plist('key', [time(123) time('14:00:00')]); + % ------ SPECWIN + pl15 = plist('key', [specwin('Kaiser', 10, 100) specwin('Hanning', 100)]); + out1 = eval(pl1.string); + out2 = eval(pl2.string); + out3 = eval(pl3.string); + out4 = eval(pl4.string); + out5 = eval(pl5.string); + out6 = eval(pl6.string); + out7 = eval(pl7.string); + out8 = eval(pl8.string); + out9 = eval(pl9.string); + out10 = eval(pl10.string); + out11 = eval(pl11.string); + out12 = eval(pl12.string); + out13 = eval(pl13.string); + out14 = eval(pl14.string); + out15 = eval(pl15.string); + % + stest = true; + catch err + stest = false; + end + + % + % + % 1) Check that the output is a executable string + % + % + + atest = true; + if stest + % + if ~eq(pl1, out1, ple2), atest = false; end + if ~eq(pl2, out2, ple2), atest = false; end + if ~eq(pl3, out3, ple2), atest = false; end + if ~eq(pl4, out4, ple2), atest = false; end + if ~eq(pl5, out5, ple2), atest = false; end + if ~eq(pl6, out6, ple2), atest = false; end + if ~eq(pl7, out7, ple2), atest = false; end + if ~eq(pl8, out8, ple2), atest = false; end + if ~eq(pl10, out10, ple2), atest = false; end + if ~eq(pl11, out11, ple2), atest = false; end + if ~eq(pl12, out12, ple2), atest = false; end + if ~eq(pl13, out13, ple2), atest = false; end + if ~eq(pl14, out14, ple2), atest = false; end + if ~eq(pl15, out15, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_submit.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_submit.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,530 @@ +% UTP_PLIST_SUBMIT a set of UTPs for the plist/submit method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_submit.m,v 1.14 2010/08/18 09:25:55 ingo Exp $ +% + +% +% +% The bsubmit method of the plist class submits a collection of objects +% in XML form to an LTPDA Repository. The type of the objects are +% independent. +% +% + +function results = utp_plist_submit(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'submit'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + [pl1, pl2, pl3, pl4, plv, plm] = get_test_objects_plist; + plForAutoTest = plist('no dialog', true, 'use selector', false); + + try + conn = utpGetConnection(); + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_plist_submit: submit plist'; + sinfo.experiment_description = 'utp_plist_submit: description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test output of the data + catch + end + + % Close connection + utpCloseConnection(conn) + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 16, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('sinfo filename'), atest = false; end + if ~io(3).plists.isparam('binary'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isEmptyChar(io(3).plists.find('sinfo filename')), atest = false; end + if ~isequal(io(3).plists.find('binary'), false), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the submit method works with a vector of PLIST objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the submit method works for a vector of PLIST objects as + % input. + % + % + + try + % + [ids, cids] = submit(plv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + robjs3 = ltpda_uo.retrieve(conn, ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(plv), atest = false; end + if numel(robjs2) ~= numel(plv), atest = false; end + if numel(robjs3) ~= numel(plv), atest = false; end + % Check the retrieved object against the submitted + if ~eq(plv, [robjs1{:}]), atest = false; end + if ~eq(plv, [robjs2{:}]), atest = false; end + if ~eq(plv, [robjs3{:}]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the submit method works with a matrix of PLIST objects as + % input. + % + % + function result = utp_03 + + % + % + % Tests that the submit method works with a matrix of PLIST objects + % as input. + % + % + + try + % + [ids, cids] = submit(plm, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + robjs3 = ltpda_uo.retrieve(conn, ids(1), ids(2), ids(3), ids(4), ids(5), ids(6)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(plm), atest = false; end + if numel(robjs2) ~= numel(plm), atest = false; end + if numel(robjs3) ~= numel(plm), atest = false; end + % Check the retrieved object against the submitted + if ~eq(plm, [robjs1{:}]), atest = false; end + if ~eq(plm, [robjs2{:}]), atest = false; end + if ~eq(plm, [robjs3{:}]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the submit method works with a list of PLIST objects as + % input. + % + % + function result = utp_04 + + % + % + % Tests that the submit method works with a list of PLIST objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = submit(pl1, pl, iir, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + robjs3 = ltpda_uo.retrieve(conn, ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 3, atest = false; end + if numel(robjs2) ~= 3, atest = false; end + if numel(robjs3) ~= 3, atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{2}, pl1), atest = false; end + if ~eq(robjs1{3}, pl), atest = false; end + if ~eq(robjs1{1}, iir), atest = false; end + % Check robjs2 + if ~eq(robjs2{2}, pl1), atest = false; end + if ~eq(robjs2{3}, pl), atest = false; end + if ~eq(robjs2{1}, iir), atest = false; end + % Check robjs3 + if ~eq(robjs3{2}, pl1), atest = false; end + if ~eq(robjs3{3}, pl), atest = false; end + if ~eq(robjs3{1}, iir), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the abs method works with a mix of different shaped PLIST + % objects as input. + % + % + function result = utp_05 + + % + % + % Tests that the submit method works with a list of PLIST objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = submit(pl, plm, iir, plv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 2 + numel(plm) + numel(plv), atest = false; end + if numel(robjs2) ~= 2 + numel(plm) + numel(plv), atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, iir), atest = false; end + if ~eq(robjs1{2}, pl), atest = false; end + if ~eq(robjs1{3}, plm(1)), atest = false; end + if ~eq(robjs1{4}, plm(2)), atest = false; end + if ~eq(robjs1{5}, plm(3)), atest = false; end + if ~eq(robjs1{6}, plm(4)), atest = false; end + if ~eq(robjs1{7}, plm(5)), atest = false; end + if ~eq(robjs1{8}, plm(6)), atest = false; end + if ~eq(robjs1{9}, plv(1)), atest = false; end + if ~eq(robjs1{10}, plv(2)), atest = false; end + if ~eq(robjs1{11}, plv(3)), atest = false; end + % Check robjs2 + for ii = 1:numel(robjs2) + if ~eq(robjs1{ii}, robjs2{ii}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tthe submit method properly applies history. + % + % + function result = utp_06 + + % + % + % Tthe submit method properly applies history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the submit method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [ids, cids] = submit(pl1, pl2, sinfo, plForAutoTest); + + [o1, o2] = ltpda_uo.retrieve(conn, 'Collection', cids); + o3 = ltpda_uo.retrieve(conn, 'Collection', cids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the output + if ~eq(o1, pl1), atest = false; end + if ~eq(o2, pl2), atest = false; end + if ~eq(o3{1}, pl1), atest = false; end + if ~eq(o3{2}, pl2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/plist/utp_plist_update.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/plist/utp_plist_update.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,396 @@ +% UTP_PLIST_UPDATE a set of UTPs for the plist/update method +% +% M Hewitson 06-08-08 +% +% $Id: utp_plist_update.m,v 1.13 2010/08/18 09:25:55 ingo Exp $ +% + +% +% +% The update method of the plist class updates (replace) an LTPDA object +% in the repository with the given replacement object. It is only possible +% to update one object. This is the reason why the general UTPs are not +% possible. +% +% + +function results = utp_plist_update(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'plist'; + mthd = 'update'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + c = 'string'; + n = 123+5i; + l = true; + sy = sym('symbol'); + t = time('14:00:00'); + s = struct('a', c, 'b', n, 'c', l, 'd', sy, 'time', t); + ce = {'asd', [1 2 3; 4 5i 6], [true false], [sym('a'); sym('B')], s}; + + obj = plist('char', c, 'number', n, 'logical', l, 'symbolic', sy, 'struct', s, 'cell', ce); + obj.setName(); + + plForAutoTest = plist('no dialog', true, 'use selector', false); + + try + conn = utpGetConnection(); + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_plist_update: update plist'; + sinfo.experiment_description = 'utp_plist_update: description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + [ids, cids] = submit(obj, sinfo, plForAutoTest); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Test with conn + results = [results utp_03]; % Test with sinfo + results = [results utp_04]; % Test update of an binary file + results = [results utp_05]; % Test replace with other object + catch + end + + % Close connection + utpCloseConnection(conn) + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 15, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('binary'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isequal(io(3).plists.find('binary'), false), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_02 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Use a database object (conn) to establish the connection. + % + % + + try + % + % Make some changes to the object. + uobj = obj.setName('I was updated (conn)'); + update(uobj, ids, conn, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_03 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Use a database info structure (sinfo) to establish the connection. + % + % + + try + % + % Make some changes to the object. + uobj = obj.setName('I was updated (sinfo)'); + update(uobj, ids, sinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_04 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Check that the update method also updates objects which are stored as + % a binary file. + % + % + + try + % + % Submit the object as a binary + [ids_bin, cids] = bsubmit(obj, sinfo, plForAutoTest); + % Make some changes to the object. + uobj = obj.setName('I was updated (sinfo)'); + update(uobj, ids_bin, sinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids_bin' + robj = ltpda_uo.retrieve(conn, ids_bin); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the update method replaces the object in the repository with + % a completely other object. + % + % + function result = utp_05 + + % + % + % Tests that the update method replaces the object in the repository + % with a completely other object. + % Replace the plist object with a filter object. + % + % + + try + % + % Make some changes to the object. + uobj = miir(plist('type', 'lowpass')); + update(uobj, ids, sinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/test_pzm.fil --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/test_pzm.fil Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,20 @@ +# Filter that models one pole of the dynamics of test-mass 1. +# +# This filter should be run forwards and backwards to achieve +# the desired response. In ltpda use filtfilt(). +# +# M Hewitson +# +# $Id: test_pzm.fil,v 1.1 2009/01/05 17:48:41 ingo Exp $ +# + +zero 0.000181464554896431 # comes from w_1 +pole 5 # stabilise filter out of band +factor 0.00114017542509914 # sqrt(1.3e-6) + +freq log 1u 50 1000 + +iir 100 start 4 4 + + + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_bsubmit.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_bsubmit.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,526 @@ +% UTP_PZMODEL_BSUBMIT a set of UTPs for the pzmodel/bsubmit method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_bsubmit.m,v 1.14 2010/08/18 09:25:55 ingo Exp $ +% + +% +% +% The bsubmit method of the pzmodel class submits a collection of objects +% in binary form to an LTPDA Repository. The type of the objects are +% independent. +% +% + +function results = utp_pzmodel_bsubmit(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'bsubmit'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel; + plForAutoTest = plist('no dialog', true, 'use selector', false); + + conn = utpGetConnection(); + try + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_pzmodel_bsubmit: submit pzmodel'; + sinfo.experiment_description = 'utp_pzmodel_bsubmit: description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test output of the data + catch + end + + % Close connection + utpCloseConnection(conn); + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 15, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('sinfo filename'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isEmptyChar(io(3).plists.find('sinfo filename')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the bsubmit method works with a vector of PZMODEL objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the bsubmit method works for a vector of PZMODEL objects as + % input. + % + % + + try + % + [ids, cids] = bsubmit(pzv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(pzv), atest = false; end + if numel(robjs2) ~= numel(pzv), atest = false; end + if numel(robjs3) ~= numel(pzv), atest = false; end + % Check the retrieved object against the submitted + if ~eq(pzv, [robjs1{:}]), atest = false; end + if ~eq(pzv, [robjs2{:}]), atest = false; end + if ~eq(pzv, [robjs3{:}]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the bsubmit method works with a matrix of PZMODEL objects as + % input. + % + % + function result = utp_03 + + % + % + % Tests that the bsubmit method works with a matrix of PZMODEL objects + % as input. + % + % + + try + % + [ids, cids] = bsubmit(pzm, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3), ids(4), ids(5), ids(6)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(pzm), atest = false; end + if numel(robjs2) ~= numel(pzm), atest = false; end + if numel(robjs3) ~= numel(pzm), atest = false; end + % Check the retrieved object against the submitted + if ~eq(pzm, reshape([robjs1{:}], size(pzm))), atest = false; end + if ~eq(pzm, reshape([robjs2{:}], size(pzm))), atest = false; end + if ~eq(pzm, reshape([robjs3{:}], size(pzm))), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the bsubmit method works with a list of PZMODEL objects as + % input. + % + % + function result = utp_04 + + % + % + % Tests that the bsubmit method works with a list of PZMODEL objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = bsubmit(pz1, pl, iir, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 3, atest = false; end + if numel(robjs2) ~= 3, atest = false; end + if numel(robjs3) ~= 3, atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, pz1), atest = false; end + if ~eq(robjs1{3}, pl), atest = false; end + if ~eq(robjs1{2}, iir), atest = false; end + % Check robjs2 + if ~eq(robjs2{1}, pz1), atest = false; end + if ~eq(robjs2{3}, pl), atest = false; end + if ~eq(robjs2{2}, iir), atest = false; end + % Check robjs3 + if ~eq(robjs3{1}, pz1), atest = false; end + if ~eq(robjs3{3}, pl), atest = false; end + if ~eq(robjs3{2}, iir), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the abs method works with a mix of different shaped PZMODEL + % objects as input. + % + % + function result = utp_05 + + % + % + % Tests that the bsubmit method works with a list of PZMODEL objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = bsubmit(pl, pzm, iir, pzv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 2 + numel(pzm) + numel(pzv), atest = false; end + if numel(robjs2) ~= 2 + numel(pzm) + numel(pzv), atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, pzm(1)), atest = false; end + if ~eq(robjs1{2}, pzm(2)), atest = false; end + if ~eq(robjs1{3}, pzm(3)), atest = false; end + if ~eq(robjs1{4}, pzm(4)), atest = false; end + if ~eq(robjs1{5}, pzm(5)), atest = false; end + if ~eq(robjs1{6}, pzm(6)), atest = false; end + if ~eq(robjs1{7}, iir), atest = false; end + if ~eq(robjs1{8}, pzv(1)), atest = false; end + if ~eq(robjs1{9}, pzv(2)), atest = false; end + if ~eq(robjs1{10}, pzv(3)), atest = false; end + if ~eq(robjs1{11}, pl), atest = false; end + % Check robjs2 + if ~isequalwithequalnans(robjs1, robjs2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tthe bsubmit method properly applies history. + % + % + function result = utp_06 + + % + % + % Tthe bsubmit method properly applies history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the bsubmit method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [ids, cids] = bsubmit(pz1, pz2, sinfo, plForAutoTest); + + [o1, o2] = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + o3 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the output + if ~eq(o1, pz1), atest = false; end + if ~eq(o2, pz2), atest = false; end + if ~eq(o3{1}, pz1), atest = false; end + if ~eq(o3{2}, pz2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_char.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_char.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,357 @@ +% UTP_PZMODEL_CHAR a set of UTPs for the pzmodel/char method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_char.m,v 1.3 2010/05/06 07:22:06 ingo Exp $ +% + +% +% +% The char method of the pzmodel class converts the objects into one character string +% which contains information of the object. +% +% + +function results = utp_pzmodel_char(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'char'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PZMODEL objects + [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the char method works with a vector of PZMODEL objects as input. + % + % + function result = utp_02 + + % + % + % Test that the char method works for a vector of PZMODEL objects as input. + % + % + + try + % + out = char(pzv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end; + for kk = 1:numel(pzv) + if isempty(strfind(out, 'pzmodel(')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the char method works with a matrix of PZMODEL objects as input. + % + % + function result = utp_03 + + % + % + % Test that the char method works for a matrix of PZMODEL objects as input. + % + % + + try + % + out = char(pzm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(pzm) + if isempty(strfind(out, 'pzmodel(')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the char method works with a list of PZMODEL objects as input. + % + % + function result = utp_04 + + % + % + % Test that the char method works for a list of PZMODEL objects as input. + % + % + + try + % + out = char(pz5,pz4,pz3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + pzmin = [pz5,pz4,pz3]; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(pzmin) + if isempty(strfind(out, 'pzmodel(')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the char method works with a mix of different shaped PZMODEL objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the char method works with an input of matrices and vectors + % and single PZMODEL objects. + % + % + + try + % + out = char(pz2,pzv,pz3,pzm,pz5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + pzmin = [pz2,reshape(pzv,1,[]),pz3,reshape(pzm,1,[]),pz5]; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(pzmin) + if isempty(strfind(out, 'pzmodel(')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the char method properly applies history. + % + % + function result = utp_06 + + % + % + % The method char doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_copy.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_copy.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,50 @@ +% UTP_PZMODEL_COPY a set of UTPs for the pzmodel/copy method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_copy.m,v 1.2 2009/08/08 12:21:40 hewitson Exp $ +% + +% +% +% The copy method of the pzmodel class copies the input object depending of the +% second input. +% +% + +function results = utp_pzmodel_copy(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'copy'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_69(class, 1, 1, ple2)]; + results = [results utp_69(class, 1, 3, ple2)]; + results = [results utp_69(class, 2, 3, ple2)]; + + 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 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_created.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_created.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,485 @@ +% UTP_PZMODEL_CREATED a set of UTPs for the pzmodel/created method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_created.m,v 1.2 2009/07/23 18:56:38 ingo Exp $ +% + +% +% +% The created method of the pzmodel returns a time object of the last +% modification. For this uses the created method the 'proctime' property of +% the last history step and computs from this value a timeobject. +% +% + +function results = utp_pzmodel_created(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'created'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PZMODEL objects + [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test empty object + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the created method works with a vector of PZMODEL objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the created method works for a vector of PZMODEL objects as + % input. + % + % + + try + % + out = created(pzv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pzv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if ~isequal(size(out), size(pzv)), atest = false; end + % Check the time-object + for kk=1:numel(out) + if out(kk).utc_epoch_milli ~= pzv(kk).hist.proctime, atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the created method works with a matrix of PZMODEL objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the created method works for a matrix of PZMODEL objects as + % input. + % + % + + try + % + out = created(pzm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pzm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if ~isequal(size(out), size(pzm)), atest = false; end + % Check time-object + for kk=1:numel(out) + if out(kk).utc_epoch_milli ~= pzm(kk).hist.proctime, atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the created method works with a list of PZMODEL objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the created method works for a list of PZMODEL objects as + % input. + % + % + + try + % + out = created(pz1,pz2,pz3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if out(1).utc_epoch_milli ~= pz1.hist.proctime, atest = false; end + if out(2).utc_epoch_milli ~= pz2.hist.proctime, atest = false; end + if out(3).utc_epoch_milli ~= pz3.hist.proctime, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the created method works with a mix of different shaped + % PZMODEL objects as input. + % + % + function result = utp_05 + + % + % + % Test that the created method works with an input of matrices and + % vectors and single PZMODEL objects. + % + % + + try + % + out = created(pz1,pzv,pz2,pzm,pz3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + pzmin = [pz1,reshape(pzv,1,[]),pz2,reshape(pzm,1,[]),pz3]; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(pzm)+numel(pzv)), atest = false; end + for kk=1:numel(out) + if out(kk).utc_epoch_milli ~= pzmin(kk).hist.proctime, atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the created method properly applies history + % + % + function result = utp_06 + + % + % + % This method doesn't change the input object, thus no history is added + % to the object. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the created method can be used with the modify command. + % + % + function result = utp_07 + + % + % + % Tests that the created method can be used with the modify command. + % + % + + try + % + out1 = pz3.created; + out2 = pzm.created; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the single object + % 2) Check the matrix object + % + % + + atest = true; + if stest + % + % Check the single object + if out1.utc_epoch_milli ~= pz3.hist.proctime, atest = false; end + % Check the matrix + for kk = 1:numel(out2) + if out2(kk).utc_epoch_milli ~= pzm(kk).hist.proctime, atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the created method retruns always a well defined time object + % even for an empty input object. + % + % + function result = utp_08 + + % + % + % Test that the created method with an empty 'PZMODEL object + % + % + + try + % + pzm = pzmodel(); + out = pzm.created; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a time object with a ell defined time. + % + % + + atest = true; + if stest + % + if ~isa(out, 'time'), atest = false; end + if isnan(out.utc_epoch_milli), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_creator.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_creator.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,520 @@ +% UTP_PZMODEL_CREATED a set of UTPs for the pzmodel/creator method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_creator.m,v 1.2 2009/07/23 18:56:38 ingo Exp $ +% + +% +% +% The creator method of the pzmodel extract the creator(s)/modifier from +% the history. Depending to the input parameter returns this method all +% creator/modifier or only the last creator/modifier. +% +% + +function results = utp_pzmodel_creator(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'creator'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PZMODEL objects + [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with different creator/modifier + results = [results utp_09]; % Test negative case for the option 'all' + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('option'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('option')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('option'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the creator method works with a vector of PZMODEL objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the creator method works for a vector of PZMODEL objects as + % input. + % + % + + try + % + out = creator(pzv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pzv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(pzv), atest = false; end + % Check the creator + curr_creator = provenance(); + for kk=1:numel(out) + if ~strcmp(out{kk}, curr_creator.creator), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the creator method works with a matrix of PZMODEL objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the creator method works for a matrix of PZMODEL objects as + % input. + % + % + + try + % + out = creator(pzm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pzm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(pzm), atest = false; end + % Check creator + curr_creator = provenance(); + for kk=1:numel(out) + if ~strcmp(out{kk}, curr_creator.creator), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the creator method works with a list of PZMODEL objects as + % input. + % + % + function result = utp_04 + + % + % + % The creator method doesn't work for a list of PZMODEL objects as input. + % + % + + % + try + creator(pz1,pz2,pz3); + stest = false; + catch + stest = true; + end + % + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the creator method works with a mix of different shaped + % PZMODEL objects as input. + % + % + function result = utp_05 + + % + % + % The creator method doesn't work with different shaped input objects. + % + % + + % + try + creator(pz1,pzv,pz2,pzm,pz3); + stest = false; + catch + stest = true; + end + % + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the creator method properly applies history + % + % + function result = utp_06 + + % + % + % This method doesn't change the input object, thus no history is added + % to the object. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the creator method can be used with the modify command. + % + % + function result = utp_07 + + % + % + % Tests that the creator method can be used with the modify command. + % + % + + try + % + out1 = pz3.creator; + out2 = pzm.creator; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the single object + % 2) Check the matrix object + % + % + + atest = true; + if stest + % + curr_creator = provenance(); + % Check the single object + if ~strcmp(out1, curr_creator.creator), atest = false; end + % For a single object must be the the output a char string + if ~ischar(out1), atest = false; end + % Check the matrix + for kk = 1:numel(out2) + if ~strcmp(out2{kk}, curr_creator.creator), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the creator method retruns all creator(s)/modifier(s) which + % are in the history. + % + % + function result = utp_08 + + % + % + % Test that the creator method uses the option 'all' direct or in a + % plist. The test file must have the modifier 'first', 'second' and + % 'third' + % + % + + try + % + % Read object with different modifier + pz = pzmodel('test_pzmodel_diff_creator.xml'); + out1 = pz.creator; + out2 = pz.creator('all'); + out3 = pz.creator(plist('option', 'all')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that out1 contains only one creator + % 2) Check that out2 contain more creator/modifier + % + % + + atest = true; + if stest + % + if ~ischar(out1), atest = false; end + if ~strmatch('fist', out2), atest = false; end + if ~strmatch('second', out2), atest = false; end + if ~strmatch('third', out2), atest = false; end + if ~strmatch('fist', out3), atest = false; end + if ~strmatch('second', out3), atest = false; end + if ~strmatch('third', out3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Tests the negative case for the option 'all'. + % + % + function result = utp_09 + + % + % + % Test that the creator method throws an error if the option 'all' is + % used in connection with a matrix/vector of PZMODEL objects. + % + % + + try + % + pzm.creator('all'); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_display.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_display.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,361 @@ +% UTP_PZMODEL_DISPLAY a set of UTPs for the pzmodel/display method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_display.m,v 1.2 2009/07/23 18:56:38 ingo Exp $ +% + +% +% +% The display method of the pzmodel class prints defined values of an PZMODEL object. +% MATLAB calls display when it interprets an object that is not terminated +% by a semicolon. +% +% + +function results = utp_pzmodel_display(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'display'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PZMODEL objects + [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the display method works with a vector of PZMODEL objects as input. + % + % + function result = utp_02 + + % + % + % Test that the display method works for a vector of PZMODEL objects as input. + % + % + + try + % + pzv + out = display(pzv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + % Check the output + if ~iscell(out), atest = false; end; + for kk = 1:numel(pzv) + if isempty(strfind(out, pzv(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the display method works with a matrix of PZMODEL objects as input. + % + % + function result = utp_03 + + % + % + % Test that the display method works for a matrix of PZMODEL objects as input. + % + % + + try + % + pzm + out = display(pzm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(pzm) + if isempty(strfind(out, pzm(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the display method works with a list of PZMODEL objects as input. + % + % + function result = utp_04 + + % + % + % Test that the display method works for a list of PZMODEL objects as input. + % + % + + try + % + pz1,pz2,pz3 + out = display(pz1,pz2,pz3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + pzmin = [pz1,pz2,pz3]; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(pzmin) + if isempty(strfind(out, pzmin(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the display method works with a mix of different shaped + % PZMODEL objects as input. + % + % + function result = utp_05 + + % + % + % Test that the display method works with an input of matrices and vectors + % and single PZMODEL objects as. + % + % + + try + % + out = display(pz4,pzv,pz3,pzm,pz5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + pzmin = [pz4,reshape(pzv,1,[]),pz3,reshape(pzm,1,[]),pz5]; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(pzmin) + if isempty(strfind(out, pzmin(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the display method properly applies history. + % + % + function result = utp_06 + + % + % + % The method display doesn't change the data, thus it is not possible to + % check the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_eq.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_eq.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,583 @@ +% UTP_PZMODEL_EQ a set of UTPs for the pzmodel/eq method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_eq.m,v 1.8 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The eq() method of the pzmodel class pzm1 == pzm2 compares each element of an +% pzm object with the corresponding element of an second pzm object and returns +% a logical 1 (true) where pzm1 and pzm2 are equal, or logical 0 (false) +% where they are not equal. +% +% + +function results = utp_pzmodel_eq(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'eq'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PZMODEL objects + [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test with the exception list 'name' + results = [results utp_08]; % Test with the exception list 'iunits' + results = [results utp_09]; % Test with the exception list 'ounits' + results = [results utp_10]; % Test exception list in a plist + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check number of SETS + if numel(io(2).sets) ~= 1, atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + % SET 'Default' + % Check key + if ~io(3).plists.isparam('Exceptions'), atest = false; end + if ~io(3).plists.isparam('Tol'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('Exceptions'), {}), atest = false; end + if ~isequal(io(3).plists.find('Tol'), eps(1)), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('Exceptions'), {{}}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('Tol'), {eps(1)}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the eq method works with a vector of PZMODEL objects as input. + % + % + function result = utp_02 + + % + % + % Test that the eq method works for a vector of PZMODEL objects as input. + % Test the positive and the negative case. + % + % + + try + % + pzm = pz2.setName('my name'); + pzv1 = [pz5, pz3, pz4, pz2]; + pzv2 = [pz5, pz3, pz4, pzm]; + out1 = eq(pzv1, pzv1); + out2 = eq(pzv1, pzv2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the eq function. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the eq method works with a matrix of PZMODEL objects as input. + % + % + function result = utp_03 + + % + % + % Test that the eq method works for a matrix of PZMODEL objects as input. + % Test the positive and the negative case. + % + % + + try + % + pzm = pz2.setName('my name'); + pzmm1 = [pz5, pz3, pz2, pz2, pz4, pz5]; + pzmm2 = [pz5, pz3, pzm; pz2, pz4, pz5]; + out1 = eq(pzmm1, pzmm1); + out2 = eq(pzmm1, pzmm2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the eq function. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the eq method works with a list of PZMODEL objects as input. + % + % + function result = utp_04 + + % + % + % The eq method doesn't works for a list of PZMODEL objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the eq method works with a mix of different shaped PZMODEL objects + % as input. + % + % + function result = utp_05 + + % + % + % The eq method doesn't works for a list of PZMODEL objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the eq method properly applies history. + % + % + function result = utp_06 + + % + % + % The eq method doesn't change the PZMODEL object, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_07 + + % + % + % Test the eq method with the exception 'name'. Use the option 'internal' to + % suppress the history. It is necessary to add 'created' to the exception + % list because pzm is created at an other time. + % + % + + try + % + pzm = testCallerIsMethod(@setName, pz2, 'my name'); + out1 = eq(pzm, pz2); + out2 = eqLocal(pzm, pz2, 'name'); + out3 = eqLocal(pzm, pz2, 'pzmodel/name'); + out4 = eq(pzm.hist, pz2.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_08 + + % + % + % Test the eq method with the exception 'iunits'. Use the option 'internal' + % to suppress the history. It is necessary to add 'created' to the exception + % list because pzm is created at an other time. + % + % + + try + % + pzm = testCallerIsMethod(@setIunits, pz2, unit('Hz')); + out1 = eq(pzm, pz2); + out2 = eqLocal(pzm, pz2, 'iunits'); + out3 = eqLocal(pzm, pz2, 'pzmodel/iunits'); + out4 = eq(pzm.hist, pz2.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_09 + + % + % + % Test the eq method with the exception 'ounits'. Use the option 'internal' + % to suppress the history. It is necessary to add 'created' to the exception + % list because pzm is created at an other time. + % + % + + try + % + pzm = testCallerIsMethod(@setOunits, pz2, unit('V')); + out1 = eq(pzm, pz2); + out2 = eqLocal(pzm, pz2, 'ounits'); + out3 = eqLocal(pzm, pz2, 'pzmodel/ounits'); + out4 = eq(pzm.hist, pz2.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Test the eq method with an exception list which is in a plist. + % + % + function result = utp_10 + + % + % + % Test that the eq method uses the exception list in a plist. + % + % + + try + % + pzm = testCallerIsMethod(@setName, pz2, 'my name'); + pl = plist('Exceptions', {'name', 'UUID'}); + out1 = eq(pzm, pz2); + out2 = eq(pzm, pz2, pl); + out3 = eq(pzm, pz2, pl); + out4 = eq(pzm.hist, pz2.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + function res = eqLocal(obj1, obj2, ex) + e = ple1.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {ex}]); + + res = eq(obj1, obj2, ple); + end +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_get.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_get.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,294 @@ +% UTP_PZMODEL_GET a set of UTPs for the pzmodel/get method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_get.m,v 1.3 2011/03/29 13:03:29 ingo Exp $ +% + +% +% +% The get method of the pzmodel class returns the value of an object +% property. This is a very simple method which accepts only one pzmodel as +% input thus are the most general units test not possible. +% +% + +function results = utp_pzmodel_get(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'get'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Algorithm test + results = [results utp_03]; % Algorithm test with a plist + results = [results utp_04]; % Negative test with more than one pzmodel + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('property'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('property')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('property'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests the get method of the pzmodel class. + % + % + function result = utp_02 + + % + % + % Test that the get returns returns the value of the specified + % property. Do this for all properties of the PZMODEL object. + % + % + + try + % + pzm = pzmodel(2, [pz(1) pz(1+2i)], pz(10), unit('V'), unit('Hz')); + out1 = get(pzm, 'gain'); + out2 = get(pzm, 'poles'); + out3 = get(pzm, 'zeros'); + out4 = get(pzm, 'delay'); + out6 = get(pzm, 'iunits'); + out7 = get(pzm, 'ounits'); + out8 = get(pzm, 'hist'); + out9 = get(pzm, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the correct value of the output + % + % + + atest = true; + if stest + % + if ~isequal(out1, pzm.gain), atest = false; end + if ~eq(out2, pzm.poles), atest = false; end + if ~eq(out3, pzm.zeros), atest = false; end + if ~isequal(out4, pzm.delay), atest = false; end + if ~eq(out6, pzm.iunits), atest = false; end + if ~eq(out7, pzm.ounits), atest = false; end + if ~eq(out8, pzm.hist), atest = false; end + if ~isequal(out9, pzm.name), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the get method works with a plist. + % + % + function result = utp_03 + + % + % + % Test that the get returns returns the value of the specified + % property which is defined in a plist. + % + % + + try + % + pzm = pzmodel(2, [pz(1) pz(1+2i)], pz(10), unit('V'), unit('Hz')); + pl1 = plist('property', 'gain'); + pl2 = plist('property', 'poles'); + pl3 = plist('property', 'zeros'); + pl4 = plist('property', 'delay'); + pl6 = plist('property', 'iunits'); + pl7 = plist('property', 'ounits'); + pl8 = plist('property', 'hist'); + pl9 = plist('property', 'name'); + out1 = get(pzm, pl1); + out2 = get(pzm, pl2); + out3 = get(pzm, pl3); + out4 = get(pzm, pl4); + out6 = get(pzm, pl6); + out7 = get(pzm, pl7); + out8 = get(pzm, pl8); + out9 = get(pzm, pl9); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the correct value of the output + % + % + + atest = true; + if stest + % + if ~isequal(out1, pzm.gain), atest = false; end + if ~eq(out2, pzm.poles), atest = false; end + if ~eq(out3, pzm.zeros), atest = false; end + if ~isequal(out4, pzm.delay), atest = false; end + if ~eq(out6, pzm.iunits), atest = false; end + if ~eq(out7, pzm.ounits), atest = false; end + if ~eq(out8, pzm.hist), atest = false; end + if ~isequal(out9, pzm.name), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests the get method of the pzmodel class. + % + % + function result = utp_04 + + % + % + % Test that the get throws an error if the input are more than + % one PZMODEL object. + % + % + + try + % + pzm = pzmodel(2, [pz(1) pz(1+2i)], pz(10)); + out = get([pzm, pzm], 'name'); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_getlowerFreq.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_getlowerFreq.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,212 @@ +% UTP_PZMODEL_GETLOWERFREQ a set of UTPs for the pzmodel/getlowerFreq method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_getlowerFreq.m,v 1.3 2009/07/23 18:56:38 ingo Exp $ +% + +% +% +% The getlowerFreq method of the pzmodel class gets the frequency of the lowest +% pole or zero in the model. This is a very simple method which accepts only one +% pzmodel as input thus are the most general units test not possible. +% +% + +function results = utp_pzmodel_getlowerFreq(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'getlowerFreq'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Algorithm test + results = [results utp_03]; % Negative test with more than one pzmodel + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests the getlowerFreq method of the pzmodel class. + % + % + function result = utp_02 + + % + % + % Test that the getlowerFreq returns the lowest frequence of the lowest + % pole or zero in the model. + % + % + + try + % + p=[pz(3,2) pz(40)]; %f=3,40 + z=[pz(2,3) pz(100)]; %f=2,100 + pzm = pzmodel(10, p, z); + out = getlowerFreq(pzm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + if out ~= 2, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests the getlowerFreq method of the pzmodel class. + % + % + function result = utp_03 + + % + % + % Test that the getlowerFreq throws an error if the input are more than one + % pzmodel. + % + % + + try + % + p=[pz(3,2) pz(40)]; %f=3,40 + z=[pz(2,3) pz(100)]; %f=2,100 + pzm = pzmodel(10, p, z); + out = getlowerFreq([pzm, pzm]); + stest = false; + % + catch err + stest = true; + end + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_getupperFreq.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_getupperFreq.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,212 @@ +% UTP_pzmodel_GETUPPERFREQ a set of UTPs for the pzmodel/getupperFreq method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_getupperFreq.m,v 1.2 2009/07/23 18:56:38 ingo Exp $ +% + +% +% +% The getupperFreq method of the pzmodel class gets the frequency of the lowest +% pole or zero in the model. This is a very simple method which accepts only one +% pzmodel as input thus are the most general units test not possible. +% +% + +function results = utp_pzmodel_getupperFreq(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'getupperFreq'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Algorithm test + results = [results utp_03]; % Negative test with more than one pzmodel + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests the getupperFreq method of the pzmodel class. + % + % + function result = utp_02 + + % + % + % Test that the getupperFreq returns the lowest frequence of the lowest + % pole or zero in the model. + % + % + + try + % + p=[pz(3,2) pz(40)]; %f=3,40 + z=[pz(2,3) pz(100)]; %f=2,100 + pzm = pzmodel(10, p, z); + out = getupperFreq(pzm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + if out ~= 100, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests the getupperFreq method of the pzmodel class. + % + % + function result = utp_03 + + % + % + % Test that the getupperFreq throws an error if the input are more than one + % pzmodel. + % + % + + try + % + p=[pz(3,2) pz(40)]; %f=3,40 + z=[pz(2,3) pz(100)]; %f=2,100 + pzm = pzmodel(10, p, z); + out = getupperFreq([pzm, pzm]); + stest = false; + % + catch err + stest = true; + end + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_index.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_index.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,525 @@ +% UTP_PZMODEL_INDEX a set of UTPs for the pzmodel/index method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_index.m,v 1.4 2009/07/28 17:12:38 ingo Exp $ +% + +% +% +% The index method of the pzmodel class index into a PZMODEL vector or +% matrix. This properly captures the history. +% +% + +function results = utp_pzmodel_index(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'index'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PZMODEL objects + [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test history is working + results = [results utp_06]; % Test the modify call works + results = [results utp_07]; % Test with plist + results = [results utp_08]; % Test select more objects with an index + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('i'), atest = false; end + if ~io(3).plists.isparam('j'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('i')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('j')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('i'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('j'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the index method works with a vector of PZMODEL objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the index method works for a vector of PZMODEL objects as + % input. The following indexing should work: + % I = [ 1 2 3 ] or (I/J) = [(1,1), (1,2), (1,3)] + % + % + + try + % + objvec = [pz1, pz2, pz3]; + out1 = objvec.index(1); + out2 = objvec.index(3); + out3 = objvec.index(1,2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the index method selects the correct object. + % + % + + atest = true; + if stest + % + if ~eq(out1, pz1, ple3), atest = false; end + if ~eq(out2, pz3, ple3), atest = false; end + if ~eq(out3, pz2, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the index method works with a matrix of PZMODEL objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the index method works for a matrix of PZMODEL objects as + % input. The following indexing should work: + % I = [ 1 3 5 ] or (I/J) = [(1,1), (1,2), (1,3)] + % [ 2 4 6 ] [(2,1), (2,2), (2,3)] + % + + try + % + objmat = [pz1, pz2, pz3; ... + pz3, pz1, pz2]; + out1 = objmat.index(5); + out2 = objmat.index(4); + out3 = objmat.index(1,2); + out4 = objmat.index(2,1); + out5 = objmat.index(2,2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the index method selects the correct object. + % + % + + atest = true; + if stest + % + if ~eq(out1, pz3, ple3), atest = false; end + if ~eq(out2, pz1, ple3), atest = false; end + if ~eq(out3, pz2, ple3), atest = false; end + if ~eq(out4, pz3, ple3), atest = false; end + if ~eq(out5, pz1, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the index method works with a list of PZMODEL objects as + % input. + % + % + function result = utp_04 + + % + % + % The index method doesn't work for a list of PZMODEL objects as input. + % + % + + try + % + out = index(pz1,pz2,pz3, 4); + % + stest = false; + catch + stest = true; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the index method properly applies history. + % + % + function result = utp_05 + + % + % + % Test that the result of index have an additional history step. + % + % + + try + % + i = 2; + j = 3; + objmat = [pz1, pz2, pz3; ... + pz3, pz1, pz2]; + out = index(objmat, i, j); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds + % to 'index'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'index'), atest = false; end + % Check that the history-plist contains the used indices. + pl = out.hist.plistUsed; + if pl.find('i') ~= i, atest = false; end + if pl.find('j') ~= j, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the index method works for the modifier command. + % + % + function result = utp_06 + + % + % + % Tests that the index method works for the modifier command. + % + % + + try + % + i = 1; + j = 1; + objmat = [pz1, pz2, pz3; ... + pz3, pz1, pz2]; + out1 = index(objmat, i, j); + out2 = objmat.index(i,j); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history-plist contains the used indices. + % 2) Check that the index method selects the correct object + % + % + + atest = true; + if stest + % + % Check that the history-plist contains the used indices. + pl = out1.hist.plistUsed; + if pl.find('i') ~= i, atest = false; end + if pl.find('j') ~= j, atest = false; end + % Check that the index method selects the correct object + if ~eq(out1, pz1, ple3), atest = false; end + % Check that the history-plist contains the used indices. + pl = out2.hist.plistUsed; + if pl.find('i') ~= i, atest = false; end + if pl.find('j') ~= j, atest = false; end + % Check that the index method selects the correct object + if ~eq(out2, pz1, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Control the method with a plist. + % + % + function result = utp_07 + + % + % + % Test that the index method can be controled with a plist. + % + % + + try + % + i1 = 6; + i2 = 1; + j2 = 3; + objmat = [pz1, pz2, pz3; ... + pz3, pz1, pz2]; + pl1 = plist('i', i1); + pl2 = plist('i', i2, 'j', j2); + out1 = index(objmat, pl1); + out2 = index(objmat, pl2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history-plist contains the used indices. + % 2) Check that the index method selects the correct object + % + % + + atest = true; + if stest + % + % Check that the history-plist contains the used indices. + pl = out1.hist.plistUsed; + if ~isequal(pl.find('i'), i1), atest = false; end + if ~isequal(pl.find('j'), []), atest = false; end + % Check that the index method selects the correct object + if ~eq(out1, pz2, ple3), atest = false; end + % Check that the history-plist contains the used indices. + pl = out2.hist.plistUsed; + if ~isequal(pl.find('i'), i2), atest = false; end + if ~isequal(pl.find('j'), j2), atest = false; end + % Check that the index method selects the correct object + if ~eq(out2, pz3, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test that the index method selects more objects if I have more indices. + % + % + function result = utp_08 + + % + % + % Test that the index method selects more objects if I have more indices. + % + % + + try + % + i = [2 6]; + objmat = [pz1, pz2, pz3; ... + pz3, pz1, pz2]; + pl = plist('i', i); + out1 = objmat.index(i); + out2 = objmat.index(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history-plist contains the used indices. + % 2) Check that the index method selects the correct object + % + % + + atest = true; + if stest + % + % Check that the history-plist contains the used indices. + pl = out1(1).hist.plistUsed; + if ~isequal(pl.find('i'), i), atest = false; end + if ~isequal(pl.find('j'), []), atest = false; end + % Check that the index method selects the correct object + if ~eq(out1(1), pz3, ple3), atest = false; end + if ~eq(out1(2), pz2, ple3), atest = false; end + % Check that the history-plist contains the used indices. + pl = out2(2).hist.plistUsed; + if ~isequal(pl.find('i'), i), atest = false; end + if ~isequal(pl.find('j'), []), atest = false; end + % Check that the index method selects the correct object + if ~eq(out2(1), pz3, ple3), atest = false; end + if ~eq(out2(2), pz2, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_isprop.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_isprop.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,477 @@ +% UTP_PZMODEL_ISPROP a set of UTPs for the pzmodel/isprop method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_isprop.m,v 1.5 2011/03/29 13:13:33 ingo Exp $ +% + +% +% +% The isprop method of the pzmodel class determine whether input is object property. +% +% + +function results = utp_pzmodel_isprop(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'isprop'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PZMODEL objects + [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test negative case + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the isprop method works with a vector of PZMODEL objects as input. + % + % + function result = utp_02 + + % + % + % Test that the isprop method works for a vector of PZMODEL objects as input. + % + % + + try + % + out = isprop(pzv, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pzv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pzv)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the isprop method works with a matrix of PZMODEL objects as input. + % + % + function result = utp_03 + + % + % + % Test that the isprop method works for a matrix of PZMODEL objects as input. + % + % + + try + % + out = isprop(pzm, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pzm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pzm)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the isprop method works with a list of PZMODEL objects as input. + % + % + function result = utp_04 + + % + % + % Test that the isprop method works for a list of PZMODEL objects as input. + % + % + + try + % + out = isprop(pz5,pz3,pz2, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the isprop method works with a mix of different shaped + % PZMODEL objects as input. + % + % + function result = utp_05 + + % + % + % Test that the isprop method works with an input of matrices and vectors + % and single PZMODEL objects. + % + % + + try + % + out = isprop(pz5,pzv,pz3,pzm,pz2, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(pzm)+numel(pzv)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the isprop method properly applies history. + % + % + function result = utp_06 + + % + % + % The method isprop doesn't change the object, thus it is not necessary to + % apply history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the isprop method works for each property. + % + % + function result = utp_07 + + % + % + % Test that the isprop method works for the properties: + % 'gain', 'poles', 'zeros', 'iunits', 'ounits', 'hist', + % 'name' + % + % + + try + % + % copy pz5 to work with + out1 = isprop(pz5, 'gain'); + out2 = isprop(pz5, 'poles'); + out3 = isprop(pz5, 'zeros'); + out5 = isprop(pz5, 'iunits'); + out6 = isprop(pz5, 'ounits'); + out7 = isprop(pz5, 'hist'); + out8 = isprop(pz5, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if ~out1, atest = false; end; + if ~out2, atest = false; end; + if ~out3, atest = false; end; + if ~out5, atest = false; end; + if ~out6, atest = false; end; + if ~out7, atest = false; end; + if ~out8, atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the negative case and the not function command. + % + % + function result = utp_08 + + % + % + % Test that the isprop method retrun false for a unknown property and for + % methods of the object. + % + % + + try + % + out1 = isprop(pz1, 'foo'); + out2 = pz1.isprop('foo'); + out3 = pz1.isprop('name'); + out4 = pz1.isprop('type'); + out5 = pz1.isprop('char'); + out6 = pz1.isprop('created'); + out7 = pz1.isprop('creator'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if out1, atest = false; end; + if out2, atest = false; end; + if ~out3, atest = false; end; + if out4, atest = false; end; + if out5, atest = false; end; + if out6, atest = false; end; + if out7, atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_loadobj.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_loadobj.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,151 @@ +% UTP_PZMODEL_LOADOBJ a set of UTPs for the pzmodel/loadobj method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_loadobj.m,v 1.1 2009/01/12 19:08:19 ingo Exp $ +% + +% +% +% The loadobj method of the pzmodel class will be automatically called by +% MATLAB if an older object is not compatible with the current object structure. +% This happens only for objects which are stored as a MATLAB formatted +% (MAT-file). The load mechanism for XML formated files calls always the +% 'update_struct' method to keep the stored objects up to date. The +% 'update_struct' method convert the read object structure to the object +% structure which is used in the currend LTPDA version. +% This UTP will load old objects which are stored with an older LTPDA version. +% +% REMARK: Since LTPDA version 1.9.2 will be an object which should be saved as a +% MAT file stored as a struct and not as the object. +% +% + +function results = utp_pzmodel_loadobj(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'loadobj'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Run the tests + results = [results utp_01]; % getInfo call + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Get all .MAT and .XML files + path = fullfile(fileparts(which(mfilename)), '..', '..', 'utp_test_files'); + + matfiles = utils.prog.filescan(path, '.mat'); + xmlfiles = utils.prog.filescan(path, '.xml'); + + % Load .MAT files + obj_no = 1; + for ii=1:numel(matfiles) + fn = matfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = pzmodel(fn); + obj_no = obj_no+1; + end + end + + % Load .XML files + for ii=1:numel(xmlfiles) + fn = xmlfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = pzmodel(fn); + obj_no = obj_no+1; + end + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the shape of the loaded objects. + % + % + + atest = true; + if stest + % + for ii = 1:numel(objs) + obj = objs(ii).obj; + fname = objs(ii).fname; + + if ~isempty(strfind(fname, '_vec')) + % Loaded object must be a vector + if ~isvector(obj), atest = false; end + elseif ~isempty(strfind(fname, '_mat')) + % Loaded object must be a matrix + % REMARK: Known error in LTPDA version 1.9.2 + % A saved matrix doesn't keep the shape of the matrix. + if isempty(strfind(fname, '_192')) + if ~(size(obj,1) > 1 && size(obj,2) > 1), atest = false; end + end + else + % Loaded object must be a single object + if ~(size(obj,1) == 1 && size(obj,2) == 1), + atest = false; end + end + + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_mrdivide.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_mrdivide.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,494 @@ +% UTP_PZMODEL_MRDIVIDE a set of UTPs for the pzmodel/mrdivide method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_mrdivide.m,v 1.2 2009/07/23 18:56:38 ingo Exp $ +% + +% +% +% The mrdivide method of the pzmodel class overloads the division operator +% for PZMODELs. +% +% + +function results = utp_pzmodel_mrdivide(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'mrdivide'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the I-/O-units + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the mrdivide method works with a vector of PZMODELs as input. + % + % + function result = utp_02 + + % + % + % Test that the mrdivide method works for a vector of PZMODELs as input. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-4)); + pz2 = pzmodel(3, pz(2), pz(-3)); + pz3 = pzmodel(4, pz(3), pz(-2)); + pz4 = pzmodel(5, pz(4), pz(-1)); + out1 = mrdivide(pz1, [pz2, pz3, pz4 pz1]); + out2 = pz1 / [pz2, pz3, pz4 pz1]; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one PZMODEL object. + % 2) Check the gain of the output + % 3) Check the poles of the output + % 4) Check the zeros of the output + % + % + + atest = true; + if stest + % + if numel(out1) ~= 1, atest = false; end + if numel(out2) ~= 1, atest = false; end + % Check 'gain' + if out1.gain ~= (2 / 3 / 4 / 5 / 2), atest = false; end + if out2.gain ~= (2 / 3 / 4 / 5 / 2), atest = false; end + % Check 'poles' + if ~eq(out1.poles, [pz(1), pz(-3), pz(-2), pz(-1), pz(-4)]), atest = false; end + if ~eq(out2.poles, [pz(1), pz(-3), pz(-2), pz(-1), pz(-4)]), atest = false; end + % Check 'zeros' + if ~eq(out1.zeros, [pz(-4), pz(2), pz(3), pz(4), pz(1)]), atest = false; end + if ~eq(out2.zeros, [pz(-4), pz(2), pz(3), pz(4), pz(1)]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the mrdivide method works with a matrix of PZMODELs as input. + % + % + function result = utp_03 + + % + % + % Tests that the rdivie method works with a matrix of PZMODELs as input. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-4)); + pz2 = pzmodel(3, pz(2), pz(-3)); + pz3 = pzmodel(4, pz(3), pz(-2)); + pz4 = pzmodel(5, pz(4), pz(-1)); + out1 = mrdivide(pz1, [pz4, pz3, pz2; pz1 pz4 pz3]); + out2 = pz1 / [pz4, pz3, pz2; pz1 pz4 pz3]; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one PZMODEL object. + % 2) Check the gain of the output + % 3) Check the poles of the output + % 4) Check the zeros of the output + % + % + + atest = true; + if stest + % + if numel(out1) ~= 1, atest = false; end + if numel(out2) ~= 1, atest = false; end + % Check 'gain' + if out1.gain ~= (2 / 5 / 2 / 4 / 5 / 3 / 4), atest = false; end + if out2.gain ~= (2 / 5 / 2 / 4 / 5 / 3 / 4), atest = false; end + % Check 'poles' + if ~eq(out1.poles, [pz(1), pz(-1), pz(-4), pz(-2), pz(-1), pz(-3), pz(-2)]), atest = false; end + if ~eq(out2.poles, [pz(1), pz(-1), pz(-4), pz(-2), pz(-1), pz(-3), pz(-2)]), atest = false; end + % Check 'zeros' + if ~eq(out1.zeros, [pz(-4), pz(4), pz(1), pz(3), pz(4), pz(2), pz(3)]), atest = false; end + if ~eq(out2.zeros, [pz(-4), pz(4), pz(1), pz(3), pz(4), pz(2), pz(3)]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the mrdivide method works with a list of PZMODELs as input. + % + % + function result = utp_04 + + % + % + % Tests that the mrdivide method works with a list of PZMODELs as input. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-4)); + pz2 = pzmodel(3, pz(2), pz(-3)); + pz3 = pzmodel(4, pz(3), pz(-2)); + out1 = mrdivide(pz1, pz2, pz3); + out2 = pz1 / pz2 / pz3; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one PZMODEL object. + % 2) Check the gain of the output + % 3) Check the poles of the output + % 4) Check the zeros of the output + % + % + + atest = true; + if stest + % + if numel(out1) ~= 1, atest = false; end + if numel(out2) ~= 1, atest = false; end + % Check 'gain' + if out1.gain ~= (2 / 3 / 4), atest = false; end + if out2.gain ~= (2 / 3 / 4), atest = false; end + % Check 'poles' + if ~eq(out1.poles, [pz(1), pz(-3), pz(-2)]), atest = false; end + if ~eq(out2.poles, [pz(1), pz(-3), pz(-2)]), atest = false; end + % Check 'zeros' + if ~eq(out1.zeros, [pz(-4), pz(2), pz(3)]), atest = false; end + if ~eq(out2.zeros, [pz(-4), pz(2), pz(3)]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the mrdivide method works with a mix of different shaped + % PZMODELs as input. + % + % + function result = utp_05 + + % + % + % Tests that the mrdivide method works with a mix of different shaped + % PZMODELs as input. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-4)); + pz2 = pzmodel(3, pz(2), pz(-3)); + pz3 = pzmodel(4, pz(3), pz(-2)); + pz4 = pzmodel(5, pz(4), pz(-1)); + out1 = mrdivide(pz1, [pz2 pz3], pz4); + out2 = pz1 / [pz2 pz3] / pz4; + mout = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one PZMODEL object. + % 2) Check the gain of the output + % 3) Check the poles of the output + % 4) Check the zeros of the output + % 5) Check the rebuilt object + % + % + + atest = true; + if stest + % + if numel(out1) ~= 1, atest = false; end + if numel(out2) ~= 1, atest = false; end + % Check 'gain' + if out1.gain ~= (2 / 3 / 4 / 5), atest = false; end + if out2.gain ~= (2 / 3 / 4 / 5), atest = false; end + % Check 'poles' + if ~eq(out1.poles, [pz(1), pz(-3), pz(-2), pz(-1)]), atest = false; end + if ~eq(out2.poles, [pz(1), pz(-3), pz(-2), pz(-1)]), atest = false; end + % Check 'zeros' + if ~eq(out1.zeros, [pz(-4), pz(2), pz(3), pz(4)]), atest = false; end + if ~eq(out2.zeros, [pz(-4), pz(2), pz(3), pz(4)]), atest = false; end + % Check the rebuilt object + if ~eq(mout, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the mrdivide method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the mrdivide method can be processed + % back. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-4)); + pz2 = pzmodel(3, pz(2), pz(-3)); + out = mrdivide(pz1, pz2); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'mrdivide'. + % 2) Check that re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'rdivide'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the mrdivide method only divide PZMODELs with the same output + % units. + % + % + function result = utp_07 + + % + % + % Check that the mrdivide method only divide PZMODELs with the same + % output units. Check also the negative case. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-3)); + pz2 = pzmodel(3, pz(2), pz(-2)); + pz3 = pzmodel(4, pz(3), pz(-1)); + pz1.setOunits('Hz Hz^-1/2'); + pz2.setOunits('Hz Hz^-1/2'); + pz3.setOunits('Hz Hz^-1/2'); + pz1.setIunits('m'); + pz2.setIunits('Hz Hz^-1/2'); + pz3.setIunits('Hz Hz^-1/2'); + out = pz1 / pz2 / pz3; + mout = rebuild(out); + % Negative case + pz2.setOunits('m'); + try + out = pz1 / pz2; + stest = false; + catch + stest = true; + end + % + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the I-/O-units + % + % + + atest = true; + if stest + % + % Check the I-/O-units + if ~eq(out.iunits, unit('m')), atest = false; end + if ~eq(out.ounits, unit('Hz Hz^-1/2')), atest = false; end + % Check the re-built object. + if ~eq(mout, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_mtimes.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_mtimes.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,494 @@ +% UTP_PZMODEL_MTIMES a set of UTPs for the pzmodel/mtimes method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_mtimes.m,v 1.2 2009/07/23 18:56:38 ingo Exp $ +% + +% +% +% The mtimes method of the pzmodel class overloads the multiplication +% operator for PZMODELs. +% +% + +function results = utp_pzmodel_mtimes(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'mtimes'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the I-/O-units + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the mtimes method works with a vector of PZMODELs as input. + % + % + function result = utp_02 + + % + % + % Test that the mtimes method works for a vector of PZMODELs as input. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-4)); + pz2 = pzmodel(3, pz(2), pz(-3)); + pz3 = pzmodel(4, pz(3), pz(-2)); + pz4 = pzmodel(5, pz(4), pz(-1)); + out1 = mtimes(pz1, [pz2, pz3, pz4 pz1]); + out2 = pz1 * [pz2, pz3, pz4 pz1]; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one PZMODEL object. + % 2) Check the gain of the output + % 3) Check the poles of the output + % 4) Check the zeros of the output + % + % + + atest = true; + if stest + % + if numel(out1) ~= 1, atest = false; end + if numel(out2) ~= 1, atest = false; end + % Check 'gain' + if out1.gain ~= (2 * 3 * 4 * 5 * 2), atest = false; end + if out2.gain ~= (2 * 3 * 4 * 5 * 2), atest = false; end + % Check 'poles' + if ~eq(out1.poles, [pz(1), pz(2), pz(3), pz(4), pz(1)]), atest = false; end + if ~eq(out2.poles, [pz(1), pz(2), pz(3), pz(4), pz(1)]), atest = false; end + % Check 'zeros' + if ~eq(out1.zeros, [pz(-4), pz(-3), pz(-2), pz(-1), pz(-4)]), atest = false; end + if ~eq(out2.zeros, [pz(-4), pz(-3), pz(-2), pz(-1), pz(-4)]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the mtimes method works with a matrix of PZMODELs as input. + % + % + function result = utp_03 + + % + % + % Tests that the mtimes method works with a matrix of PZMODELs as input. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-4)); + pz2 = pzmodel(3, pz(2), pz(-3)); + pz3 = pzmodel(4, pz(3), pz(-2)); + pz4 = pzmodel(5, pz(4), pz(-1)); + out1 = mtimes(pz1, [pz4, pz3, pz2; pz1 pz4 pz3]); + out2 = pz1 * [pz4, pz3, pz2; pz1 pz4 pz3]; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one PZMODEL object. + % 2) Check the gain of the output + % 3) Check the poles of the output + % 4) Check the zeros of the output + % + % + + atest = true; + if stest + % + if numel(out1) ~= 1, atest = false; end + if numel(out2) ~= 1, atest = false; end + % Check 'gain' + if out1.gain ~= (2 * 5 * 2 * 4 * 5 * 3 * 4), atest = false; end + if out2.gain ~= (2 * 5 * 2 * 4 * 5 * 3 * 4), atest = false; end + % Check 'poles' + if ~eq(out1.poles, [pz(1), pz(4), pz(1), pz(3), pz(4), pz(2), pz(3)]), atest = false; end + if ~eq(out2.poles, [pz(1), pz(4), pz(1), pz(3), pz(4), pz(2), pz(3)]), atest = false; end + % Check 'zeros' + if ~eq(out1.zeros, [pz(-4), pz(-1), pz(-4), pz(-2), pz(-1), pz(-3), pz(-2), ]), atest = false; end + if ~eq(out2.zeros, [pz(-4), pz(-1), pz(-4), pz(-2), pz(-1), pz(-3), pz(-2), ]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the mtimes method works with a list of PZMODELs as input. + % + % + function result = utp_04 + + % + % + % Tests that the mtimes method works with a list of PZMODELs as input. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-4)); + pz2 = pzmodel(3, pz(2), pz(-3)); + pz3 = pzmodel(4, pz(3), pz(-2)); + out1 = mtimes(pz1, pz2, pz3); + out2 = pz1 * pz2 * pz3; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one PZMODEL object. + % 2) Check the gain of the output + % 3) Check the poles of the output + % 4) Check the zeros of the output + % + % + + atest = true; + if stest + % + if numel(out1) ~= 1, atest = false; end + if numel(out2) ~= 1, atest = false; end + % Check 'gain' + if out1.gain ~= (2 * 3 * 4), atest = false; end + if out2.gain ~= (2 * 3 * 4), atest = false; end + % Check 'poles' + if ~eq(out1.poles, [pz(1), pz(2), pz(3)]), atest = false; end + if ~eq(out2.poles, [pz(1), pz(2), pz(3)]), atest = false; end + % Check 'zeros' + if ~eq(out1.zeros, [pz(-4), pz(-3), pz(-2)]), atest = false; end + if ~eq(out2.zeros, [pz(-4), pz(-3), pz(-2)]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the mtimes method works with a mix of different shaped + % PZMODELs as input. + % + % + function result = utp_05 + + % + % + % Tests that the mtimes method works with a mix of different shaped + % PZMODELs as input. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-4)); + pz2 = pzmodel(3, pz(2), pz(-3)); + pz3 = pzmodel(4, pz(3), pz(-2)); + pz4 = pzmodel(5, pz(4), pz(-1)); + out1 = mtimes(pz1, [pz2 pz3], pz4); + out2 = pz1 * [pz2 pz3] * pz4; + mout = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one PZMODEL object. + % 2) Check the gain of the output + % 3) Check the poles of the output + % 4) Check the zeros of the output + % 5) Check the rebuilt object + % + % + + atest = true; + if stest + % + if numel(out1) ~= 1, atest = false; end + if numel(out2) ~= 1, atest = false; end + % Check 'gain' + if out1.gain ~= (2 * 3 * 4 * 5), atest = false; end + if out2.gain ~= (2 * 3 * 4 * 5), atest = false; end + % Check 'poles' + if ~eq(out1.poles, [pz(1), pz(2), pz(3), pz(4)]), atest = false; end + if ~eq(out2.poles, [pz(1), pz(2), pz(3), pz(4)]), atest = false; end + % Check 'zeros' + if ~eq(out1.zeros, [pz(-4), pz(-3), pz(-2), pz(-1)]), atest = false; end + if ~eq(out2.zeros, [pz(-4), pz(-3), pz(-2), pz(-1)]), atest = false; end + % Check the rebuilt object + if ~eq(mout, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the mtimes method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the mtimes method can be processed + % back. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-4)); + pz2 = pzmodel(3, pz(2), pz(-3)); + out = mtimes(pz1, pz2); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'times'. + % 2) Check that re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'times'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the mtimes method only multiply PZMODELs with the same output + % units. + % + % + function result = utp_07 + + % + % + % Check that the mtimes method only multiply PZMODELs with the same + % output units. Check also the negative case. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-3)); + pz2 = pzmodel(3, pz(2), pz(-2)); + pz3 = pzmodel(4, pz(3), pz(-1)); + pz1.setOunits('Hz Hz^-1/2'); + pz2.setOunits('Hz Hz^-1/2'); + pz3.setOunits('Hz Hz^-1/2'); + pz1.setIunits('m'); + pz2.setIunits('Hz Hz^-1/2'); + pz3.setIunits('Hz Hz^-1/2'); + out = pz1 * pz2 * pz3; + mout = rebuild(out); + % Negative case + pz2.setIunits('m'); + try + out = pz1 * pz2; + stest = false; + catch + stest = true; + end + % + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the I-/O-units + % + % + + atest = true; + if stest + % + % Check the I-/O-units + if ~eq(out.iunits, unit('m')), atest = false; end + if ~eq(out.ounits, unit('Hz Hz^-1/2')), atest = false; end + % Check the re-built object. + if ~eq(mout, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_ne.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_ne.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,455 @@ +% UTP_PZMODEL_NE a set of UTPs for the pzmodel/ne method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_ne.m,v 1.6 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The ne() method of the pzmodel class pzm1 ~= pzm2 compares each element of an +% pzmodel object with the corresponding element of an second pzm object and returns +% a logical 1 (true) where pzm1 and pzm2 are not equal, or logical 0 (false) +% where they are equal. +% +% + +function results = utp_pzmodel_ne(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'ne'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PZMODEL objects + [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test with the exception list 'name' + results = [results utp_08]; % Test exception list in a plist + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the ne method works with a vector of PZMODEL objects as input. + % + % + function result = utp_02 + + % + % + % Test that the ne method works for a vector of PZMODEL objects as input. + % Test the positive and the negative case. + % + % + + try + % + pzm = pz5.setName('my name'); + pzv1 = [pz4, pz2, pz3, pz5]; + pzv2 = [pz4, pz2, pz3, pzm]; + out1 = ne(pzv1, pzv1); + out2 = ne(pzv1, pzv2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the ne function. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the ne method works with a matrix of PZMODEL objects as input. + % + % + function result = utp_03 + + % + % + % Test that the ne method works for a matrix of PZMODEL objects as input. + % Test the positive and the negative case. + % + % + + try + % + pzm = pz5.setName('my name'); + pzmm1 = [pz4, pz2, pz5, pz5, pz3, pz4]; + pzmm2 = [pz4, pz2, pzm; pz5, pz3, pz4]; + out1 = ne(pzmm1, pzmm1); + out2 = ne(pzmm1, pzmm2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the ne function. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the ne method works with a list of PZMODEL objects as input. + % + % + function result = utp_04 + + % + % + % The ne method doesn't works for a list of PZMODEL objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the ne method works with a mix of different shaped PZMODEL objects + % as input. + % + % + function result = utp_05 + + % + % + % The ne method doesn't works for a list of PZMODEL objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the ne method properly applies history. + % + % + function result = utp_06 + + % + % + % The ne method doesn't change the PZMODEL object, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the ne method with an exception list. + % The function pzmodel/ne use the function pzmodel/eq so it is not necessary to check + % all possibilities of the exception list. + % + % + function result = utp_07 + + % + % + % Test the ne method with the exception 'name'. Use the option 'internal' to + % suppress the history. It is necessary to add 'created' to the exception + % list because pzm is created at an other time. + % + % + + try + % + pzm = testCallerIsMethod(@setName, pz5, 'my name'); + out1 = ne(pzm, pz5); + out2 = ne(pzm, pz5, 'name', 'created', 'UUID'); + out3 = ne(pzm, pz5, 'pzmodel/name', 'created', 'UUID'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + if out3 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the ne method with an exception list which is in a plist. + % + % + function result = utp_08 + + % + % + % Test that the ne method uses the exception list in a plist. + % + % + + try + % + pzm = testCallerIsMethod(@setName, pz5, 'my name'); + pl = plist('Exceptions', {'name', 'created', 'UUID'}); + out1 = ne(pzm, pz5); + out2 = ne(pzm, pz5, pl); + out3 = ne(pzm, pz5, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + if out3 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_pzmodel.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_pzmodel.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,1589 @@ +% UTP_PZMODEL_PZMODEL a set of UTPs for the pzmodel/pzmodel method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_pzmodel.m,v 1.31 2011/08/22 05:37:13 hewitson Exp $ +% + +% +% +% The pzmodel method of the pzmodel class constructs PZMODEL objects. +% +% + +function results = utp_pzmodel_pzmodel(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'pzmodel'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PZMODEL objects + [pz1, pz2, pz3, pz4, pz5, pzvec, pzmat] = get_test_objects_pzmodel; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working with empty constructor + results = [results utp_07]; % Test history is working with copy constructor + results = [results utp_08]; % Test history is working with MAT file constructor + results = [results utp_09]; % Test history is working with XML file constructor + results = [results utp_10]; % Test history is working with FIL file constructor + results = [results utp_11]; % Test history is working with struct constructor + results = [results utp_12]; % Test history is working with constant constructor + results = [results utp_13]; % Test history is working with rational-object constructor + results = [results utp_14]; % Test history is working with plist(filename) constructor + results = [results utp_15]; % Test history is working with plist(hostname) constructor + results = [results utp_16]; % Test history is working with plist(rational) constructor + results = [results utp_17]; % Test history is working with plist(gain|poles|zeros) constructor + results = [results utp_18]; % Test history is working with plist(plist) constructor + results = [results utp_19]; % Test history is working with conn+Id constructor + results = [results utp_20]; % Test history is working with gain + poles + zeros constructor + results = [results utp_21]; % Test history is working with gain + poles + zeros + name constructor + results = [results utp_22]; % Test history is working with gain + poles + zeros + iunits + ounits constructor + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From XML File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From MAT File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From LISO File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Repository')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Rational')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Poles/Zeros')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Built-in Model')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 3, atest = false; end + % Check key + % Check default value + % Check options + %%%%%%%%%% SET 'From MAT File' + pn = 4; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + %%%%%%%%%% SET 'From XML File' + pn = 5; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + %%%%%%%%%% SET 'From Repository' + pn = 6; + if io(pn).plists.nparams ~= 10, atest = false; end + % Check key + if ~io(pn).plists.isparam('hostname'), atest = false; end + if ~io(pn).plists.isparam('id'), atest = false; end + if ~io(pn).plists.isparam('cid'), atest = false; end + if ~io(pn).plists.isparam('database'), atest = false; end + if ~io(pn).plists.isparam('binary'), atest = false; end + if ~io(pn).plists.isparam('username'), atest = false; end + if ~io(pn).plists.isparam('password'), atest = false; end + % Check default value + if ~isEmptyDouble(io(pn).plists.find('id')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('cid')), atest = false; end + if ~isequal(io(pn).plists.find('binary'), 'yes'), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('id'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('cid'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('binary'), {'yes', 'no'}), atest = false; end + %%%%%%%%%% SET 'From Built-in Model' + pn = 7; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('built-in'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('built-in')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('built-in'), {''}), atest = false; end + %%%%%%%%%% SET 'From LISO File' + pn = 8; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + %%%%%%%%%% SET 'From Rational' + pn = 9; + if io(pn).plists.nparams ~= 6, atest = false; end + % Check key + if ~io(pn).plists.isparam('rational'), atest = false; end + % Check default value + if ~eq(io(pn).plists.find('rational'), rational(), ple1), atest = false; end + % Check options + %%%%%%%%%% SET 'From Parfrac' + pn = 10; + if io(pn).plists.nparams ~= 6, atest = false; end + % Check key + if ~io(pn).plists.isparam('parfrac'), atest = false; end + % Check default value + if ~eq(io(pn).plists.find('parfrac'), parfrac(), ple1), atest = false; end + % Check options + %%%%%%%%%% SET 'From Poles/Zeros' + pn = 11; + if io(pn).plists.nparams ~= 9, atest = false; end + % Check key + if ~io(pn).plists.isparam('gain'), atest = false; end + if ~io(pn).plists.isparam('poles'), atest = false; end + if ~io(pn).plists.isparam('zeros'), atest = false; end + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('iunits'), atest = false; end + if ~io(pn).plists.isparam('ounits'), atest = false; end + if ~io(pn).plists.isparam('delay'), atest = false; end + % Check default value + if ~isequal(io(pn).plists.find('gain'), 1), atest = false; end + if ~isempty(io(pn).plists.find('poles')), atest = false; end + if ~isempty(io(pn).plists.find('zeros')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('iunits')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('ounits')), atest = false; end + if ~isequal(io(pn).plists.find('delay'), 0), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('gain'), {1}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('poles'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('zeros'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('name'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('iunits'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('ounits'), {''}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('delay'), {0}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the pzmodel method works with a vector of PZMODEL objects as input. + % + % + function result = utp_02 + + % + % + % Test that the pzmodel method works with a vector of PZMODEL objects as input. + % + % + + try + % + out = pzmodel(pzvec); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output PZMODELs is the same as the input shape. + % 2) Check that each output PZMODEL is a copy of the input PZMODEL. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + if stest + % + % Check we have the correct shape + if size(out) ~= size(pzvec), atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(pzvec(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(pzvec(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(pzvec(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the pzmodel method works with a matrix of PZMODEL objects as input. + % + % + function result = utp_03 + + % + % + % Test that the pzmodel method works with a matrix of PZMODEL objects as input. + % + % + + try + % + out = pzmodel(pzmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output PZMODELs is the same as the input shape. + % 2) Check that each output PZMODEL is a copy of the input PZMODEL. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if size(out) ~= size(pzmat), atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(pzmat(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(pzmat(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(pzmat(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the pzmodel method works with a list of PZMODEL objects as input. + % + % + function result = utp_04 + + % + % + % Test that the pzmodel method works with a list of PZMODEL objects as input. + % + % + + try + % + out = pzmodel(pz5, pz4, pz3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same of the + % number in the input. + % 2) Check that each output PZMODEL is a copy of the input PZMODEL. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + pzin = [pz5, pz4, pz3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(pzin(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(pzin(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(pzin(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the pzmodel method works with a mix of different shaped PZMODELs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the pzmodel method works with a mix of different shaped PZMODELs as + % input. + % + % + + try + % + out = pzmodel(pz5,pzvec,pz2,pzmat,pz4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same of the + % number in the input. + % 2) Check that each output PZMODEL is a copy of the input PZMODEL. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + pzin = [pz5, reshape(pzvec, 1, []), pz2, reshape(pzmat, 1, []), pz4]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3+numel(pzvec)+numel(pzmat), atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(pzin(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(pzin(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(pzin(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the pzmodel method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the pzmodel method can be processed back. + % + % + + try + % + out = pzmodel(pz4); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'pzmodel'. + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'pzmodel'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the pzmodel method properly applies history to the copy constructor. + % + % + function result = utp_07 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % Test the constructor with a different number of inputs. + % + % + + try + % + out1 = pzmodel(pz5); + out2 = pzmodel(pz5, pz4); + out3 = pzmodel(pz5, pz4, pz3); + out1.setName('my name'); + out2(1).setName('my name'); + out2(2).setName('my name'); + out3(1).setName('my name'); + out3(2).setName('my name'); + out3(3).setName('my name'); + mout = rebuild(out1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'pzmodel'. + % 2) Check that the original objects are not changed by the setter function + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + % It is the method 'setName' because we set it in above + if ~strcmp(out1.hist.methodInfo.mname, 'setName'), atest = false; end + % Check next to the last step in the history of 'out' + if ~strcmp(out1.hist.inhists.methodInfo.mname, 'pzmodel'), atest = false; end + % Check the originals + if strcmp(pz5, 'my name'), atest = false; end + if strcmp(pz4, 'my name'), atest = false; end + if strcmp(pz3, 'my name'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out1, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the pzmodel method properly applies history to the read + % MAT-file constructor. + % + % + function result = utp_08 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + filename = 'test_pzm.mat'; + pzm = pzmodel(pz5); + save(pzm, filename); + + out = pzmodel(filename); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the loaded object is the same as the saved object. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the objects + if ~eq(out, pzm), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + delete(filename); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + + %% UTP_09 + + % + % + % Tests that the pzmodel method properly applies history to the read + % XML-file constructor. + % + % + function result = utp_09 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + filename = 'test_pzm.xml'; + amat = pzmodel(pzmat); + save(amat, filename); + + out = pzmodel(filename); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the loaded object is the same as the saved object. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the algorithm + for kk = 1:numel(out) + % Check the objects + if ~eq(out(kk), amat(kk)), atest = false; end + end + + % Check the rebuilt object + for kk = 1:numel(out) + if ~eq(mout(kk), out(kk), ple2), atest = false; end + end + % + delete(filename); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Tests that the pzmodel method properly applies history to the read + % FIL-file constructor. + % + % + function result = utp_10 + + % + % + % Read the FIL file which is created from LISO. + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + filename = 'test_pzm.fil'; + out = pzmodel(filename); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' + % corresponds to 'pzmodel'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'pzmodel'), atest = false; end + % Reading a file adds additionally history steps + if ~isa(out, 'pzmodel'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_11 + + % + % + % Tests that the pzmodel method properly applies history to the struct constructor. + % + % + function result = utp_11 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + spzm = struct(pz5); + spzm.poles(1)= struct(pz5.poles(1)); % pz5 have two poles + spzm.poles(2)= struct(pz5.poles(2)); + spzm.zeros = struct(pz5.zeros); + spzm.iunits = struct(pz5.iunits); + spzm.ounits = struct(pz5.ounits); + spzm.hist = struct(pz5.hist); + + out1 = pzmodel(struct(pz3)); + out2 = pzmodel(spzm); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' + % corresponds to 'pzmodel'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check that the output is a PZMODEL object + if ~isa(out1,'pzmodel'), atest = false; end + if ~isa(out2,'pzmodel'), atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'setName'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'setName'), atest = false; end + % Check the algorithm + if ~eq(pz3, out1), atest = false; end + if ~eq(pz5, out2), atest = false; end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_11 + + %% UTP_12 + + % + % + % Tests that the pzmodel from a constant properly applies history. + % + % + function result = utp_12 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + out = pzmodel(123.123); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' + % corresponds to 'pzmodel'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check that the output is a PZMODEL object + if ~isa(out,'pzmodel'), atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'pzmodel'), atest = false; end + % Check the algorithm + if ~eq(mout, out, ple1), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Tests that the pzmodel method properly applies history to the rational constructor. + % + % + function result = utp_13 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + rat = rational([1 2 -3], [4 5 -6]); % two real zeros and poles + out = pzmodel(rat); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' + % corresponds to 'pzmodel'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check that the output is a PZMODEL object + if ~isa(out,'pzmodel'), atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'pzmodel'), atest = false; end + if ~strcmp(out.hist.inhists.methodInfo.mname, 'rational'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + %% UTP_14 + + % + % + % Tests that the pzmodel method properly applies history to the + % plist(filename) constructor. + % + % + function result = utp_14 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + try + % + filename1 = 'test_pzm.xml'; + filename2 = 'test_pzm.mat'; + filename3 = 'test_pzm.fil'; + + f1 = pzmodel(pz5); + f2 = pzmodel(pz4); + + save(f1, filename1); + save(f2, filename2); + + out1 = pzmodel(plist('filename', filename1)); + out2 = pzmodel(plist('filename', filename2)); + out3 = pzmodel(plist('filename', filename3)); + + rout1 = out1.rebuild; + rout2 = out2.rebuild; + rout3 = out3.rebuild; + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the save method doesn't change the input object + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the input object of the save method + if ~eq(f1, pz5, ple3), atest = false; end + if ~eq(f1.hist.inhists, pz5.hist) , atest = false; end + if ~eq(f2, pz4, ple3) , atest = false; end + if ~eq(f2.hist.inhists, pz4.hist) , atest = false; end + % The load doesn't have two additionally history steps (save + load) + if ~eq(out1, f1), atest = false; end + if ~eq(out2, f2), atest = false; end + % Rebuild object and check the result + if ~eq(rout1, out1, ple2), atest = false; end + if ~eq(rout2, out2, ple2), atest = false; end + if ~eq(rout3, out3, ple2), atest = false; end + % + % delete test file + delete(filename1) + delete(filename2) + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_14 + + %% UTP_15 + + % + % + % Tests that the PZMODEL method properly applies history to the + % plist(conn) constructor. + % + % + function result = utp_15 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + conn = utpGetConnection + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_pzmodel_pzmodel_15: submit pzmodel vector'; + sinfo.experiment_description = 'utp_pzmodel_pzmodel_15: &description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + plForAutoTest = plist('no dialog', true, 'use selector', false); + ids = submit(pzmat, sinfo, plForAutoTest); + + out = pzmodel(plist('hostname', utpGetHostname, 'database', utpGetDatabase, 'conn', conn, 'id', ids)); + % + % Close connection + utpCloseConnection(conn); + stest = true; + catch err + disp(err.message) + % Close connection + utpCloseConnection(conn); + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'pzmodel'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + for kk = 1:numel(out) + if ~strcmp(out(kk).hist.methodInfo.mname, 'pzmodel'), atest = false; end + end + % Check data values + if ~eq(reshape(out, size(pzmat)), pzmat, ple3), atest = false; end + % Rebuild object and check the result + rout = rebuild(out); + if ~eq(rout, out, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_15 + + %% UTP_16 + + % + % + % Tests that the PZMODEL method properly applies history to the + % plist(rational) constructor + % + % + function result = utp_16 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + iu = unit('Hz^2'); + ou = unit('mm'); + rat = rational([1 2 -3], [4 5 -6], 'my rat', iu, ou); + pl = plist('rational', rat); + out = pzmodel(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'pzmodel'. + % 2) Check the algorithm + % 3) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'pzmodel'), atest = false; end + % Check algorithm + if numel(out.poles) ~= 2, atest = false; end + if numel(out.zeros) ~= 2, atest = false; end + if ~strcmp(out.name, sprintf('pzmodel(%s)',rat.name)), atest = false; end + if ~eq(out.iunits, iu), atest = false; end + if ~eq(out.ounits, ou), atest = false; end + % Rebuild object and check the result + if ~eq(out, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_16 + + %% UTP_17 + + % + % + % Tests that the PZMODEL method properly applies history to the + % plist(gain|poles|zeros) constructor. + % + % + function result = utp_17 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + iu = unit('Hz^2'); + ou = unit('mm'); + z = [pz(1,2), pz(5)]; + p = pz(1); + name = 'new name'; + + % Create test plists + pl1 = plist('gain', 12.2, 'zeros', z, 'poles', p, 'iunits', iu, 'ounits', ou, 'name', name); + pl2 = plist('gain', 12.2); + pl3 = plist('zeros', z); + pl4 = plist('poles', p); + + out1 = pzmodel(pl1); + out2 = pzmodel(pl2); + out3 = pzmodel(pl3); + out4 = pzmodel(pl4); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'pzmodel'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'pzmodel'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'pzmodel'), atest = false; end + if ~strcmp(out3.hist.methodInfo.mname, 'pzmodel'), atest = false; end + if ~strcmp(out4.hist.methodInfo.mname, 'pzmodel'), atest = false; end + % Check values + if ~isequal(out1.gain, 12.2), atest = false; end + if ~strcmp(out1.name, name), atest = false; end + if ~eq(out1.zeros, z), atest = false; end + if ~eq(out1.poles, p), atest = false; end + if ~eq(out1.iunits, iu), atest = false; end + if ~eq(out1.ounits, ou), atest = false; end + if ~isequal(out2.gain, 12.2), atest = false; end + if ~strcmp(out2.name, ''), atest = false; end + if ~isequal(out2.zeros, []), atest = false; end + if ~isequal(out2.poles, []), atest = false; end + if ~eq(out2.iunits, unit()), atest = false; end + if ~eq(out2.ounits, unit()), atest = false; end + if ~isequal(out3.gain, 1), atest = false; end + if ~strcmp(out3.name, ''), atest = false; end + if ~eq(out3.zeros, z), atest = false; end + if ~isequal(out3.poles, []), atest = false; end + if ~eq(out3.iunits, unit()), atest = false; end + if ~eq(out3.ounits, unit()), atest = false; end + if ~isequal(out4.gain, 1), atest = false; end + if ~strcmp(out4.name, ''), atest = false; end + if ~isequal(out4.zeros, []), atest = false; end + if ~eq(out4.poles, p), atest = false; end + if ~eq(out4.iunits, unit()), atest = false; end + if ~eq(out4.ounits, unit()), atest = false; end + % Rebuild object and check the result + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + if ~eq(mout3, out3, ple2), atest = false; end + if ~eq(mout4, out4, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_17 + + %% UTP_18 + + % + % + % Tests that the PZMODEL method properly applies history to the + % plist() constructor. + % + % + function result = utp_18 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + name = 'new name'; + p = pz(4); + pl = plist('poles', p, 'name', name); + out1 = pzmodel(plist('plist', pl)); + out2 = pzmodel(plist('plist', plist())); % empty plist + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'pzmodel'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~strcmp(out1.hist.methodInfo.mname, 'pzmodel'), atest = false; end + % Check values + if ~strcmp(out1.name, name), atest = false; end + if ~eq(out1.poles, p), atest = false; end + % Check the last step in the history of 'out2' + if ~strcmp(out2.hist.methodInfo.mname, 'pzmodel'), atest = false; end + % Check the next to the last step in the history. + if ~isempty(out2.hist.inhists), atest = false; end + % Rebuild object and check the result + if ~eq(out1, mout1, ple1), atest = false; end + if ~eq(out2, mout2, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_18 + + %% UTP_19 + + % + % + % Tests that the PZMODEL method properly applies history to the conn+Id constructor. + % + % + function result = utp_19 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + conn = utpGetConnection + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_pzmodel_pzmodel_19: submit pzmodel'; + sinfo.experiment_description = 'utp_pzmodel_pzmodel_19: description'; + sinfo.analysis_description = 'utp_pzmodel_pzmodel_19'; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + plForAutoTest = plist('no dialog', true, 'use selector', false); + [ids] = submit(pz5, sinfo, plForAutoTest); + + out = pzmodel(conn, ids); + % + % Close connection + utpCloseConnection(conn); + stest = true; + catch err + disp(err.message) + % Close connection + utpCloseConnection(conn); + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'pzmodel'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'pzmodel'), atest = false; end + % Check data values + if ~eq(out,pz5, ple3), atest = false; end + % Check the history except the additional 'submit' + 'retrieve' steps + if ~eq(out.hist.inhists, pz5.hist), atest = false; end + % Check the rebuild method + mout = rebuild(out); + if ~eq(mout, out, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_19 + + %% UTP_20 + + % + % + % Tests that the PZMODEL method properly applies history to the + % gain + poles + zeros constructor. + % + % + function result = utp_20 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + gain = 12.2; + z = pz(2.2); + p = [pz(1,2), pz(7.7)]; + out = pzmodel(gain, p, z); + + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'pzmodel'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'pzmodel'), atest = false; end + % Check values + if ~isequal(out.gain, gain), atest = false; end + if ~eq(out.zeros, z), atest = false; end + if ~eq(out.poles, p), atest = false; end + if ~strcmp(out.name, ''), atest = false; end + if ~eq(out.iunits, unit()), atest = false; end + if ~eq(out.ounits, unit()), atest = false; end + % Rebuild object and check the result + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_20 + + %% UTP_21 + + % + % + % Tests that the PZMODEL method properly applies history to the + % gain + poles + zeros + name constructor. + % + % + function result = utp_21 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + name = 'new name'; + gain = 12.2; + z = pz(2.2); + p = [pz(1,2), pz(7.7)]; + out = pzmodel(gain, p, z, name); + + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'pzmodel'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'pzmodel'), atest = false; end + % Check values + if ~isequal(out.gain, gain), atest = false; end + if ~eq(out.zeros, z), atest = false; end + if ~eq(out.poles, p), atest = false; end + if ~strcmp(out.name, name), atest = false; end + if ~eq(out.iunits, unit()), atest = false; end + if ~eq(out.ounits, unit()), atest = false; end + % Rebuild object and check the result + if ~eq(mout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_21 + + %% UTP_22 + + % + % + % Tests that the PZMODEL method properly applies history to the + % gain + poles + zeros + iunits + ounits constructor. + % + % + function result = utp_22 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + gain = 12.2; + z = pz(2.2); + p = [pz(1,2), pz(7.7)]; + iu = unit('Hz^2'); + ou = unit('V'); + out = pzmodel(gain, p, z, iu, ou); + + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'pzmodel'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'pzmodel'), atest = false; end + % Check values + if ~isequal(out.gain, gain), atest = false; end + if ~eq(out.zeros, z), atest = false; end + if ~eq(out.poles, p), atest = false; end + if ~strcmp(out.name, ''), atest = false; end + if ~eq(out.iunits, iu), atest = false; end + if ~eq(out.ounits, ou), atest = false; end + % Rebuild object and check the result + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_22 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_rdivide.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_rdivide.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,494 @@ +% UTP_PZMODEL_RDIVIDE a set of UTPs for the pzmodel/rdivide method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_rdivide.m,v 1.2 2009/07/23 18:56:38 ingo Exp $ +% + +% +% +% The rdivide method of the pzmodel class overloads the division operator +% for PZMODELs. +% +% + +function results = utp_pzmodel_rdivide(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'rdivide'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the I-/O-units + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the rdivide method works with a vector of PZMODELs as input. + % + % + function result = utp_02 + + % + % + % Test that the rdivide method works for a vector of PZMODELs as input. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-4)); + pz2 = pzmodel(3, pz(2), pz(-3)); + pz3 = pzmodel(4, pz(3), pz(-2)); + pz4 = pzmodel(5, pz(4), pz(-1)); + out1 = rdivide(pz1, [pz2, pz3, pz4 pz1]); + out2 = pz1 ./ [pz2, pz3, pz4 pz1]; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one PZMODEL object. + % 2) Check the gain of the output + % 3) Check the poles of the output + % 4) Check the zeros of the output + % + % + + atest = true; + if stest + % + if numel(out1) ~= 1, atest = false; end + if numel(out2) ~= 1, atest = false; end + % Check 'gain' + if out1.gain ~= (2 / 3 / 4 / 5 / 2), atest = false; end + if out2.gain ~= (2 / 3 / 4 / 5 / 2), atest = false; end + % Check 'poles' + if ~eq(out1.poles, [pz(1), pz(-3), pz(-2), pz(-1), pz(-4)]), atest = false; end + if ~eq(out2.poles, [pz(1), pz(-3), pz(-2), pz(-1), pz(-4)]), atest = false; end + % Check 'zeros' + if ~eq(out1.zeros, [pz(-4), pz(2), pz(3), pz(4), pz(1)]), atest = false; end + if ~eq(out2.zeros, [pz(-4), pz(2), pz(3), pz(4), pz(1)]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the rdivide method works with a matrix of PZMODELs as input. + % + % + function result = utp_03 + + % + % + % Tests that the rdivie method works with a matrix of PZMODELs as input. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-4)); + pz2 = pzmodel(3, pz(2), pz(-3)); + pz3 = pzmodel(4, pz(3), pz(-2)); + pz4 = pzmodel(5, pz(4), pz(-1)); + out1 = rdivide(pz1, [pz4, pz3, pz2; pz1 pz4 pz3]); + out2 = pz1 ./ [pz4, pz3, pz2; pz1 pz4 pz3]; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one PZMODEL object. + % 2) Check the gain of the output + % 3) Check the poles of the output + % 4) Check the zeros of the output + % + % + + atest = true; + if stest + % + if numel(out1) ~= 1, atest = false; end + if numel(out2) ~= 1, atest = false; end + % Check 'gain' + if out1.gain ~= (2 / 5 / 2 / 4 / 5 / 3 / 4), atest = false; end + if out2.gain ~= (2 / 5 / 2 / 4 / 5 / 3 / 4), atest = false; end + % Check 'poles' + if ~eq(out1.poles, [pz(1), pz(-1), pz(-4), pz(-2), pz(-1), pz(-3), pz(-2)]), atest = false; end + if ~eq(out2.poles, [pz(1), pz(-1), pz(-4), pz(-2), pz(-1), pz(-3), pz(-2)]), atest = false; end + % Check 'zeros' + if ~eq(out1.zeros, [pz(-4), pz(4), pz(1), pz(3), pz(4), pz(2), pz(3)]), atest = false; end + if ~eq(out2.zeros, [pz(-4), pz(4), pz(1), pz(3), pz(4), pz(2), pz(3)]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the rdivide method works with a list of PZMODELs as input. + % + % + function result = utp_04 + + % + % + % Tests that the rdivide method works with a list of PZMODELs as input. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-4)); + pz2 = pzmodel(3, pz(2), pz(-3)); + pz3 = pzmodel(4, pz(3), pz(-2)); + out1 = rdivide(pz1, pz2, pz3); + out2 = pz1 ./ pz2 ./ pz3; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one PZMODEL object. + % 2) Check the gain of the output + % 3) Check the poles of the output + % 4) Check the zeros of the output + % + % + + atest = true; + if stest + % + if numel(out1) ~= 1, atest = false; end + if numel(out2) ~= 1, atest = false; end + % Check 'gain' + if out1.gain ~= (2 / 3 / 4), atest = false; end + if out2.gain ~= (2 / 3 / 4), atest = false; end + % Check 'poles' + if ~eq(out1.poles, [pz(1), pz(-3), pz(-2)]), atest = false; end + if ~eq(out2.poles, [pz(1), pz(-3), pz(-2)]), atest = false; end + % Check 'zeros' + if ~eq(out1.zeros, [pz(-4), pz(2), pz(3)]), atest = false; end + if ~eq(out2.zeros, [pz(-4), pz(2), pz(3)]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the rdivide method works with a mix of different shaped + % PZMODELs as input. + % + % + function result = utp_05 + + % + % + % Tests that the rdivide method works with a mix of different shaped + % PZMODELs as input. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-4)); + pz2 = pzmodel(3, pz(2), pz(-3)); + pz3 = pzmodel(4, pz(3), pz(-2)); + pz4 = pzmodel(5, pz(4), pz(-1)); + out1 = rdivide(pz1, [pz2 pz3], pz4); + out2 = pz1 ./ [pz2 pz3] ./ pz4; + mout = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one PZMODEL object. + % 2) Check the gain of the output + % 3) Check the poles of the output + % 4) Check the zeros of the output + % 5) Check the rebuilt object + % + % + + atest = true; + if stest + % + if numel(out1) ~= 1, atest = false; end + if numel(out2) ~= 1, atest = false; end + % Check 'gain' + if out1.gain ~= (2 / 3 / 4 / 5), atest = false; end + if out2.gain ~= (2 / 3 / 4 / 5), atest = false; end + % Check 'poles' + if ~eq(out1.poles, [pz(1), pz(-3), pz(-2), pz(-1)]), atest = false; end + if ~eq(out2.poles, [pz(1), pz(-3), pz(-2), pz(-1)]), atest = false; end + % Check 'zeros' + if ~eq(out1.zeros, [pz(-4), pz(2), pz(3), pz(4)]), atest = false; end + if ~eq(out2.zeros, [pz(-4), pz(2), pz(3), pz(4)]), atest = false; end + % Check the rebuilt object + if ~eq(mout, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the rdivide method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the rdivide method can be processed + % back. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-4)); + pz2 = pzmodel(3, pz(2), pz(-3)); + out = rdivide(pz1, pz2); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'rdivide'. + % 2) Check that re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'rdivide'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the rdivide method only divide PZMODELs with the same output + % units. + % + % + function result = utp_07 + + % + % + % Check that the rdivide method only divide PZMODELs with the same + % output units. Check also the negative case. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-3)); + pz2 = pzmodel(3, pz(2), pz(-2)); + pz3 = pzmodel(4, pz(3), pz(-1)); + pz1.setOunits('Hz Hz^-1/2'); + pz2.setOunits('Hz Hz^-1/2'); + pz3.setOunits('Hz Hz^-1/2'); + pz1.setIunits('m'); + pz2.setIunits('Hz Hz^-1/2'); + pz3.setIunits('Hz Hz^-1/2'); + out = pz1 ./ pz2 ./ pz3; + mout = rebuild(out); + % Negative case + pz2.setOunits('m'); + try + out = pz1 ./ pz2; + stest = false; + catch + stest = true; + end + % + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the I-/O-units + % + % + + atest = true; + if stest + % + % Check the I-/O-units + if ~eq(out.iunits, unit('m')), atest = false; end + if ~eq(out.ounits, unit('Hz Hz^-1/2')), atest = false; end + % Check the re-built object. + if ~eq(mout, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_rebuild.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_rebuild.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,413 @@ +% UTP_PZMODEL_REBUILD a set of UTPs for the pzmodel/rebuild method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_rebuild.m,v 1.2 2009/07/23 18:56:38 ingo Exp $ +% + +% +% +% The rebuild method of the pzmodel class rebuilds the input objects using the +% history. This method is also intensively tested in the most other UTPs. +% +% + +function results = utp_pzmodel_rebuild(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'rebuild'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PZMODEL objects + [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the output + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the rebuild method works with a vector of PZMODEL objects as input. + % + % + function result = utp_02 + + % + % + % Test that the rebuild method works for a vector of PZMODEL objects as input. + % + % + + try + % + out = rebuild(pzv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + % Check the output + if ~isa(out, 'pzmodel'), atest = false; end; + for kk = 1:numel(pzv) + if eq(out(kk), pzv(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the rebuild method works with a matrix of PZMODEL objects as input. + % + % + function result = utp_03 + + % + % + % Test that the rebuild method works for a matrix of PZMODEL objects as input. + % + % + + try + % + out = rebuild(pzm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + if ~isa(out, 'pzmodel'), atest = false; end; + for kk = 1:numel(pzm) + if eq(out(kk), pzm(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the rebuild method works with a list of PZMODEL objects as input. + % + % + function result = utp_04 + + % + % + % Test that the rebuild method works for a list of PZMODEL objects as input. + % + % + + try + % + out = rebuild(pz5,pz4,pz3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + pzin = [pz5,pz4,pz3]; + if stest + % + if ~isa(out, 'pzmodel'), atest = false; end; + for kk = 1:numel(pzin) + if eq(out(kk), pzin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the rebuild method works with a mix of different shaped PZMODEL objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the rebuild method works with an input of matrices and vectors + % and single PZMODEL objects. + % + % + + try + % + out = rebuild(pz4,pzv,pz2,pzm,pz1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + pzin = [pz4,reshape(pzv,1,[]),pz2,reshape(pzm,1,[]),pz1]; + if stest + % + if ~isa(out, 'pzmodel'), atest = false; end; + for kk = 1:numel(pzin) + if eq(out(kk), pzin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the rebuild method properly applies history. + % + % + function result = utp_06 + + % + % + % The method rebuild doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the rebuild method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = rebuild(pz1, pz2); + o3 = rebuild(pz1, pz2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, pz1, ple2), atest = false; end + if ~eq(o2, pz2, ple2), atest = false; end + if ~eq(o3, [pz1 pz2], ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_resp.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_resp.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,1008 @@ +% UTP_PZMODEL_RESP a set of UTPs for the pzmodel/resp method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_resp.m,v 1.7 2010/03/15 15:57:06 ingo Exp $ +% + +% +% +% The resp method of the pzmodel class returns the complex response of a pzmodel +% as an Analysis Object. For a command with no output variables plots the method +% the result into a diagram. +% +% + +function results = utp_pzmodel_resp(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'resp'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PZMODEL objects + [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + warning('This UTP needs a complete update'); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test with f = ao.y + results = [results utp_11]; % Test with f + results = [results utp_12]; % Test with f1, f2 and nf + results = [results utp_13]; % Test with f1, f2 and nf AND 'scale' + + % Make surethat all figures are closed + close all; + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'List')), atest = false; end + if ~any(strcmpi(io(2).sets, 'Range')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'List' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('f'), atest = false; end + if ~io(3).plists.isparam('bank'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('f')), atest = false; end + if ~isequal(io(3).plists.find('bank'), 'none'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('f'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('bank'), {'none', 'serial', 'parallel'}), atest = false; end + %%%%%%%%%% SET 'Range' + if io(4).plists.nparams ~= 5, atest = false; end + % Check key + if ~io(4).plists.isparam('f1'), atest = false; end + if ~io(4).plists.isparam('f2'), atest = false; end + if ~io(4).plists.isparam('nf'), atest = false; end + if ~io(4).plists.isparam('scale'), atest = false; end + if ~io(4).plists.isparam('bank'), atest = false; end + % Check default value + if ~isEmptyDouble(io(4).plists.find('f1')), atest = false; end + if ~isEmptyDouble(io(4).plists.find('f2')), atest = false; end + if ~isequal(io(4).plists.find('nf'), 1000), atest = false; end + if ~isequal(io(4).plists.find('scale'), 'log'), atest = false; end + if ~isequal(io(4).plists.find('bank'), 'none'), atest = false; end + % Check options + if ~isequal(io(4).plists.getOptionsForParam('f1'), {[]}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('f2'), {[]}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('nf'), {1000}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('scale'), {'lin', 'log'}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('bank'), {'none', 'serial', 'parallel'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the resp method works with a vector of PZMODEL objects as input. + % + % + function result = utp_02 + + % + % + % Test that the resp method works for a vector of PZMODEL objects as input. + % Test the method with an output and with no output (a diagram must appear) + % + % + + try + % + % Make sure that all figures are closed. + close all; + resp(pzv); + out = resp(pzv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Test the right number of lines in the diagram. + % 2) Check that the number of elements in 'out' is the same as in 'pzv' + % 3) Check that each output PZMODEL contains the correct data. + % + % + + atest = true; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + % Check that the diagram have the same number of lines as the output + % object + if max(cellfun('size', lines, 1)) ~= numel(pzv), atest = false; end + % Check the number of output objects. + if ~isequal(size(out), size(pzv)), atest = false; end + % Check each output against the default values for f1, f2 and nf + for ii = 1:numel(out) + f1 = getlowerFreq(pzv(ii))/10; + f2 = getupperFreq(pzv(ii))*10; + nf = find(pzmodel.getInfo('resp', 'Range').plists, 'nf'); + if ~isa(out(ii), 'ao'), atest = false; end + if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end + if out(ii).x(1) ~= f1, atest = false; end + if out(ii).x(end) ~= f2, atest = false; end + if numel(out(ii).x) ~= nf, atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the resp method works with a matrix of PZMODEL objects as input. + % + % + function result = utp_03 + + % + % + % Test that the resp method works for a matrix of PZMODEL objects as input. + % Test the method with an output and with no output (a diagram must appear) + % + % + + try + % + % Make sure that all figures are closed. + close all; + pzmat = [pz5, pz3, pz2; pz1, pz5, pz3]; + resp(pzmat); + out = resp(pzmat); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Test the right number of lines in the diagram. + % 2) Check that the number of elements in 'out' is the same as in 'pzmat' + % 3) Check that each output PZMODEL contains the correct data. + % + % + + atest = true; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + % Check that the diagram have the same number of lines as the output + % object + if max(cellfun('size', lines, 1)) ~= numel(pzmat), atest = false; end + % Check the number of output objects. + if ~isequal(size(out), size(pzmat)), atest = false; end + % Check each output against the default values for f1, f2 and nf + for ii = 1:numel(out) + f1 = getlowerFreq(pzmat(ii))/10; + f2 = getupperFreq(pzmat(ii))*10; + nf = find(pzmodel.getInfo('resp', 'Range').plists, 'nf'); + if ~isa(out(ii), 'ao'), atest = false; end + if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end + if out(ii).x(1) ~= f1, atest = false; end + if out(ii).x(end) ~= f2, atest = false; end + if numel(out(ii).x) ~= nf, atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the pzmat method works with a list of PZMODEL objects as input. + % + % + function result = utp_04 + + % + % + % Test that the resp method works for a list of PZMODEL objects as input. + % Test the method with an output and with no output (a diagram must appear) + % + % + + try + % + close all; + resp(pz1,pz2,pz3); + out = resp(pz1,pz2,pz3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Test the right number of lines in the diagram. + % 2) Check that the number of elements in 'out' is the same as in 'pzmat' + % 3) Check that each output PZMODEL contains the correct data. + % + % + + atest = true; + pzin = [pz1,pz2,pz3]; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + % Check that the diagram have the same number of lines as the output + % object + if max(cellfun('size', lines, 1)) ~= numel(pzin), atest = false; end + % Check the number of output objects. + if ~isequal(size(out), size(pzin)), atest = false; end + % Check each output against the default values for f1, f2 and nf + for ii = 1:numel(out) + f1 = getlowerFreq(pzin(ii))/10; + f2 = getupperFreq(pzin(ii))*10; + nf = find(pzmodel.getInfo('resp', 'Range').plists, 'nf'); + if ~isa(out(ii), 'ao'), atest = false; end + if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end + if out(ii).x(1) ~= f1, atest = false; end + if out(ii).x(end) ~= f2, atest = false; end + if numel(out(ii).x) ~= nf, atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the resp method works with a mix of different shaped PZMODEL + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the resp method works with an input of matrices and vectors + % and single PZMODEL objects. Test the method with an output and with no + % output (a diagram must appear) + % + % + + try + % + close all; + pzmat = [pz5, pz3, pz2; pz1, pz5, pz3]; + resp(pz1,pzv,pz2,pzmat,pz3); + out = resp(pz1,pzv,pz2,pzmat,pz3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Test the right number of lines in the diagram. + % 2) Check that the number of elements in 'out' is the same as in 'pzmat' + % 3) Check that each output PZMODEL contains the correct data. + % + % + + atest = true; + pzin = [pz1,reshape(pzv,1,[]),pz2,reshape(pzmat,1,[]),pz3]; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + % Check that the diagram have the same number of lines as the output + % object + if max(cellfun('size', lines, 1)) ~= numel(pzin), atest = false; end + % Check the number of output objects. + if ~isequal(size(out), size(pzin)), atest = false; end + % Check each output against the default values for f1, f2 and nf + for ii = 1:numel(out) + f1 = getlowerFreq(pzin(ii))/10; + f2 = getupperFreq(pzin(ii))*10; + nf = find(pzmodel.getInfo('resp', 'Range').plists, 'nf'); + if ~isa(out(ii), 'ao'), atest = false; end + if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end + if out(ii).x(1) ~= f1, atest = false; end + if out(ii).x(end) ~= f2, atest = false; end + if numel(out(ii).x) ~= nf, atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the resp method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the resp method can be processed back. + % + % + + try + % + close all; + resp(pz5); + out = resp(pz5); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'resp'. + % 2) Check that re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + x = get(lines{1}, 'XData'); + y1 = get(lines{1}, 'YData'); + y2 = get(lines{2}, 'YData'); + if ~isequal(x, out.x.'), atest = false; end + if ~isequal(y2, abs(out.y)'), atest = false; end + if ~isequal(y1, utils.math.phase(out.y)'), atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'resp'), atest = false; end + % Run 'test.m' and check the result + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that modify command plots the response into a diagram. + % + % + function result = utp_07 + + % + % + % Tests that modify command plots the response into a diagram. + % + % + + try + % + close all; + pz5.resp(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the response diagram. + % + % + + atest = true; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + x = get(lines{1}, 'XData'); + f1 = getlowerFreq(pz5)/10; + f2 = getupperFreq(pz5)*10; + nf = find(pzmodel.getInfo('resp', 'Range').plists, 'nf'); + if x(1) ~= f1, atest = false; end + if x(end) ~= f2, atest = false; end + if numel(x) ~= nf, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the output AO of the resp method keeps the shape of the used + % input f vector. + % + % + + try + % + arow = ao(1:100, linspace(.1, 5, 100)); + acol = arow.'; + f = linspace(.1, 5, 100); + out1 = resp(pz5, arow); + out2 = resp(pz5, acol); + out3 = resp(pz5, f); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,1) ~= 1, atest = false; end + if size(out1.data.y,2) == 1, atest = false; end + if size(out2.data.y,1) == 1, atest = false; end + if size(out2.data.y,2) ~= 1, atest = false; end + if size(out3.data.y,1) ~= 1, atest = false; end + if size(out3.data.y,2) == 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the resp method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = resp(pz5, pz3); + o3 = resp(pz5, pz3); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the resp method uses the x-data of an input AO for f-vector. + % + % + function result = utp_10 + + % + % + % Call the method with different method to pass an AO in. + % + % + + try + % + f1 = .1; + f2 = 5; + nf = 100; + axy = ao(linspace(f1, f2, nf), randn(100,1)); + afs = ao(linspace(f1, f2, nf), randn(100,1), plist('type', 'fsdata')); + out1 = resp(pz5, axy); + out2 = resp(pz5, afs); + out3 = resp(pz5, plist('f', axy)); + out4 = resp(pz5, plist('f', afs)); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the output + if ~isa(out1, 'ao'), atest = false; end + if ~isa(out2, 'ao'), atest = false; end + if ~isa(out3, 'ao'), atest = false; end + if ~isa(out4, 'ao'), atest = false; end + if out1.x(1) ~= f1, atest = false; end + if out1.x(end) ~= f2, atest = false; end + if numel(out1.x) ~= nf, atest = false; end + if out2.x(1) ~= f1, atest = false; end + if out2.x(end) ~= f2, atest = false; end + if numel(out2.x) ~= nf, atest = false; end + if out3.x(1) ~= f1, atest = false; end + if out3.x(end) ~= f2, atest = false; end + if numel(out3.x) ~= nf, atest = false; end + if out4.x(1) ~= f1, atest = false; end + if out4.x(end) ~= f2, atest = false; end + if numel(out4.x) ~= nf, atest = false; end + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + if ~eq(out3, mout3, ple2), atest = false; end + if ~eq(out4, mout4, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_11 + + % + % + % Check that the resp method uses the specified f-vector to compute the response. + % + % + function result = utp_11 + + % + % + % Call the method with different method to pass an f-vector in. + % + % + + try + % + f1 = .1; + f2 = 5; + nf = 100; + f = linspace(f1, f2, nf); + out1 = resp(pz5, f); + out2 = resp(pz5, plist('f', f)); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the output + if ~isa(out1, 'ao'), atest = false; end + if ~isa(out2, 'ao'), atest = false; end + if out1.x(1) ~= f1, atest = false; end + if out1.x(end) ~= f2, atest = false; end + if numel(out1.x) ~= nf, atest = false; end + if out2.x(1) ~= f1, atest = false; end + if out2.x(end) ~= f2, atest = false; end + if numel(out2.x) ~= nf, atest = false; end + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_11 + + %% UTP_12 + + % + % + % Check that the resp method uses the specified f1, f2, and nf to compute the response. + % + % + function result = utp_12 + + % + % + % Call the method with different method to pass f1, f2, and nf in. + % + % + + try + % + f1 = .1; + f2 = 5; + nf = 100; + nf2 = 123; + out1 = resp(pz5, f1, f2); + out2 = resp(pz5, f1, f2, nf); + out3 = resp(pz5, plist('f1', f1, 'f2', f2, 'nf', nf)); + out4 = resp(pz5, plist('f1', f1, 'nf', nf2)); + out5 = resp(pz5, plist('f2', f2)); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + mout5 = rebuild(out5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + T = 10e-12; + if stest + % + % Check the output + f1d = getlowerFreq(pz5)/10; + f2d = getupperFreq(pz5)*10; + nfd = find(pzmodel.getInfo('resp', 'Range').plists, 'nf'); + if ~isa(out1, 'ao'), atest = false; end + if ~isa(out2, 'ao'), atest = false; end + if ~isa(out3, 'ao'), atest = false; end + if ~isa(out4, 'ao'), atest = false; end + if ~isa(out5, 'ao'), atest = false; end + if out1.x(1) ~= f1, atest = false; end + if any(find(abs(out1.x(end)-f2)>T)), atest = false; end + if numel(out1.x) ~= nfd, atest = false; end % Default values + if out2.x(1) ~= f1, atest = false; end + if any(find(abs(out2.x(end)-f2)>T)), atest = false; end + if numel(out2.x) ~= nf, atest = false; end + if out3.x(1) ~= f1, atest = false; end + if abs(out3.x(end)-f2)>T, atest = false; end + if numel(out3.x) ~= nf, atest = false; end + if out4.x(1) ~= f1, atest = false; end + if out4.x(end) ~= f2d, atest = false; end % Default values + if numel(out4.x) ~= nf2, atest = false; end + if out5.x(1) ~= f1d, atest = false; end % Default values + if any(find(abs(out5.x(end)-f2)>T)), atest = false; end + if numel(out5.x) ~= nfd, atest = false; end % Default values + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + if ~eq(out3, mout3, ple2), atest = false; end + if ~eq(out4, mout4, ple2), atest = false; end + if ~eq(out5, mout5, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Check that the resp method uses the specified f1, f2, and nf to compute the response. + % + % + function result = utp_13 + + % + % + % Call the method with different method to pass f1, f2, and nf in. + % + % + + try + % + f1 = .1; + f2 = 5; + nf = 123; + out1 = resp(pz5, plist('f1', f1, 'f2', f2, 'nf', nf, 'scale', 'lin')); + out2 = resp(pz5, plist('f1', f1, 'f2', f2, 'nf', nf, 'scale', 'log')); + out3 = resp(pz5, plist('scale', 'lin')); + out4 = resp(pz5, plist('scale', 'log')); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + T = 10e-12; + if stest + % + % Check the output + f1d = getlowerFreq(pz5)/10; + f2d = getupperFreq(pz5)*10; + nfd = find(pzmodel.getInfo('resp', 'Range').plists, 'nf'); + if ~isa(out1, 'ao'), atest = false; end + if ~isa(out2, 'ao'), atest = false; end + if ~isa(out3, 'ao'), atest = false; end + if ~isa(out4, 'ao'), atest = false; end + xlin1 = linspace(f1, f2, nf); + xlin2 = linspace(f1d, f2d, nfd); + xlog1 = logspace(log10(f1), log10(f2), nf); + xlog2 = logspace(log10(f1d), log10(f2d), nfd); + if ~isequal(xlin1, out1.x'), atest = false; end + if ~isequal(xlin2, out3.x'), atest = false; end + if ~isequal(xlog1, out2.x'), atest = false; end + if ~isequal(xlog2, out4.x'), atest = false; end + + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + if ~eq(out3, mout3, ple2), atest = false; end + if ~eq(out4, mout4, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_save.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_save.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,635 @@ +% UTP_PZMODEL_SAVE a set of UTPs for the pzmodel/save method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_save.m,v 1.5 2010/08/31 09:43:48 hewitson Exp $ +% + +% +% +% The save method of the pzmodel class saves a pzmodel object to disk. Save stores +% the variables in a MATLAB formatted file (MAT-file) named filename.mat or in a +% XML fromat named filename.xml +% +% + +function results = utp_pzmodel_save(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'save'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PZMODEL objects + [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test plist contains the filename + results = [results utp_09]; % Test with common PZMODEL objects + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(3).plists.isparam('filename'), atest = false; end + if ~io(3).plists.isparam('prefix'), atest = false; end + if ~io(3).plists.isparam('postfix'), atest = false; end + if ~io(3).plists.isparam('individual files'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('filename'), ''), atest = false; end + if ~isequal(io(3).plists.find('prefix'), ''), atest = false; end + if ~isequal(io(3).plists.find('postfix'), ''), atest = false; end + if ~isequal(io(3).plists.find('individual files'), false), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('filename'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the save method works with a vector of PZMODEL objects as input. + % + % + function result = utp_02 + + % + % + % Test that the save method works for a vector of PZMODEL objects as input. + % Test both formats 'xml' and 'mat'. + % + % + + try + % + save(pzv, 'test.xml'); + save(pzv, 'test.mat'); + out1 = pzmodel('test.xml'); + out2 = pzmodel('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the same + % as in 'pzv' + % 2) Check that the loaded objects are the same as the saved objects. + % 3) The outputs 'out1' and 'out2' must be the same. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(pzv)), atest = false; end + if ~isequal(size(out2), size(pzv)), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(pzv(kk), out1(kk), ple1), atest = false; end + if ~eq(pzv(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the save method works with a matrix of PZMODEL objects as input. + % + % + function result = utp_03 + + % + % + % Test that the save method works for a matrix of PZMODEL objects as input. + % Test both formats 'xml' and 'mat'. + % + % + + try + % + save(pzm, 'test.xml'); + save(pzm, 'test.mat'); + out1 = pzmodel('test.xml'); + out2 = pzmodel('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the same + % as in 'pzm' + % 2) Check that the loaded objects are the same as the saved objects. + % 3) The outputs 'out1' and 'out2' must be the same. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(pzm)), atest = false; end + if ~isequal(size(out2), size(pzm)), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(pzm(kk), out1(kk), ple1), atest = false; end + if ~eq(pzm(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the save method works with a list of PZMODEL objects as input. + % + % + function result = utp_04 + + % + % + % Test that the save method works for a list of PZMODEL objects as input. + % Test both formats 'xml' and 'mat'. + % + % + + try + % + save(pz5, pz3, pz1, 'test.xml'); + save(pz5, pz3, pz1, 'test.mat'); + out1 = pzmodel('test.xml'); + out2 = pzmodel('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the same + % as in the list + % 2) Check that the loaded objects are the same as the saved objects. + % 3) The outputs 'out1' and 'out2' must be the same. + % + % + + atest = true; + pzmin = [pz5, pz3, pz1]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 3, atest = false; end + if numel(out2) ~= 3, atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(pzmin(kk), out1(kk), ple1), atest = false; end + if ~eq(pzmin(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the save method works with a mix of different shaped PZMODEL objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the save method works with an input of matrices and vectors + % and single PZMODEL objects. Test both formats 'xml' and 'mat'. + % + % + + try + % + save(pz5,pzv,pz3, 'test.xml'); + save(pz5,pzv,pz3, 'test.mat'); + out1 = pzmodel('test.xml'); + out2 = pzmodel('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output PZMODEL object contains the correct data. + % + % + + atest = true; + pzmin = [pz5, reshape(pzv, 1, []), pz3]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 2+numel(pzv), atest = false; end + if numel(out2) ~= 2+numel(pzv), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(pzmin(kk), out1(kk), ple1), atest = false; end + if ~eq(pzmin(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the save method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the save method can be processed back + % to an m-file. Do this for both extensions 'mat' and 'xml' + % + % + + try + % + out1 = save(pz2, 'test.xml'); + out2 = save(pz3, 'test.mat'); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history applies to the output object. Check that + % save doesn't add a history step to the input object. + % 2) Check that the read object doesn't contain the save + load history steps. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % The last history step is the save method + if strcmp(out1.hist.methodInfo.mname, 'save'), atest = false; end + if strcmp(out2.hist.methodInfo.mname, 'save'), atest = false; end + % The histories must be the same + if ~eq(out1.hist, pz2.hist), atest = false; end + if ~eq(out2.hist, pz3.hist), atest = false; end + % check the history steps of the read object (load + save) + % The steps (save + load) shouldn't add history + outr1 = pzmodel('test.xml'); + outr2 = pzmodel('test.mat'); + if strcmp(outr1.hist, pz2.hist), atest = false; end + if strcmp(outr2.hist, pz3.hist), atest = false; end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + % delete test file + delete('test.xml') + delete('test.mat') + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the save method works with the modify command. + % + % + function result = utp_07 + + % + % + % Use the save method with the modifier command. + % + % + + try + % + % copy pz5 to work with + pzm_mat = pzmodel(pz5); + pzm_mat.save('test.mat'); + pzm_xml = pzmodel(pz5); + pzm_xml.save('test.xml'); + out1 = pzmodel('test.mat'); + out2 = pzmodel('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the save method doesn't apply the history. + % 2) Check the output against the input. + % 3) Check the history of the output against the input. + % + % + + atest = true; + if stest + % + % Check that the modified object have the 'save' method as the last + % history step + if strcmp(pzm_xml.hist.methodInfo.mname, 'save'), atest = false; end + if strcmp(pzm_mat.hist.methodInfo.mname, 'save'), atest = false; end + % Check the output + if ~eq(pzm_mat, out1, ple1), atest = false; end + if ~eq(pzm_xml, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the save method uses the filename which is stored in a plist. + % + % + + try + % + pl1 = plist('filename', 'test.mat'); + pl2 = plist('filename', 'test.xml'); + save(pz4, pl1); + save(pz4, pl2); + out1 = pzmodel('test.mat'); + out2 = pzmodel('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + % Check the output + if ~eq(pz4, out1, ple1), atest = false; end + if ~eq(pz4, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test the save method with common PZMODEL objects. + % + % + function result = utp_09 + + % + % + % Save all common PZMODEL objects with both extensions. + % + % + + try + % + pzm1 = pzmodel(1, [pz(1) pz(1+1i)], pz(2+2i), unit('V^2'), unit('Hz')); + pzm2 = pzmodel(1, [pz(1) pz(1+1i)], [pz(10), pz(100), pz(50,3)], unit('mm'), unit('m')); + save(pzm1, 'test_pzm1.mat'); + save(pzm1, 'test_pzm1.xml'); + save(pzm2, 'test_pzm2.mat'); + save(pzm2, 'test_pzm2.xml'); + out1 = pzmodel('test_pzm1.mat'); + out2 = pzmodel('test_pzm1.xml'); + out3 = pzmodel('test_pzm2.mat'); + out4 = pzmodel('test_pzm2.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + % Check highpass + if ~eq(pzm1, out1, ple1), atest = false; end + if ~eq(pzm1, out2, ple1), atest = false; end + if ~eq(pzm2, out3, ple1), atest = false; end + if ~eq(pzm2, out4, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + if ~eq(out3, out4, ple2), atest = false; end + % + delete('test_pzm1.mat'); + delete('test_pzm1.xml'); + delete('test_pzm2.mat'); + delete('test_pzm2.xml'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_setDelay.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_setDelay.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,561 @@ +% UTP_PZMODEL_SETDELAY a set of UTPs for the pzmodel/setDelay method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_setDelay.m,v 1.4 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The setDelay method of the pzmodel class sets the delay property. +% +% + +function results = utp_pzmodel_setDelay(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'setDelay'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PZMODEL objects + [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('delay'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('delay'), 0), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('delay'), {0}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setDelay method works with a vector of PZMODEL objects as input. + % + % + function result = utp_02 + + % + % + % Test that the setDelay method works for a vector of PZMODEL objects as input. + % + % + + try + % + out = setDelay(pzv, 12.2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pzv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pzv)), atest = false; end + % Check delay field of each output + for kk=1:numel(out) + if ~isequal(out(kk).delay, 12.2), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setDelay method works with a matrix of PZMODEL objects as input. + % + % + function result = utp_03 + + % + % + % Test that the setDelay method works for a matrix of PZMODEL objects as input. + % + % + + try + % + out = setDelay(pzm, 12.2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pzm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pzm)), atest = false; end + % Check delay field of each output + for kk=1:numel(out) + if ~isequal(out(kk).delay, 12.2), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setDelay method works with a list of PZMODEL objects as input. + % + % + function result = utp_04 + + % + % + % Test that the setDelay method works for a list of PZMODEL objects as input. + % + % + + try + % + out = setDelay(pz5,pz4,pz3, 12.2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~isequal(out(1).delay, 12.2), atest = false; end + if ~isequal(out(2).delay, 12.2), atest = false; end + if ~isequal(out(3).delay, 12.2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setDelay method works with a mix of different shaped PZMODEL + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the setDelay method works with an input of matrices and vectors + % and single PZMODEL objects. + % + % + + try + % + out = setDelay(pz5,pzv,pz4,pzm,pz3, 12.2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(pzm)+numel(pzv)), atest = false; end + for kk=1:numel(out) + if ~isequal(out(kk).delay, 12.2), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setDelay method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setDelay method can be processed back + % to an m-file. + % + % + + try + % + out1 = setDelay(pz5, 12.2); + out2 = testCallerIsMethod(@setDelay, pz5, 12.2); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setDelay'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setDelay'. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setDelay') && ... + eq(out1.hist.plistUsed, plist('delay', 12.2), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('delay', 12.2), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'delay'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setDelay method can modify the input PZMODEL object. + % + % + function result = utp_07 + + % + % + % Test that the setDelay method can modify the input PZMODEL object + % by calling with no output. + % + % + + try + % + % copy pz5 to work with + ain = pzmodel(pz5); + % modify ain + aout = ain.setDelay(12.2); + ain.setDelay(12.2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'pz5' and 'ain' are now different. + % 2) Check that 'ain' has the correct delay field + % + % + + atest = true; + if stest + % + % Check that setDelay modified the input by comparing to the copy + if eq(pzmodel(pz5), ain, ple1), atest = false; end + % Check that setDelay doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~isequal(ain.delay, 12.2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setDelay method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setDelay method can modify the property 'delay' + % with a value in a plist. + % + % + + try + % + pl = plist('delay', 12.2); + out = pz5.setDelay(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct delay field + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'delay' + if ~isequal(out.delay, 12.2), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setDelay method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setDelay(pz5, pz2, 12.2); + o3 = setDelay(pz5, pz2, 12.2); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_setIunits.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_setIunits.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,561 @@ +% UTP_PZMODEL_SETIUNITS a set of UTPs for the pzmodel/setIunits method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_setIunits.m,v 1.4 2011/04/19 18:14:01 ingo Exp $ +% + +% +% +% The setIunits method of the pzmodel class sets the iunits property. +% +% + +function results = utp_pzmodel_setIunits(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'setIunits'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PZMODEL objects + [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('iunits'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('iunits')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('iunits'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setIunits method works with a vector of PZMODEL objects as input. + % + % + function result = utp_02 + + % + % + % Test that the setIunits method works for a vector of PZMODEL objects as input. + % + % + + try + % + out = setIunits(pzv, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pzv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pzv)), atest = false; end + % Check iunits field of each output + for kk=1:numel(out) + if ~eq(out(kk).iunits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setIunits method works with a matrix of PZMODEL objects as input. + % + % + function result = utp_03 + + % + % + % Test that the setIunits method works for a matrix of PZMODEL objects as input. + % + % + + try + % + out = setIunits(pzm, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pzm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pzm)), atest = false; end + % Check iunits field of each output + for kk=1:numel(out) + if ~eq(out(kk).iunits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setIunits method works with a list of PZMODEL objects as input. + % + % + function result = utp_04 + + % + % + % Test that the setIunits method works for a list of PZMODEL objects as input. + % + % + + try + % + out = setIunits(pz5,pz4,pz3, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~eq(out(1).iunits, unit('Hz')), atest = false; end + if ~eq(out(2).iunits, unit('Hz')), atest = false; end + if ~eq(out(3).iunits, unit('Hz')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setIunits method works with a mix of different shaped PZMODEL + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the setIunits method works with an input of matrices and vectors + % and single PZMODEL objects. + % + % + + try + % + out = setIunits(pz5,pzv,pz4,pzm,pz3, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(pzm)+numel(pzv)), atest = false; end + for kk=1:numel(out) + if ~eq(out(kk).iunits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setIunits method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setIunits method can be processed back + % to an m-file. + % + % + + try + % + out1 = setIunits(pz5, unit('Hz')); + out2 = testCallerIsMethod(@setIunits, pz5, unit('Hz')); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setIunits'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setIunits'. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setIunits') && ... + eq(out1.hist.plistUsed, plist('iunits', unit('Hz')), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('iunits', unit('Hz')), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'iunits'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setIunits method can modify the input PZMODEL object. + % + % + function result = utp_07 + + % + % + % Test that the setIunits method can modify the input PZMODEL object + % by calling with no output. + % + % + + try + % + % copy pz5 to work with + ain = pzmodel(pz5); + % modify ain + aout = ain.setIunits(unit('Hz')); + ain.setIunits(unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'pz5' and 'ain' are now different. + % 2) Check that 'ain' has the correct iunits field + % + % + + atest = true; + if stest + % + % Check that setIunits modified the input by comparing to the copy + if eq(pzmodel(pz5), ain, ple1), atest = false; end + % Check that setIunits doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~eq(ain.iunits, unit('Hz')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setIunits method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setIunits method can modify the property 'iunits' + % with a value in a plist. + % + % + + try + % + pl = plist('iunits', unit('Hz')); + out = pz5.setIunits(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct iunits field + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'iunits' + if ~eq(out.iunits, unit('Hz')), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setIunits method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setIunits(pz5, pz2, unit('mol')); + o3 = setIunits(pz5, pz2, unit('mol')); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_setName.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_setName.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,561 @@ +% UTP_PZMODEL_SETNAME a set of UTPs for the pzmodel/setName method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_setName.m,v 1.4 2011/04/19 18:14:02 ingo Exp $ +% + +% +% +% The setName method of the pzmodel class sets the name property. +% +% + +function results = utp_pzmodel_setName(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'setName'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PZMODEL objects + [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('name'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('name')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('name'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setName method works with a vector of PZMODEL objects as input. + % + % + function result = utp_02 + + % + % + % Test that the setName method works for a vector of PZMODEL objects as input. + % + % + + try + % + out = setName(pzv, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pzv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pzv)), atest = false; end + % Check name field of each output + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setName method works with a matrix of PZMODEL objects as input. + % + % + function result = utp_03 + + % + % + % Test that the setName method works for a matrix of PZMODEL objects as input. + % + % + + try + % + out = setName(pzm, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pzm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pzm)), atest = false; end + % Check name field of each output + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setName method works with a list of PZMODEL objects as input. + % + % + function result = utp_04 + + % + % + % Test that the setName method works for a list of PZMODEL objects as input. + % + % + + try + % + out = setName(pz5,pz4,pz3, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~strcmp(out(1).name, 'my name'), atest = false; end + if ~strcmp(out(2).name, 'my name'), atest = false; end + if ~strcmp(out(3).name, 'my name'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setName method works with a mix of different shaped PZMODEL + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the setName method works with an input of matrices and vectors + % and single PZMODEL objects. + % + % + + try + % + out = setName(pz5,pzv,pz4,pzm,pz3, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(pzm)+numel(pzv)), atest = false; end + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setName method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setName method can be processed back + % to an m-file. + % + % + + try + % + out1 = setName(pz5, 'my name'); + out2 = testCallerIsMethod(@setName, pz5, 'my name'); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setName'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setName'. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setName') && ... + eq(out1.hist.plistUsed, plist('name', 'my name'), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('name', 'my name'), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'name'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setName method can modify the input PZMODEL object. + % + % + function result = utp_07 + + % + % + % Test that the setName method can modify the input PZMODEL object + % by calling with no output. + % + % + + try + % + % copy pz5 to work with + ain = pzmodel(pz5); + % modify ain + aout = ain.setName('my name'); + ain.setName('my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'pz5' and 'ain' are now different. + % 2) Check that 'ain' has the correct name field + % + % + + atest = true; + if stest + % + % Check that setName modified the input by comparing to the copy + if eq(pzmodel(pz5), ain, ple1), atest = false; end + % Check that setName doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~strcmp(ain.name, 'my name'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setName method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setName method can modify the property 'name' + % with a value in a plist. + % + % + + try + % + pl = plist('name', 'my name'); + out = pz5.setName(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct name field + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'name' + if ~strcmp(out.name, 'my name'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setName method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setName(pz5, pz2, 'new name'); + o3 = setName(pz5, pz2, 'new name'); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_setOunits.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_setOunits.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,561 @@ +% UTP_PZMODEL_SETOUNITS a set of UTPs for the pzmodel/setOunits method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_setOunits.m,v 1.4 2011/04/19 18:14:02 ingo Exp $ +% + +% +% +% The setOunits method of the pzmodel class sets the ounits property. +% +% + +function results = utp_pzmodel_setOunits(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'setOunits'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PZMODEL objects + [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('ounits'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('ounits')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('ounits'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setOunits method works with a vector of PZMODEL objects as input. + % + % + function result = utp_02 + + % + % + % Test that the setOunits method works for a vector of PZMODEL objects as input. + % + % + + try + % + out = setOunits(pzv, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pzv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pzv)), atest = false; end + % Check ounits field of each output + for kk=1:numel(out) + if ~eq(out(kk).ounits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setOunits method works with a matrix of PZMODEL objects as input. + % + % + function result = utp_03 + + % + % + % Test that the setOunits method works for a matrix of PZMODEL objects as input. + % + % + + try + % + out = setOunits(pzm, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pzm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pzm)), atest = false; end + % Check ounits field of each output + for kk=1:numel(out) + if ~eq(out(kk).ounits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setOunits method works with a list of PZMODEL objects as input. + % + % + function result = utp_04 + + % + % + % Test that the setOunits method works for a list of PZMODEL objects as input. + % + % + + try + % + out = setOunits(pz5,pz4,pz3, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~eq(out(1).ounits, unit('Hz')), atest = false; end + if ~eq(out(2).ounits, unit('Hz')), atest = false; end + if ~eq(out(3).ounits, unit('Hz')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setOunits method works with a mix of different shaped PZMODEL + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the setOunits method works with an input of matrices and vectors + % and single PZMODEL objects. + % + % + + try + % + out = setOunits(pz5,pzv,pz4,pzm,pz3, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(pzm)+numel(pzv)), atest = false; end + for kk=1:numel(out) + if ~eq(out(kk).ounits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setOunits method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setOunits method can be processed back + % to an m-file. + % + % + + try + % + out1 = setOunits(pz5, unit('Hz')); + out2 = testCallerIsMethod(@setOunits, pz5, unit('Hz')); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setOunits'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setOunits'. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setOunits') && ... + eq(out1.hist.plistUsed, plist('ounits', unit('Hz')), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('ounits', unit('Hz')), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'ounits'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setOunits method can modify the input PZMODEL object. + % + % + function result = utp_07 + + % + % + % Test that the setOunits method can modify the input PZMODEL object + % by calling with no output. + % + % + + try + % + % copy pz5 to work with + ain = pzmodel(pz5); + % modify ain + aout = ain.setOunits(unit('Hz')); + ain.setOunits(unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'pz5' and 'ain' are now different. + % 2) Check that 'ain' has the correct ounits field + % + % + + atest = true; + if stest + % + % Check that setOunits modified the input by comparing to the copy + if eq(pzmodel(pz5), ain, ple1), atest = false; end + % Check that setOunits doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~eq(ain.ounits, unit('Hz')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setOunits method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setOunits method can modify the property 'ounits' + % with a value in a plist. + % + % + + try + % + pl = plist('ounits', unit('Hz')); + out = pz5.setOunits(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct ounits field + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'ounits' + if ~eq(out.ounits, unit('Hz')), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setOunits method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setOunits(pz5, pz2, unit('mol')); + o3 = setOunits(pz5, pz2, unit('mol')); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_simplify.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_simplify.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,568 @@ +% UTP_PZMODEL_SIMPLIFY a set of UTPs for the pzmodel/simplify method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_simplify.m,v 1.3 2009/07/23 18:56:38 ingo Exp $ +% + +% +% +% The simplify method of the pzmodel class simplifies pzmodels by +% cancelling like poles with like zeros. +% +% + +function results = utp_pzmodel_simplify(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'simplify'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test cancle poles at different positions + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('tol'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('tol'), 1e-10), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('tol'), {1e-10}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the simplify method works with a vector of PZMODELs as input. + % + % + function result = utp_02 + + % + % + % Test that the simplify method works for a vector of PZMODELs as input. + % + % + + try + % + pz1 = pzmodel(2, [pz(1) pz(1,2) pz(3)], [pz(3) pz(1,2) pz(3)]); + pzv = [pz1, pz1, pz1]; + out = simplify(pzv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pzv' + % 2) Check the poles of the output + % 3) Check the zeros of the output + % + % + + atest = true; + if stest + % + if ~isequal(size(out), size(pzv)), atest = false; end + for kk = 1:numel(pzv) + % Check 'poles' + if ~eq(out(kk).poles, pz(1)), atest = false; end + % Check 'zeros' + if ~eq(out(kk).zeros, pz(3)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the simplify method works with a matrix of PZMODELs as input. + % + % + function result = utp_03 + + % + % + % Tests that the simplify method works with a matrix of PZMODELs as input. + % + % + + try + % + pz1 = pzmodel(2, [pz(1) pz(1,2) pz(3)], [pz(3) pz(1,2) pz(3)]); + pzm = [pz1, pz1, pz1; pz1, pz1, pz1]; + out = simplify(pzm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pzm' + % 2) Check the poles of the output + % 3) Check the zeros of the output + % + % + + atest = true; + if stest + % + if ~isequal(size(out), size(pzm)), atest = false; end + for kk = 1:numel(pzm) + % Check 'poles' + if ~eq(out(kk).poles, pz(1)), atest = false; end + % Check 'zeros' + if ~eq(out(kk).zeros, pz(3)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the simplify method works with a list of PZMODELs as input. + % + % + function result = utp_04 + + % + % + % Tests that the simplify method works with a list of PZMODELs as input. + % + % + + try + % + pz1 = pzmodel(2, [pz(1) pz(1,2) pz(3)], [pz(3) pz(1,2) pz(3)]); + out = simplify(pz1, pz1, pz1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in the input + % 2) Check the poles of the output + % 3) Check the zeros of the output + % + % + + atest = true; + pzin = [pz1, pz1, pz1]; + if stest + % + if ~isequal(size(out), size(pzin)), atest = false; end + for kk = 1:numel(pzin) + % Check 'poles' + if ~eq(out(kk).poles, pz(1)), atest = false; end + % Check 'zeros' + if ~eq(out(kk).zeros, pz(3)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the simplify method works with a mix of different shaped + % PZMODELs as input. + % + % + function result = utp_05 + + % + % + % Tests that the simplify method works with a mix of different shaped + % PZMODELs as input. + % + % + + try + % + pz1 = pzmodel(2, [pz(1) pz(1,2) pz(3)], [pz(3) pz(1,2) pz(3)]); + out = simplify(pz1, [pz1, pz1], pz1, [pz1, pz1;pz1, pz1]); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in the input + % 2) Check the poles of the output + % 3) Check the zeros of the output + % 4) Check the re-built object + % + % + + atest = true; + pzin = [pz1, pz1, pz1, pz1, pz1, pz1, pz1, pz1]; + if stest + % + if ~isequal(size(out), size(pzin)), atest = false; end + for kk = 1:numel(pzin) + % Check 'poles' + if ~eq(out(kk).poles, pz(1)), atest = false; end + % Check 'zeros' + if ~eq(out(kk).zeros, pz(3)), atest = false; end + end + % Check the re-built object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the simplify method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the simplify method can be processed + % back. + % + % + + try + % + pz1 = pzmodel(2, [pz(1) pz(1,2) pz(3)], [pz(3) pz(1,2) pz(3)]); + out = simplify(pz1); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'simplify'. + % 2) Check that re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'simplify'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the simplify method can modify the input PZMODEL. + % + % + function result = utp_07 + + % + % + % Test that the simplify method can modify the input PZMODEL by calling + % with no output and that the method doesn't change the input of the + % function notation (with a equal sign). + % + % + + try + % + pz1 = pzmodel(2, [pz(1) pz(1,2) pz(3)], [pz(3) pz(1,2) pz(3)]); + amodi = pzmodel(pz1); + aeq = pzmodel(pz1); + out = aeq.simplify(); + amodi.simplify(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'out' and 'aeq' are now different. + % 2) Check that 'aeq' is not changed + % 3) Check that the modified input is the simplified value of the copy + % 4) Check that out and amodi are the same + % + % + + atest = true; + if stest + % + % Check that 'out' and 'aeq' are now different. + if eq(out, aeq, ple2), atest = false; end + % Check that 'aeq' is not changed + if ~eq(aeq, pzmodel(pz1), ple1), atest = false; end + % Check that the modified input is simplified + if ~eq(amodi.poles, pz(1)), atest = false; end + if ~eq(amodi.zeros, pz(3)), atest = false; end + % Check that out and amodi are the same + if ~eq(out, amodi, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Check that the simplify method cancle poles/zeros at different + % positions. + % + % + function result = utp_08 + + % + % + % Check that the simplify method cancle poles/zeros at different + % positions. + % + % + + try + % + % Cancle at POLE: End + pz1 = pzmodel(1, [pz(1), pz(1,2)], [pz(3), pz(1,2), pz(4)]); + pz1.simplify(); + % Cancle at POLE: End + Middle + pz2 = pzmodel(1, [pz(1), pz(2), pz(7), pz(1,2)], [pz(1), pz(6,2), pz(4), pz(2)]); + pz2.simplify(); + % Cancle at POLE: End + Begin + pz3 = pzmodel(1, [pz(1), pz(2), pz(7), pz(1,2)], [pz(1), pz(1,2), pz(4)]); + pz3.simplify(); + % Cancle at POLE: Begin + pz4 = pzmodel(1, [pz(1), pz(1,2)], [pz(1), pz(3,2), pz(4)]); + pz4.simplify(); + % Cancle at POLE: Begin + Middle + pz5 = pzmodel(1, [pz(1), pz(1,2), pz(9)], [pz(1), pz(1,2)]); + pz5.simplify(); + % Cancle at POLE: Begin + Middle + End + pz6 = pzmodel(1, [pz(1), pz(3), pz(1,2), pz(9)], [pz(1), pz(9), pz(5), pz(1,2)]); + pz6.simplify(); + % Cancle at ZERO: End + pz7 = pzmodel(1, [pz(5), pz(1,2), pz(4)], [pz(1), pz(1,2)]); + pz7.simplify(); + % Cancle at ZERO: End + Middle + pz8 = pzmodel(1, [pz(1), pz(1,2), pz(4), pz(2)], [pz(1+2i), pz(2), pz(7), pz(1,2)]); + pz8.simplify(); + % Cancle at ZERO: End + Begin + pz9 = pzmodel(1, [pz(1), pz(1,2), pz(4)], [pz(1), pz(2), pz(7), pz(1,2)]); + pz9.simplify(); + % Cancle at ZERO: Begin + pz10 = pzmodel(1, [pz(1), pz(3,2), pz(4)], [pz(1), pz(1,2)]); + pz10.simplify(); + % Cancle at ZERO: Begin + Middle + pz11 = pzmodel(1, [pz(1), pz(1,2)], [pz(1), pz(1,2), pz(9)]); + pz11.simplify(); + % Cancle at ZERO: Begin + Middle + End + pz12 = pzmodel(1, [pz(1), pz(9), pz(5), pz(1,2)], [pz(1), pz(3), pz(1,2), pz(9)]); + pz12.simplify(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the poles and peros of the output. + % + % + + atest = true; + if stest + % + if ~eq(pz1.poles, pz(1)), atest = false; end + if ~eq(pz1.zeros, [pz(3), pz(4)]), atest = false; end + if ~eq(pz2.poles, [pz(7), pz(1,2)]), atest = false; end + if ~eq(pz2.zeros, [pz(6,2), pz(4)]), atest = false; end + if ~eq(pz3.poles, [pz(2), pz(7)]), atest = false; end + if ~eq(pz3.zeros, pz(4)), atest = false; end + if ~eq(pz4.poles, pz(1,2)), atest = false; end + if ~eq(pz4.zeros, [pz(3,2), pz(4)]), atest = false; end + if ~eq(pz5.poles, pz(9)), atest = false; end + if ~isempty(pz5.zeros), atest = false; end + if ~eq(pz6.poles, pz(3)), atest = false; end + if ~eq(pz6.zeros, pz(5)), atest = false; end + if ~eq(pz7.poles, [pz(5), pz(4)]), atest = false; end + if ~eq(pz7.zeros, pz(1)), atest = false; end + if ~eq(pz8.poles, [pz(1), pz(4)]), atest = false; end + if ~eq(pz8.zeros, [pz(1+2i), pz(7)]), atest = false; end + if ~eq(pz9.poles, pz(4)), atest = false; end + if ~eq(pz9.zeros, [pz(2), pz(7)]), atest = false; end + if ~eq(pz10.poles, [pz(3,2), pz(4)]), atest = false; end + if ~eq(pz10.zeros, pz(1,2)), atest = false; end + if ~isempty(pz11.poles), atest = false; end + if ~eq(pz11.zeros, pz(9)), atest = false; end + if ~eq(pz12.poles, pz(5)), atest = false; end + if ~eq(pz12.zeros, pz(3)), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_string.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_string.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,430 @@ +% UTP_PZMODEL_STRING a set of UTPs for the pzmodel/string method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_string.m,v 1.2 2009/07/23 18:56:38 ingo Exp $ +% + +% +% +% The string method of the pzmodel class writes a command string that can be +% used to recreate the input object(s). But the object should not have more than +% one history step. +% +% + +function results = utp_pzmodel_string(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'string'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + pl1 = plist('gain', 3, 'poles', {1, [2 3]}, 'zeros', pz(8), 'iunits', 's^-2', 'ounits', 'mm'); + pz1 = pzmodel(pl1); + pl2 = plist('poles', pz(8,3), 'zeros', [pz(2) pz(4-2i)]); + pz2 = pzmodel(pl2); + pzv = [pz1, pz2, pz1]; + pzm = [pz1, pz2, pz1; pz1, pz2, pz1]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Negative test: The object have more than one history step. + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the string method works with a vector of PZMODEL objects as input. + % + % + function result = utp_02 + + % + % + % Test that the string method works for a vector of PZMODEL objects as input. + % + % + + try + % + out = string(pzv); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end; + if ~isa(rout, 'pzmodel'), atest = false; end + if numel(rout) ~= numel(pzv), atest = false; end + for kk = 1:numel(pzv) + if eq(rout(kk), pzv(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the string method works with a matrix of PZMODEL objects as input. + % + % + function result = utp_03 + + % + % + % Test that the string method works for a matrix of PZMODEL objects as input. + % + % + + try + % + out = string(pzm); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'pzmodel'), atest = false; end + if numel(rout) ~= numel(pzm), atest = false; end + for kk = 1:numel(pzm) + if eq(rout(kk), pzm(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the string method works with a list of PZMODEL objects as input. + % + % + function result = utp_04 + + % + % + % Test that the string method works for a list of PZMODEL objects as input. + % + % + + try + % + out = string(pz1,pz2); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + pzin = [pz1, pz2]; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'pzmodel'), atest = false; end + if numel(rout) ~= numel(pzin), atest = false; end + for kk = 1:numel(pzin) + if eq(rout(kk), pzin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the string method works with a mix of different shaped PZMODEL objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the string method works with an input of matrices and vectors + % and single PZMODEL objects. + % + % + + try + % + out = string(pz1,pzm,pz2); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + pzin = [pz1, reshape(pzm, 1, []), pz2]; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'pzmodel'), atest = false; end + if numel(rout) ~= numel(pzin), atest = false; end + for kk = 1:numel(pzin) + if eq(rout(kk), pzin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the string method properly applies history. + % + % + function result = utp_06 + + % + % + % The method string doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the string method doesn't work if the PZMODEL object have more + % than one history step. + % + % + function result = utp_07 + + % + % + % The method string throws an error because the input object have more than + % one history step. + % + % + + try + % + pz3 = pzmodel(3, pz(5), pz(2+1i)); + pz3.setName('Second history step'); + out = pz3.string(); + % + stest = false; + catch err + stest = true; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_submit.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_submit.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,528 @@ +% UTP_PZMODEL_SUBMIT a set of UTPs for the pzmodel/submit method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_submit.m,v 1.14 2010/08/18 09:25:55 ingo Exp $ +% + +% +% +% The bsubmit method of the pzmodel class submits a collection of objects +% in XML form to an LTPDA Repository. The type of the objects are +% independent. +% +% + +function results = utp_pzmodel_submit(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'submit'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel; + plForAutoTest = plist('no dialog', true, 'use selector', false); + + conn = utpGetConnection(); + try + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_pzmodel_submit: submit pzmodel'; + sinfo.experiment_description = 'utp_pzmodel_submit: description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test output of the data + catch + end + + % Close connection + utpCloseConnection(conn); + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 16, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('sinfo filename'), atest = false; end + if ~io(3).plists.isparam('binary'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isEmptyChar(io(3).plists.find('sinfo filename')), atest = false; end + if ~isequal(io(3).plists.find('binary'), false), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the submit method works with a vector of PZMODEL objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the submit method works for a vector of PZMODEL objects as + % input. + % + % + + try + % + [ids, cids] = submit(pzv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + robjs3 = ltpda_uo.retrieve(conn, ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(pzv), atest = false; end + if numel(robjs2) ~= numel(pzv), atest = false; end + if numel(robjs3) ~= numel(pzv), atest = false; end + % Check the retrieved object against the submitted + if ~eq(pzv, [robjs1{:}]), atest = false; end + if ~eq(pzv, [robjs2{:}]), atest = false; end + if ~eq(pzv, [robjs3{:}]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the submit method works with a matrix of PZMODEL objects as + % input. + % + % + function result = utp_03 + + % + % + % Tests that the submit method works with a matrix of PZMODEL objects + % as input. + % + % + + try + % + [ids, cids] = submit(pzm, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + robjs3 = ltpda_uo.retrieve(conn, ids(1), ids(2), ids(3), ids(4), ids(5), ids(6)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(pzm), atest = false; end + if numel(robjs2) ~= numel(pzm), atest = false; end + if numel(robjs3) ~= numel(pzm), atest = false; end + % Check the retrieved object against the submitted + if ~eq(pzm, reshape([robjs1{:}], size(pzm))), atest = false; end + if ~eq(pzm, reshape([robjs2{:}], size(pzm))), atest = false; end + if ~eq(pzm, reshape([robjs3{:}], size(pzm))), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the submit method works with a list of PZMODEL objects as + % input. + % + % + function result = utp_04 + + % + % + % Tests that the submit method works with a list of PZMODEL objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = submit(pz1, pl, iir, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + robjs3 = ltpda_uo.retrieve(conn, ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 3, atest = false; end + if numel(robjs2) ~= 3, atest = false; end + if numel(robjs3) ~= 3, atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, pz1), atest = false; end + if ~eq(robjs1{3}, pl), atest = false; end + if ~eq(robjs1{2}, iir), atest = false; end + % Check robjs2 + if ~eq(robjs2{1}, pz1), atest = false; end + if ~eq(robjs2{3}, pl), atest = false; end + if ~eq(robjs2{2}, iir), atest = false; end + % Check robjs3 + if ~eq(robjs3{1}, pz1), atest = false; end + if ~eq(robjs3{3}, pl), atest = false; end + if ~eq(robjs3{2}, iir), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the abs method works with a mix of different shaped PZMODEL + % objects as input. + % + % + function result = utp_05 + + % + % + % Tests that the submit method works with a list of PZMODEL objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = submit(pl, pzm, iir, pzv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 2 + numel(pzm) + numel(pzv), atest = false; end + if numel(robjs2) ~= 2 + numel(pzm) + numel(pzv), atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, pzm(1)), atest = false; end + if ~eq(robjs1{2}, pzm(2)), atest = false; end + if ~eq(robjs1{3}, pzm(3)), atest = false; end + if ~eq(robjs1{4}, pzm(4)), atest = false; end + if ~eq(robjs1{5}, pzm(5)), atest = false; end + if ~eq(robjs1{6}, pzm(6)), atest = false; end + if ~eq(robjs1{7}, iir), atest = false; end + if ~eq(robjs1{8}, pzv(1)), atest = false; end + if ~eq(robjs1{9}, pzv(2)), atest = false; end + if ~eq(robjs1{10}, pzv(3)), atest = false; end + if ~eq(robjs1{11}, pl), atest = false; end + % Check robjs2 + if ~isequalwithequalnans(robjs1, robjs2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tthe submit method properly applies history. + % + % + function result = utp_06 + + % + % + % Tthe submit method properly applies history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the submit method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [ids, cids] = submit(pz1, pz2, sinfo, plForAutoTest); + + [o1, o2] = ltpda_uo.retrieve(conn, 'Collection', cids); + o3 = ltpda_uo.retrieve(conn, 'Collection', cids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the output + if ~eq(o1, pz1), atest = false; end + if ~eq(o2, pz2), atest = false; end + if ~eq(o3{1}, pz1), atest = false; end + if ~eq(o3{2}, pz2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_times.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_times.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,494 @@ +% UTP_PZMODEL_TIMES a set of UTPs for the pzmodel/times method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_times.m,v 1.2 2009/07/23 18:56:38 ingo Exp $ +% + +% +% +% The times method of the pzmodel class overloads the multiplication +% operator for PZMODELs. +% +% + +function results = utp_pzmodel_times(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'times'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the I-/O-units + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the times method works with a vector of PZMODELs as input. + % + % + function result = utp_02 + + % + % + % Test that the times method works for a vector of PZMODELs as input. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-4)); + pz2 = pzmodel(3, pz(2), pz(-3)); + pz3 = pzmodel(4, pz(3), pz(-2)); + pz4 = pzmodel(5, pz(4), pz(-1)); + out1 = times(pz1, [pz2, pz3, pz4 pz1]); + out2 = pz1 .* [pz2, pz3, pz4 pz1]; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one PZMODEL object. + % 2) Check the gain of the output + % 3) Check the poles of the output + % 4) Check the zeros of the output + % + % + + atest = true; + if stest + % + if numel(out1) ~= 1, atest = false; end + if numel(out2) ~= 1, atest = false; end + % Check 'gain' + if out1.gain ~= (2 * 3 * 4 * 5 * 2), atest = false; end + if out2.gain ~= (2 * 3 * 4 * 5 * 2), atest = false; end + % Check 'poles' + if ~eq(out1.poles, [pz(1), pz(2), pz(3), pz(4), pz(1)]), atest = false; end + if ~eq(out2.poles, [pz(1), pz(2), pz(3), pz(4), pz(1)]), atest = false; end + % Check 'zeros' + if ~eq(out1.zeros, [pz(-4), pz(-3), pz(-2), pz(-1), pz(-4)]), atest = false; end + if ~eq(out2.zeros, [pz(-4), pz(-3), pz(-2), pz(-1), pz(-4)]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the times method works with a matrix of PZMODELs as input. + % + % + function result = utp_03 + + % + % + % Tests that the times method works with a matrix of PZMODELs as input. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-4)); + pz2 = pzmodel(3, pz(2), pz(-3)); + pz3 = pzmodel(4, pz(3), pz(-2)); + pz4 = pzmodel(5, pz(4), pz(-1)); + out1 = times(pz1, [pz4, pz3, pz2; pz1 pz4 pz3]); + out2 = pz1 .* [pz4, pz3, pz2; pz1 pz4 pz3]; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one PZMODEL object. + % 2) Check the gain of the output + % 3) Check the poles of the output + % 4) Check the zeros of the output + % + % + + atest = true; + if stest + % + if numel(out1) ~= 1, atest = false; end + if numel(out2) ~= 1, atest = false; end + % Check 'gain' + if out1.gain ~= (2 * 5 * 2 * 4 * 5 * 3 * 4), atest = false; end + if out2.gain ~= (2 * 5 * 2 * 4 * 5 * 3 * 4), atest = false; end + % Check 'poles' + if ~eq(out1.poles, [pz(1), pz(4), pz(1), pz(3), pz(4), pz(2), pz(3)]), atest = false; end + if ~eq(out2.poles, [pz(1), pz(4), pz(1), pz(3), pz(4), pz(2), pz(3)]), atest = false; end + % Check 'zeros' + if ~eq(out1.zeros, [pz(-4), pz(-1), pz(-4), pz(-2), pz(-1), pz(-3), pz(-2), ]), atest = false; end + if ~eq(out2.zeros, [pz(-4), pz(-1), pz(-4), pz(-2), pz(-1), pz(-3), pz(-2), ]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the times method works with a list of PZMODELs as input. + % + % + function result = utp_04 + + % + % + % Tests that the times method works with a list of PZMODELs as input. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-4)); + pz2 = pzmodel(3, pz(2), pz(-3)); + pz3 = pzmodel(4, pz(3), pz(-2)); + out1 = times(pz1, pz2, pz3); + out2 = pz1 .* pz2 .* pz3; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one PZMODEL object. + % 2) Check the gain of the output + % 3) Check the poles of the output + % 4) Check the zeros of the output + % + % + + atest = true; + if stest + % + if numel(out1) ~= 1, atest = false; end + if numel(out2) ~= 1, atest = false; end + % Check 'gain' + if out1.gain ~= (2 * 3 * 4), atest = false; end + if out2.gain ~= (2 * 3 * 4), atest = false; end + % Check 'poles' + if ~eq(out1.poles, [pz(1), pz(2), pz(3)]), atest = false; end + if ~eq(out2.poles, [pz(1), pz(2), pz(3)]), atest = false; end + % Check 'zeros' + if ~eq(out1.zeros, [pz(-4), pz(-3), pz(-2)]), atest = false; end + if ~eq(out2.zeros, [pz(-4), pz(-3), pz(-2)]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the times method works with a mix of different shaped + % PZMODELs as input. + % + % + function result = utp_05 + + % + % + % Tests that the times method works with a mix of different shaped + % PZMODELs as input. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-4)); + pz2 = pzmodel(3, pz(2), pz(-3)); + pz3 = pzmodel(4, pz(3), pz(-2)); + pz4 = pzmodel(5, pz(4), pz(-1)); + out1 = times(pz1, [pz2 pz3], pz4); + out2 = pz1 .* [pz2 pz3] .* pz4; + mout = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is exact one PZMODEL object. + % 2) Check the gain of the output + % 3) Check the poles of the output + % 4) Check the zeros of the output + % 5) Check the rebuilt object + % + % + + atest = true; + if stest + % + if numel(out1) ~= 1, atest = false; end + if numel(out2) ~= 1, atest = false; end + % Check 'gain' + if out1.gain ~= (2 * 3 * 4 * 5), atest = false; end + if out2.gain ~= (2 * 3 * 4 * 5), atest = false; end + % Check 'poles' + if ~eq(out1.poles, [pz(1), pz(2), pz(3), pz(4)]), atest = false; end + if ~eq(out2.poles, [pz(1), pz(2), pz(3), pz(4)]), atest = false; end + % Check 'zeros' + if ~eq(out1.zeros, [pz(-4), pz(-3), pz(-2), pz(-1)]), atest = false; end + if ~eq(out2.zeros, [pz(-4), pz(-3), pz(-2), pz(-1)]), atest = false; end + % Check the rebuilt object + if ~eq(mout, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the times method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the times method can be processed + % back. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-4)); + pz2 = pzmodel(3, pz(2), pz(-3)); + out = times(pz1, pz2); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'times'. + % 2) Check that re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'times'), atest = false; end + % The rebuilt object must be the same as 'out' + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the times method only multiply PZMODELs with the same output + % units. + % + % + function result = utp_07 + + % + % + % Check that the times method only multiply PZMODELs with the same + % output units. Check also the negative case. + % + % + + try + % + pz1 = pzmodel(2, pz(1), pz(-3)); + pz2 = pzmodel(3, pz(2), pz(-2)); + pz3 = pzmodel(4, pz(3), pz(-1)); + pz1.setOunits('Hz Hz^-1/2'); + pz2.setOunits('Hz Hz^-1/2'); + pz3.setOunits('Hz Hz^-1/2'); + pz1.setIunits('m'); + pz2.setIunits('Hz Hz^-1/2'); + pz3.setIunits('Hz Hz^-1/2'); + out = pz1 .* pz2 .* pz3; + mout = rebuild(out); + % Negative case + pz2.setIunits('m'); + try + out = pz1 .* pz2; + stest = false; + catch + stest = true; + end + % + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the I-/O-units + % + % + + atest = true; + if stest + % + % Check the I-/O-units + if ~eq(out.iunits, unit('m')), atest = false; end + if ~eq(out.ounits, unit('Hz Hz^-1/2')), atest = false; end + % Check the re-built object. + if ~eq(mout, mout, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_tomfir.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_tomfir.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,559 @@ +% UTP_PZMODEL_TOMFIR a set of UTPs for the pzmodel/tomfir method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_tomfir.m,v 1.3 2009/07/23 18:56:38 ingo Exp $ +% + +% +% +% The tomfir method of the pzmodel class approximates a pole/zero model with an +% FIR filter. +% +% + +function results = utp_pzmodel_tomfir(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'tomfir'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PZMODELs + [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with additional plist with the key 'axis' + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 5, atest = false; end + % Check key + if ~io(3).plists.isparam('fs'), atest = false; end + if ~io(3).plists.isparam('f1'), atest = false; end + if ~io(3).plists.isparam('f2'), atest = false; end + if ~io(3).plists.isparam('nf'), atest = false; end + if ~io(3).plists.isparam('scale'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('fs'), 10), atest = false; end + if ~isequal(io(3).plists.find('f1'), 0), atest = false; end + if ~isequal(io(3).plists.find('f2'), 5), atest = false; end + if ~isequal(io(3).plists.find('nf'), 1000), atest = false; end + if ~isequal(io(3).plists.find('scale'), 'lin'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('fs'), {10}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('f1'), {0}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('f2'), {5}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('nf'), {1000}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('scale'), {'lin', 'log'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the tomfir method works with a vector of PZMODEL objects as input. + % + % + function result = utp_02 + + % + % + % Test that the tomfir method works for a vector of PZMODEL objects as input. + % + % + + try + % + out = tomfir(pzv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pzv' + % 2) Check that each output PZMODEL object contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pzv)), atest = false; end + % Check each output against the single steps + for kk=1:numel(out) + r = resp(pzv(kk), pzmodel.getInfo('tomfir').plists); + r.setFs(10); + if ~eq(mfir(r), out(kk), ple3), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the tomfir method works with a matrix of PZMODEL objects as input. + % + % + function result = utp_03 + + % + % + % Test that the tomfir method works for a matrix of PZMODEL objects as input. + % + % + + try + % + out = tomfir(pzm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pzm' + % 2) Check that each output PZMODEL object contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pzm)), atest = false; end + % Check each output against the single steps + for kk=1:numel(out) + r = resp(pzm(kk), pzmodel.getInfo('tomfir').plists); + r.setFs(10); + if ~eq(mfir(r), out(kk), ple3), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the tomfir method works with a list of PZMODEL objects as input. + % + % + function result = utp_04 + + % + % + % Test that the tomfir method works for a list of PZMODEL objects as input. + % + % + + try + % + out = tomfir(pz1,pz2,pz3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output PZMODEL object contains the correct data. + % + % + + atest = true; + pzin = [pz1,pz2,pz3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the single steps + for kk=1:numel(out) + r = resp(pzin(kk), pzmodel.getInfo('tomfir').plists); + r.setFs(10); + if ~eq(mfir(r), out(kk), ple3), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the tomfir method works with a mix of different shaped PZMODEL objects as + % input. + % + % + function result = utp_05 + + % + % + % Test that the tomfir method works with an input of matrices and vectors + % and single PZMODEL objects. + % + % + + try + % + out = tomfir(pz1,pzv,pz2,pzm,pz3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output PZMODEL object contains the correct data. + % + % + + atest = true; + pzin = [pz1,reshape(pzv,1,[]),pz2,reshape(pzm,1,[]),pz3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (numel(pzin)), atest = false; end + % Check each output against the single steps + for kk=1:numel(out) + r = resp(pzin(kk), pzmodel.getInfo('tomfir').plists); + r.setFs(10); + if ~eq(mfir(r), out(kk), ple3), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the tomfir method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the tomfir method can be processed back. + % + % + + try + % + out = tomfir(pz5); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'tomfir'. + % 2) Check that re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'tomfir'), atest = false; end + % Run 'test.m' and check the result + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the tomfir method can modify the input PZMODEL object. + % + % + function result = utp_07 + + % + % + % Test that the tomfir method can not modify the input PZMODEL object . + % The method must throw an error for the modifier call. + % + % + + % + try + ain.tomfir(); + stest = false; + catch err + stest = true; + end + % + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the tomfir method use the different values in a plist. + % + % + + try + % + fs = 5; + f2 = fs/2; + pl = plist('fs', fs, 'f1', 0, 'f2', f2, 'nf', 100); + out = tomfir(pz5, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check the re-built object + % + % + + atest = true; + if stest + % + % Check the output + if ~isa(out, 'mfir'), atest = false; end + if out.fs ~= fs, atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the tomfir method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = tomfir(pz5, pz4); + o3 = tomfir(pz5, pz4); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_tomiir.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_tomiir.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,990 @@ +% UTP_PZMODEL_TOMIIR a set of UTPs for the pzmodel/tomiir method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_tomiir.m,v 1.4 2010/08/19 13:27:27 ingo Exp $ +% + +% +% +% The tomiir method of the pzmodel class converts a pole/zero model to +% an IIR filter using a bilinear transform. +% +% + +function results = utp_pzmodel_tomiir(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'tomiir'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PZMODELs + [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with additional plist with the key 'axis' + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test indirect the protected 'pzm2ab' method. two complex pole/zero pairs + results = [results utp_11]; % Test indirect the protected 'pzm2ab' method. complex pole + results = [results utp_12]; % Test indirect the protected 'pzm2ab' method. complex zero + results = [results utp_13]; % Test indirect the protected 'pzm2ab' method. real pole + results = [results utp_14]; % Test indirect the protected 'pzm2ab' method. real zero + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('fs'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('fs'), 1), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('fs'), {1}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the tomiir method works with a vector of PZMODEL objects as input. + % + % + function result = utp_02 + + % + % + % Test that the tomiir method works for a vector of PZMODEL objects as input. + % + % + + try + % + out = tomiir(pzv); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pzv' + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pzv)), atest = false; end + if ~isa(out, 'miir'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the tomiir method works with a matrix of PZMODEL objects as input. + % + % + function result = utp_03 + + % + % + % Test that the tomiir method works for a matrix of PZMODEL objects as input. + % + % + + try + % + out = tomiir(pzm); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'pzm' + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pzm)), atest = false; end + if ~isa(out, 'miir'), atest = false; end + % Check the rebuilt object + for ii = 1:numel(out) + if ~eq(mout(ii), out(ii), ple2), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the tomiir method works with a list of PZMODEL objects as input. + % + % + function result = utp_04 + + % + % + % Test that the tomiir method works for a list of PZMODEL objects as input. + % + % + + try + % + out = tomiir(pz1,pz2,pz3); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output PZMODEL object contains the correct data. + % + % + + atest = true; + pzin = [pz1,pz2,pz3]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pzin)), atest = false; end + if ~isa(out, 'miir'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the tomiir method works with a mix of different shaped PZMODEL objects as + % input. + % + % + function result = utp_05 + + % + % + % Test that the tomiir method works with an input of matrices and vectors + % and single PZMODEL objects. + % + % + + try + % + out = tomiir(pz1,pzv,pz2,pzm,pz3); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output PZMODEL object contains the correct data. + % + % + + atest = true; + pzin = [pz1,reshape(pzv,1,[]),pz2,reshape(pzm,1,[]),pz3]; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(pzin)), atest = false; end + if ~isa(out, 'miir'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the tomiir method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the tomiir method can be processed back. + % + % + + try + % + out = tomiir(pz5); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'tomiir'. + % 2) Check that re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'tomiir'), atest = false; end + % Run 'test.m' and check the result + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the tomiir method can modify the input PZMODEL object. + % + % + function result = utp_07 + + % + % + % Test that the tomiir method can not modify the input PZMODEL object . + % The method must throw an error for the modifier call. + % + % + + % + try + ain.tomiir(); + stest = false; + catch err + stest = true; + end + % + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the tomiir method use the different values in a plist. + % + % + + try + % + fs = 5; + pl = plist('fs', fs); + out = tomiir(pz5, pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check the re-built object + % + % + + atest = true; + if stest + % + % Check the output + if ~isa(out, 'miir'), atest = false; end + if out.fs ~= fs, atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the tomiir method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = tomiir(pz5, pz4); + o3 = tomiir(pz5, pz4); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check indirect the protected 'pzm2ab' method because tomiir uses this + % method to get the a and b of the iir object. + % + % + function result = utp_10 + + % + % + % Create some special pole/zero models to test the 'pzm2ab' method + % indirect with the tomiir method. Test with complex pole/zero pairs. + % This UTP define a simple method to get the a-, and b-value from a + % complex pole/zero pair. + % It uses the following code: + function [a,b] = utp_cpz2ab(pf, pq, zf, zq, fs) + wp = pf*2*pi; + wp2 = wp^2; + wz = zf*2*pi; + wz2 = wz^2; + + k = 4*fs*fs + 2*wp*fs/pq + wp2; + + a(1) = (4*fs*fs + 2*wz*fs/zq + wz2)/k; + a(2) = (2*wz2 - 8*fs*fs)/k; + a(3) = (4*fs*fs - 2*wz*fs/zq + wz2)/k; + b(1) = 1; + b(2) = (2*wp2 - 8*fs*fs)/k; + b(3) = (wp2 + 4*fs*fs - 2*wp*fs/pq)/k; + + g = sum(a) / sum(b); + a = a / g; + end + % + + try + % + pzm1 = pzmodel(1, pz(1+2i), pz(1+5i)); + pzm2 = pzmodel(1, [pz(1+2i) pz(2+2i)], [pz(1+5i) pz(2+5i)]); + out1 = tomiir(pzm1); + out2 = tomiir(pzm2); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the output class + if ~isa(out1, 'miir'), atest = false; end + if ~isa(out2, 'miir'), atest = false; end + % Comput the a and b from a complex pole/zero pair + [a,b] = utp_cpz2ab(pzm1.poles.f, pzm1.poles.q, pzm1.zeros.f, pzm1.zeros.q, 1); + % Compute the cascade of the two different filters (necessary for pzm2): + [a1,b1] = utp_cpz2ab(pzm2.poles(1).f, pzm2.poles(1).q, pzm2.zeros(1).f, pzm2.zeros(1).q, 1); + [a2,b2] = utp_cpz2ab(pzm2.poles(2).f, pzm2.poles(2).q, pzm2.zeros(2).f, pzm2.zeros(2).q, 1); + ca(1) = a1(1)*a2(1); + ca(2) = a1(1)*a2(2) + a1(2)*a2(1); + ca(3) = a1(1)*a2(3) + a1(2)*a2(2) + a1(3)*a2(1); + ca(4) = a1(2)*a2(3) + a1(3)*a2(2); + ca(5) = a1(3)*a2(3); + cb(1) = b1(1)*b2(1); + cb(2) = b1(1)*b2(2) + b1(2)*b2(1); + cb(3) = b1(1)*b2(3) + b1(2)*b2(2) + b1(3)*b2(1); + cb(4) = b1(2)*b2(3) + b1(3)*b2(2); + cb(5) = b1(3)*b2(3); + % Check a and b + if ~isequal(a, out1.a), atest = false; end + if ~isequal(b, out1.b), atest = false; end + if ~isequal(ca, out2.a), atest = false; end + if ~isequal(cb, out2.b), atest = false; end + % Check the rebuilt object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_11 + + % + % + % Check indirect the protected 'pzm2ab' method because tomiir uses this + % method to get the a and b of the iir object. + % + % + function result = utp_11 + + % + % + % Create some special pole/zero models to test the 'pzm2ab' method indirect + % with the tomiir method. Test with complex poles. + % This UTPs define a simple method to get the a-, and b-value from a + % complex pole. It uses the following code: + function [a,b] = utp_cp2iir(pf, pq, fs) + w0 = pf*2*pi; + w02 = w0^2; + + k = (pq*w02 + 4*pq*fs*fs + 2*w0*fs) / (pq*w02); + + b(1) = 1; + b(2) = (2*w02-8*fs*fs) / (k*w02); + b(3) = (pq*w02 + 4*pq*fs*fs - 2*w0*fs) / (k*pq*w02); + + a(1) = 1/k; + a(2) = -2/k; + a(3) = -1/k; + a = a*-2; + end + % + + try + % + pzm1 = pzmodel(1, pz(1+2i), []); + pzm2 = pzmodel(1, [pz(1+2i) pz(2+2i)], []); + out1 = tomiir(pzm1); + out2 = tomiir(pzm2); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the output class + if ~isa(out1, 'miir'), atest = false; end + if ~isa(out2, 'miir'), atest = false; end + % Comput the a and b from a complex pole + [a,b] = utp_cp2iir(pzm1.poles.f, pzm1.poles.q, 1); + % Compute the cascade of the two different filters (necessary for pzm2): + [a1,b1] = utp_cp2iir(pzm2.poles(1).f, pzm2.poles(1).q, 1); + [a2,b2] = utp_cp2iir(pzm2.poles(2).f, pzm2.poles(2).q, 1); + ca(1) = a1(1)*a2(1); + ca(2) = a1(1)*a2(2) + a1(2)*a2(1); + ca(3) = a1(1)*a2(3) + a1(2)*a2(2) + a1(3)*a2(1); + ca(4) = a1(2)*a2(3) + a1(3)*a2(2); + ca(5) = a1(3)*a2(3); + cb(1) = b1(1)*b2(1); + cb(2) = b1(1)*b2(2) + b1(2)*b2(1); + cb(3) = b1(1)*b2(3) + b1(2)*b2(2) + b1(3)*b2(1); + cb(4) = b1(2)*b2(3) + b1(3)*b2(2); + cb(5) = b1(3)*b2(3); + % Check a and b + if ~isequal(a, out1.a), atest = false; end + if ~isequal(b, out1.b), atest = false; end + if ~isequal(ca, out2.a), atest = false; end + if ~isequal(cb, out2.b), atest = false; end + % Check the rebuilt object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_11 + + %% UTP_12 + + % + % + % Check indirect the protected 'pzm2ab' method because tomiir uses this + % method to get the a and b of the iir object. + % + % + function result = utp_12 + + % + % + % Create some special pole/zero models to test the 'pzm2ab' method indirect + % with the tomiir method. Test with complex zeros. + % This UTPs define a simple method to get the a-, and b-value from a + % complex zero. It uses the following code: + function [a,b] = utp_cz2iir(zf, zq, fs) + w0 = zf*2*pi; + w02 = w0^2; + + a(1) = (-zq*w02/2 - 2*zq*fs*fs - w0*fs) / (zq*w02); + a(2) = (-w02+4*fs*fs) / w02; + a(3) = (-zq*w02/2 - 2*zq*fs*fs + w0*fs) / (zq*w02); + + b(1) = 1; + b(2) = -2; + b(3) = -1; + end + % + + try + % + pzm1 = pzmodel(1, [], pz(1+2i)); + pzm2 = pzmodel(1, [], [pz(1+2i) pz(2+2i)]); + out1 = tomiir(pzm1); + out2 = tomiir(pzm2); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the output class + if ~isa(out1, 'miir'), atest = false; end + if ~isa(out2, 'miir'), atest = false; end + % Comput the a and b from a complex zero + [a,b] = utp_cz2iir(pzm1.zeros.f, pzm1.zeros.q, 1); + % Compute the cascade of the two different filters (necessary for pzm2): + [a1,b1] = utp_cz2iir(pzm2.zeros(1).f, pzm2.zeros(1).q, 1); + [a2,b2] = utp_cz2iir(pzm2.zeros(2).f, pzm2.zeros(2).q, 1); + ca(1) = a1(1)*a2(1); + ca(2) = a1(1)*a2(2) + a1(2)*a2(1); + ca(3) = a1(1)*a2(3) + a1(2)*a2(2) + a1(3)*a2(1); + ca(4) = a1(2)*a2(3) + a1(3)*a2(2); + ca(5) = a1(3)*a2(3); + cb(1) = b1(1)*b2(1); + cb(2) = b1(1)*b2(2) + b1(2)*b2(1); + cb(3) = b1(1)*b2(3) + b1(2)*b2(2) + b1(3)*b2(1); + cb(4) = b1(2)*b2(3) + b1(3)*b2(2); + cb(5) = b1(3)*b2(3); + % Check a and b + if ~isequal(a, out1.a), atest = false; end + if ~isequal(b, out1.b), atest = false; end + if ~isequal(ca, out2.a), atest = false; end + if ~isequal(cb, out2.b), atest = false; end + % Check the rebuilt object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Check indirect the protected 'pzm2ab' method because tomiir uses this + % method to get the a and b of the iir object. + % + % + function result = utp_13 + + % + % + % Create some special pole/zero models to test the 'pzm2ab' method indirect + % with the tomiir method. Test with real poles. + % This UTPs define a simple method to get the a-, and b-value from a + % real pole. It uses the following code: + function [a,b] = utp_rp2iir(pf, fs) + w0 = pf*2*pi; + a(1) = w0 / (2*fs + w0); + a(2) = a(1); + b(1) = 1; + b(2) = (w0-2*fs) / (w0+2*fs); + end + % + + try + % + pzm1 = pzmodel(1, pz(1), []); + pzm2 = pzmodel(1, [pz(1) pz(2)], []); + out1 = tomiir(pzm1); + out2 = tomiir(pzm2); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the output class + if ~isa(out1, 'miir'), atest = false; end + if ~isa(out2, 'miir'), atest = false; end + % Comput the a and b from a real pole + [a,b] = utp_rp2iir(pzm1.poles.f, 1); + % Compute the cascade of the two different filters (necessary for pzm2): + [a1,b1] = utp_rp2iir(pzm2.poles(1).f, 1); + [a2,b2] = utp_rp2iir(pzm2.poles(2).f, 1); + ca(1) = a1(1)*a2(1); + ca(2) = a1(1)*a2(2) + a1(2)*a2(1); + ca(3) = a1(2)*a2(2); + cb(1) = b1(1)*b2(1); + cb(2) = b1(1)*b2(2) + b1(2)*b2(1); + cb(3) = b1(2)*b2(2); + % Check a and b + if ~isequal(a, out1.a), atest = false; end + if ~isequal(b, out1.b), atest = false; end + if ~isequal(ca, out2.a), atest = false; end + if ~isequal(cb, out2.b), atest = false; end + % Check the rebuilt object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + %% UTP_14 + + % + % + % Check indirect the protected 'pzm2ab' method because tomiir uses this + % method to get the a and b of the iir object. + % + % + function result = utp_14 + + % + % + % Create some special pole/zero models to test the 'pzm2ab' method indirect + % with the tomiir method. Test with real zeros. + % This UTPs define a simple method to get the a-, and b-value from a + % real zero. It uses the following code: + function [a,b] = utp_rp2iir(zf, fs) + w0 = zf*2*pi; + a(1) = (2*fs + w0) / w0; + a(2) = (-2*fs + w0) / w0; + b(1) = 1; + b(2) = 1; + end + % + + try + % + pzm1 = pzmodel(1, [], pz(1)); + pzm2 = pzmodel(1, [], [pz(1) pz(2)]); + out1 = tomiir(pzm1); + out2 = tomiir(pzm2); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the output class + if ~isa(out1, 'miir'), atest = false; end + if ~isa(out2, 'miir'), atest = false; end + % Comput the a and b from a real zero + [a,b] = utp_rp2iir(pzm1.zeros.f, 1); + % Compute the cascade of the two different filters (necessary for pzm2): + [a1,b1] = utp_rp2iir(pzm2.zeros(1).f, 1); + [a2,b2] = utp_rp2iir(pzm2.zeros(2).f, 1); + ca(1) = a1(1)*a2(1); + ca(2) = a1(1)*a2(2) + a1(2)*a2(1); + ca(3) = a1(2)*a2(2); + cb(1) = b1(1)*b2(1); + cb(2) = b1(1)*b2(2) + b1(2)*b2(1); + cb(3) = b1(2)*b2(2); + % Check a and b + if ~isequal(a, out1.a), atest = false; end + if ~isequal(b, out1.b), atest = false; end + if ~isequal(ca, out2.a), atest = false; end + if ~isequal(cb, out2.b), atest = false; end + % Check the rebuilt object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_14 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_type.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_type.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,395 @@ +% UTP_PZMODEL_TYPE a set of UTPs for the pzmodel/type method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_type.m,v 1.2 2009/07/23 18:56:38 ingo Exp $ +% + +% +% +% The type method of the pzmodel class converts the input objects to +% MATLAB functions that reproduce the processing steps that led to the +% input objects. +% +% + +function results = utp_pzmodel_type(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'type'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test PZMODEL objects + [pz1, pz2, pz3, pz4, pz5, pzv, pzm] = get_test_objects_pzmodel; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % DEfine the filename + filename = 'test_pzmodel_type.m'; + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('filename'), atest = false; end + if ~io(3).plists.isparam('stop_option'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('filename')), atest = false; end + if ~isequal(io(3).plists.find('stop_option'), 'full'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('filename'), {''}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('stop_option'), {'full', 'File', 'Repo', 'File Repo', 'N'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the type method works with a vector of PZMODEL objects as input. + % + % + function result = utp_02 + + % + % + % Test that the type method works for a vector of PZMODEL objects as input. + % + % + + try + % + type(pzv, filename); + type(pzv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + if ~eq(pzv, mout, ple2), atest = false; end; + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the type method works with a matrix of PZMODEL objects as input. + % + % + function result = utp_03 + + % + % + % Test that the type method works for a matrix of PZMODEL objects as input. + % + % + + try + % + type(pzm, filename); + type(pzm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + % Type doesn't keep the shape + for ii = 1:numel(pzm) + if ~eq(pzm(ii), mout(ii), ple2), atest = false; end; + end + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the type method works with a list of PZMODEL objects as input. + % + % + function result = utp_04 + + % + % + % Test that the type method works for a list of PZMODEL objects as input. + % + % + + try + % + type(pz5,pz4,pz3, filename); + type(pz5,pz4,pz3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + pzin = [pz5,pz4,pz3]; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + % Type doesn't keep the shape + for ii = 1:numel(pzin) + if ~eq(pzin(ii), mout(ii), ple2), atest = false; end; + end + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the type method works with a mix of different shaped PZMODEL objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the type method works with an input of matrices and vectors + % and single PZMODEL objects. + % + % + + try + % + type(pz4,pzv,pz2,pzm,pz1, filename); + type(pz4,pzv,pz2,pzm,pz1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + pzin = [pz4,reshape(pzv,1,[]),pz2,reshape(pzm,1,[]),pz1]; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + % Type doesn't keep the shape + for ii = 1:numel(pzin) + if ~eq(pzin(ii), mout(ii), ple2), atest = false; end; + end + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the type method properly applies history. + % + % + function result = utp_06 + + % + % + % The method type doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/pzmodel/utp_pzmodel_update.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/pzmodel/utp_pzmodel_update.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,387 @@ +% UTP_PZMODEL_UPDATE a set of UTPs for the pzmodel/update method +% +% M Hewitson 06-08-08 +% +% $Id: utp_pzmodel_update.m,v 1.14 2010/08/18 09:25:55 ingo Exp $ +% + +% +% +% The update method of the pzmodel class updates (replace) an LTPDA object +% in the repository with the given replacement object. It is only possible +% to update one object. This is the reason why the general UTPs are not +% possible. +% +% + +function results = utp_pzmodel_update(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'pzmodel'; + mthd = 'update'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + obj = pzmodel(2, [pz(1) pz(1+2i)], pz(10), unit('V'), unit('Hz')); + obj.setName(); + + plForAutoTest = plist('no dialog', true, 'use selector', false); + conn = utpGetConnection(); + try + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_pzmodel_update: update pzmodel'; + sinfo.experiment_description = 'utp_pzmodel_update: description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + [ids, cids] = submit(obj, sinfo, plForAutoTest); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Test with conn + results = [results utp_03]; % Test with sinfo + results = [results utp_04]; % Test update of an binary file + results = [results utp_05]; % Test replace with other object + catch + end + + % Close connection + utpCloseConnection(conn); + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 15, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('binary'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isequal(io(3).plists.find('binary'), false), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_02 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Use a database object (conn) to establish the connection. + % + % + + try + % + % Make some changes to the object. + uobj = obj.setName('I was updated (conn)'); + update(uobj, ids, conn, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_03 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Use a database info structure (sinfo) to establish the connection. + % + % + + try + % + % Make some changes to the object. + uobj = obj.setName('I was updated (sinfo)'); + update(uobj, ids, sinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_04 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Check that the update method also updates objects which are stored as + % a binary file. + % + % + + try + % + % Submit the object as a binary + [ids_bin, cids] = bsubmit(obj, sinfo, plForAutoTest); + % Make some changes to the object. + uobj = obj.setName('I was updated (sinfo)'); + update(uobj, ids_bin, sinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids_bin' + robj = ltpda_uo.retrieve(conn, ids_bin); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the update method replaces the object in the repository with + % a completely other object. + % + % + function result = utp_05 + + % + % + % Tests that the update method replaces the object in the repository + % with a completely other object. + % Replace the pzmodel object with a filter object. + % + % + + try + % + % Make some changes to the object. + uobj = miir(plist('type', 'lowpass')); + update(uobj, ids, sinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_bsubmit.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_bsubmit.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,526 @@ +% UTP_RATIONAL_BSUBMIT a set of UTPs for the rational/bsubmit method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_bsubmit.m,v 1.13 2010/08/18 09:25:56 ingo Exp $ +% + +% +% +% The bsubmit method of the rational class submits a collection of objects +% in binary form to an LTPDA Repository. The type of the objects are +% independent. +% +% + +function results = utp_rational_bsubmit(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'bsubmit'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + [ra1,ra2,ra3,rav,ram] = get_test_objects_rational; + plForAutoTest = plist('no dialog', true, 'use selector', false); + + conn = utpGetConnection(); + try + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_rational_bsubmit: submit rational'; + sinfo.experiment_description = 'utp_rational_bsubmit: description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test output of the data + catch + end + + % Close connection + utpCloseConnection(conn); + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 15, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('sinfo filename'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isEmptyChar(io(3).plists.find('sinfo filename')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the bsubmit method works with a vector of RATIONAL objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the bsubmit method works for a vector of RATIONAL objects as + % input. + % + % + + try + % + [ids, cids] = bsubmit(rav, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(rav), atest = false; end + if numel(robjs2) ~= numel(rav), atest = false; end + if numel(robjs3) ~= numel(rav), atest = false; end + % Check the retrieved object against the submitted + if ~eq(rav, [robjs1{:}]), atest = false; end + if ~eq(rav, [robjs2{:}]), atest = false; end + if ~eq(rav, [robjs3{:}]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the bsubmit method works with a matrix of RATIONAL objects as + % input. + % + % + function result = utp_03 + + % + % + % Tests that the bsubmit method works with a matrix of RATIONAL objects + % as input. + % + % + + try + % + [ids, cids] = bsubmit(ram, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3), ids(4), ids(5), ids(6)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(ram), atest = false; end + if numel(robjs2) ~= numel(ram), atest = false; end + if numel(robjs3) ~= numel(ram), atest = false; end + % Check the retrieved object against the submitted + if ~eq(ram, reshape([robjs1{:}], size(ram))), atest = false; end + if ~eq(ram, reshape([robjs2{:}], size(ram))), atest = false; end + if ~eq(ram, reshape([robjs3{:}], size(ram))), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the bsubmit method works with a list of RATIONAL objects as + % input. + % + % + function result = utp_04 + + % + % + % Tests that the bsubmit method works with a list of RATIONAL objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = bsubmit(ra1, pl, iir, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 3, atest = false; end + if numel(robjs2) ~= 3, atest = false; end + if numel(robjs3) ~= 3, atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, ra1), atest = false; end + if ~eq(robjs1{3}, pl), atest = false; end + if ~eq(robjs1{2}, iir), atest = false; end + % Check robjs2 + if ~eq(robjs2{1}, ra1), atest = false; end + if ~eq(robjs2{3}, pl), atest = false; end + if ~eq(robjs2{2}, iir), atest = false; end + % Check robjs3 + if ~eq(robjs3{1}, ra1), atest = false; end + if ~eq(robjs3{3}, pl), atest = false; end + if ~eq(robjs3{2}, iir), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the abs method works with a mix of different shaped RATIONAL + % objects as input. + % + % + function result = utp_05 + + % + % + % Tests that the bsubmit method works with a list of RATIONAL objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = bsubmit(pl, ram, iir, rav, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 2 + numel(ram) + numel(rav), atest = false; end + if numel(robjs2) ~= 2 + numel(ram) + numel(rav), atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, ram(1)), atest = false; end + if ~eq(robjs1{2}, ram(2)), atest = false; end + if ~eq(robjs1{3}, ram(3)), atest = false; end + if ~eq(robjs1{4}, ram(4)), atest = false; end + if ~eq(robjs1{5}, ram(5)), atest = false; end + if ~eq(robjs1{6}, ram(6)), atest = false; end + if ~eq(robjs1{7}, iir), atest = false; end + if ~eq(robjs1{8}, rav(1)), atest = false; end + if ~eq(robjs1{9}, rav(2)), atest = false; end + if ~eq(robjs1{10}, rav(3)), atest = false; end + if ~eq(robjs1{11}, pl), atest = false; end + % Check robjs2 + if ~isequalwithequalnans(robjs1, robjs2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tthe bsubmit method properly applies history. + % + % + function result = utp_06 + + % + % + % Tthe bsubmit method properly applies history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the bsubmit method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [ids, cids] = bsubmit(ra1, ra2, sinfo, plForAutoTest); + + [o1, o2] = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + o3 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the output + if ~eq(o1, ra1), atest = false; end + if ~eq(o2, ra2), atest = false; end + if ~eq(o3{1}, ra1), atest = false; end + if ~eq(o3{2}, ra2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_char.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_char.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,357 @@ +% UTP_RATIONAL_CHAR a set of UTPs for the rational/char method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_char.m,v 1.2 2009/07/27 19:28:59 ingo Exp $ +% + +% +% +% The char method of the rational class converts the objects into one +% character string which contains information of the object. +% +% + +function results = utp_rational_char(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'char'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test RATIONAL objects + [ra1,ra2,ra3,rav,ram] = get_test_objects_rational; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the char method works with a vector of RATIONAL objects as input. + % + % + function result = utp_02 + + % + % + % Test that the char method works for a vector of RATIONAL objects as input. + % + % + + try + % + out = char(rav); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end; + for kk = 1:numel(rav) + if isempty(strfind(out, rav(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the char method works with a matrix of RATIONAL objects as input. + % + % + function result = utp_03 + + % + % + % Test that the char method works for a matrix of RATIONAL objects as input. + % + % + + try + % + out = char(ram); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(ram) + if isempty(strfind(out, ram(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the char method works with a list of RATIONAL objects as input. + % + % + function result = utp_04 + + % + % + % Test that the char method works for a list of RATIONAL objects as input. + % + % + + try + % + out = char(ra1, ra2, ra3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + pain = [ra1, ra2, ra3]; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(pain) + if isempty(strfind(out, pain(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the char method works with a mix of different shaped RATIONAL objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the char method works with an input of matrices and vectors + % and single RATIONAL objects. + % + % + + try + % + out = char(ra1,rav,ra2,ram,ra3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + pain = [ra1,reshape(rav,1,[]),ra2,reshape(ram,1,[]),ra3]; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(pain) + if isempty(strfind(out, pain(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the char method properly applies history. + % + % + function result = utp_06 + + % + % + % The method char doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_copy.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_copy.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,50 @@ +% UTP_RATIONAL_COPY a set of UTPs for the rational/copy method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_copy.m,v 1.2 2009/08/08 12:21:40 hewitson Exp $ +% + +% +% +% The copy method of the rational class copies the input object depending +% of the second input. +% +% + +function results = utp_rational_copy(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'copy'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_69(class, 1, 1, ple2)]; + results = [results utp_69(class, 1, 3, ple2)]; + results = [results utp_69(class, 2, 3, ple2)]; + + 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 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_created.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_created.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,485 @@ +% UTP_RATIONAL_CREATED a set of UTPs for the rational/created method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_created.m,v 1.2 2009/07/27 19:28:59 ingo Exp $ +% + +% +% +% The created method of the rational returns a time object of the last +% modification. For this uses the created method the 'proctime' property of +% the last history step and computs from this value a timeobject. +% +% + +function results = utp_rational_created(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'created'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test RATIONAL objects + [ra1,ra2,ra3,rav,ram] = get_test_objects_rational; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test empty object + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the created method works with a vector of RATIONAL objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the created method works for a vector of RATIONAL objects as + % input. + % + % + + try + % + out = created(rav); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'rav' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if ~isequal(size(out), size(rav)), atest = false; end + % Check the time-object + for kk=1:numel(out) + if out(kk).utc_epoch_milli ~= rav(kk).hist.proctime, atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the created method works with a matrix of RATIONAL objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the created method works for a matrix of RATIONAL objects as + % input. + % + % + + try + % + out = created(ram); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'ram' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if ~isequal(size(out), size(ram)), atest = false; end + % Check time-object + for kk=1:numel(out) + if out(kk).utc_epoch_milli ~= ram(kk).hist.proctime, atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the created method works with a list of RATIONAL objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the created method works for a list of RATIONAL objects as + % input. + % + % + + try + % + out = created(ra1,ra2,ra3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if out(1).utc_epoch_milli ~= ra1.hist.proctime, atest = false; end + if out(2).utc_epoch_milli ~= ra2.hist.proctime, atest = false; end + if out(3).utc_epoch_milli ~= ra3.hist.proctime, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the created method works with a mix of different shaped + % RATIONAL objects as input. + % + % + function result = utp_05 + + % + % + % Test that the created method works with an input of matrices and + % vectors and single RATIONAL objects. + % + % + + try + % + out = created(ra1,rav,ra2,ram,ra3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + rain = [ra1,reshape(rav,1,[]),ra2,reshape(ram,1,[]),ra3]; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(ram)+numel(rav)), atest = false; end + for kk=1:numel(out) + if out(kk).utc_epoch_milli ~= rain(kk).hist.proctime, atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the created method properly applies history + % + % + function result = utp_06 + + % + % + % This method doesn't change the input object, thus no history is added + % to the object. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the created method can be used with the modify command. + % + % + function result = utp_07 + + % + % + % Tests that the created method can be used with the modify command. + % + % + + try + % + out1 = ra3.created; + out2 = ram.created; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the single object + % 2) Check the matrix object + % + % + + atest = true; + if stest + % + % Check the single object + if out1.utc_epoch_milli ~= ra3.hist.proctime, atest = false; end + % Check the matrix + for kk = 1:numel(out2) + if out2(kk).utc_epoch_milli ~= ram(kk).hist.proctime, atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the created method retruns always a well defined time object + % even for an empty input object. + % + % + function result = utp_08 + + % + % + % Test that the created method with an empty 'RATIONAL object + % + % + + try + % + ra = rational(); + out = ra.created; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a time object with a ell defined time. + % + % + + atest = true; + if stest + % + if ~isa(out, 'time'), atest = false; end + if isnan(out.utc_epoch_milli), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_creator.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_creator.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,520 @@ +% UTP_RATIONAL_CREATED a set of UTPs for the rational/creator method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_creator.m,v 1.2 2009/07/27 19:28:59 ingo Exp $ +% + +% +% +% The creator method of the rational extract the creator(s)/modifier from +% the history. Depending to the input parameter returns this method all +% creator/modifier or only the last creator/modifier. +% +% + +function results = utp_rational_creator(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'creator'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test RATIONAL objects + [ra1,ra2,ra3,rav,ram] = get_test_objects_rational; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with different creator/modifier + results = [results utp_09]; % Test negative case for the option 'all' + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('option'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('option')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('option'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the creator method works with a vector of RATIONAL objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the creator method works for a vector of RATIONAL objects as + % input. + % + % + + try + % + out = creator(rav); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'rav' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(rav), atest = false; end + % Check the creator + curr_creator = provenance(); + for kk=1:numel(out) + if ~strcmp(out{kk}, curr_creator.creator), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the creator method works with a matrix of RATIONAL objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the creator method works for a matrix of RATIONAL objects as + % input. + % + % + + try + % + out = creator(ram); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'ram' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(ram), atest = false; end + % Check creator + curr_creator = provenance(); + for kk=1:numel(out) + if ~strcmp(out{kk}, curr_creator.creator), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the creator method works with a list of RATIONAL objects as + % input. + % + % + function result = utp_04 + + % + % + % The creator method doesn't work for a list of RATIONAL objects as input. + % + % + + % + try + creator(ra1,ra2,ra3); + stest = false; + catch + stest = true; + end + % + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the creator method works with a mix of different shaped + % RATIONAL objects as input. + % + % + function result = utp_05 + + % + % + % The creator method doesn't work with different shaped input objects. + % + % + + % + try + creator(ra1,rav,ra2,ram,ra3); + stest = false; + catch + stest = true; + end + % + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the creator method properly applies history + % + % + function result = utp_06 + + % + % + % This method doesn't change the input object, thus no history is added + % to the object. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the creator method can be used with the modify command. + % + % + function result = utp_07 + + % + % + % Tests that the creator method can be used with the modify command. + % + % + + try + % + out1 = ra3.creator; + out2 = ram.creator; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the single object + % 2) Check the matrix object + % + % + + atest = true; + if stest + % + curr_creator = provenance(); + % Check the single object + if ~strcmp(out1, curr_creator.creator), atest = false; end + % For a single object must be the the output a char string + if ~ischar(out1), atest = false; end + % Check the matrix + for kk = 1:numel(out2) + if ~strcmp(out2{kk}, curr_creator.creator), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the creator method retruns all creator(s)/modifier(s) which + % are in the history. + % + % + function result = utp_08 + + % + % + % Test that the creator method uses the option 'all' direct or in a + % plist. The test file must have the modifier 'first', 'second' and + % 'third' + % + % + + try + % + % Read object with different modifier + ra = rational('test_rational_diff_creator.xml'); + out1 = ra.creator; + out2 = ra.creator('all'); + out3 = ra.creator(plist('option', 'all')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that out1 contains only one creator + % 2) Check that out2 contain more creator/modifier + % + % + + atest = true; + if stest + % + if ~ischar(out1), atest = false; end + if ~strmatch('fist', out2), atest = false; end + if ~strmatch('second', out2), atest = false; end + if ~strmatch('third', out2), atest = false; end + if ~strmatch('fist', out3), atest = false; end + if ~strmatch('second', out3), atest = false; end + if ~strmatch('third', out3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Tests the negative case for the option 'all'. + % + % + function result = utp_09 + + % + % + % Test that the creator method throws an error if the option 'all' is + % used in connection with a matrix/vector of RATIONAL objects. + % + % + + try + % + ram.creator('all'); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_display.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_display.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,367 @@ +% UTP_RATIONAL_DISPLAY a set of UTPs for the rational/display method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_display.m,v 1.2 2009/07/27 19:28:59 ingo Exp $ +% + +% +% +% The display method of the rational class prints defined values of an +% RATIONAL object. MATLAB calls display when it interprets an object that is +% not terminated by a semicolon. +% +% + +function results = utp_rational_display(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'display'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test RATIONAL objects + [ra1,ra2,ra3,rav,ram] = get_test_objects_rational; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the display method works with a vector of RATIONAL objects + % as input. + % + % + function result = utp_02 + + % + % + % Test that the display method works for a vector of RATIONAL objects + % as input. + % + % + + try + % + rav + out = display(rav); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + % Check the output + if ~iscell(out), atest = false; end; + for kk = 1:numel(rav) + if isempty(strfind(out, rav(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the display method works with a matrix of RATIONAL objects + % as input. + % + % + function result = utp_03 + + % + % + % Test that the display method works for a matrix of RATIONAL objects + % as input. + % + % + + try + % + ram + out = display(ram); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(ram) + if isempty(strfind(out, ram(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the display method works with a list of RATIONAL objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the display method works for a list of RATIONAL objects as + % input. + % + % + + try + % + ra1,ra2,ra3 + out = display(ra1,ra2,ra3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + pain = [ra1,ra2,ra3]; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(pain) + if isempty(strfind(out, pain(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the display method works with a mix of different shaped + % RATIONAL objects as input. + % + % + function result = utp_05 + + % + % + % Test that the display method works with an input of matrices and + % vectors and single RATIONAL objects as. + % + % + + try + % + out = display(ra1,rav,ra2,ram,ra3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + pain = [ra1,reshape(rav,1,[]),ra2,reshape(ram,1,[]),ra3]; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(pain) + if isempty(strfind(out, pain(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the display method properly applies history. + % + % + function result = utp_06 + + % + % + % The method display doesn't change the data, thus it is not possible + % to check the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_eq.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_eq.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,583 @@ +% UTP_RATIONAL_EQ a set of UTPs for the rational/eq method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_eq.m,v 1.7 2011/04/19 18:14:02 ingo Exp $ +% + +% +% +% The eq() method of the rational class ra1 == ra2 compares each element of +% a rational object with the corresponding element of an second rational +% object and returns a logical 1 (true) where ra1 and ra2 are equal, or +% logical 0 (false) where they are not equal. +% +% + +function results = utp_rational_eq(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'eq'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test RATIONAL objects + [ra1,ra2,ra3,rav,ram] = get_test_objects_rational; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test with the exception list 'name' + results = [results utp_08]; % Test with the exception list 'iunits' + results = [results utp_09]; % Test with the exception list 'ounits' + results = [results utp_10]; % Test exception list in a plist + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check number of SETS + if numel(io(2).sets) ~= 1, atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + % SET 'Default' + % Check key + if ~io(3).plists.isparam('Exceptions'), atest = false; end + if ~io(3).plists.isparam('Tol'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('Exceptions'), {}), atest = false; end + if ~isequal(io(3).plists.find('Tol'), eps(1)), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('Exceptions'), {{}}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('Tol'), {eps(1)}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the eq method works with a vector of RATIONAL objects as input. + % + % + function result = utp_02 + + % + % + % Test that the eq method works for a vector of RATIONAL objects as input. + % Test the positive and the negative case. + % + % + + try + % + pa = ra3.setName('my name'); + rav1 = [ra1, ra2, ra3]; + rav2 = [ra1, ra2, pa]; + out1 = eq(rav1, rav1); + out2 = eq(rav1, rav2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the eq function. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the eq method works with a matrix of RATIONAL objects as input. + % + % + function result = utp_03 + + % + % + % Test that the eq method works for a matrix of RATIONAL objects as input. + % Test the positive and the negative case. + % + % + + try + % + pa = ra3.setName('my name'); + ram1 = [ra1, ra2, ra3, ra1, ra2, ra3]; + ram2 = [ra3, ra2, pa; ra1, ra2, ra3]; + out1 = eq(ram1, ram1); + out2 = eq(ram1, ram2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the eq function. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the eq method works with a list of RATIONAL objects as input. + % + % + function result = utp_04 + + % + % + % The eq method doesn't works for a list of RATIONAL objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the eq method works with a mix of different shaped RATIONAL objects + % as input. + % + % + function result = utp_05 + + % + % + % The eq method doesn't works for a list of RATIONAL objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the eq method properly applies history. + % + % + function result = utp_06 + + % + % + % The eq method doesn't change the RATIONAL object, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception + % list with properties where a public set method exist. + % + % + function result = utp_07 + + % + % + % Test the eq method with the exception 'name'. Use the option + % 'internal' to suppress the history. It is necessary to add 'created' + % to the exception list because 'pa' is created at an other time. + % + % + + try + % + pa = testCallerIsMethod(@setName, ra3, 'my name'); + out1 = eq(pa, ra3); + out2 = eqLocal(pa, ra3, 'name'); + out3 = eqLocal(pa, ra3, 'rational/name'); + out4 = eq(pa.hist, ra3.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_08 + + % + % + % Test the eq method with the exception 'iunits'. Use the option 'internal' + % to suppress the history. It is necessary to add 'created' to the exception + % list because 'pa' is created at an other time. + % + % + + try + % + pa = testCallerIsMethod(@setIunits, ra3, unit('Hz')); + out1 = eq(pa, ra3); + out2 = eqLocal(pa, ra3, 'iunits'); + out3 = eqLocal(pa, ra3, 'rational/iunits'); + out4 = eq(pa.hist, ra3.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception + % list with properties where a public set method exist. + % + % + function result = utp_09 + + % + % + % Test the eq method with the exception 'ounits'. Use the option + % 'internal' to suppress the history. It is necessary to add 'created' + % to the exception list because 'pa' is created at an other time. + % + % + + try + % + pa = testCallerIsMethod(@setOunits, ra3, unit('V')); + out1 = eq(pa, ra3); + out2 = eqLocal(pa, ra3, 'ounits'); + out3 = eqLocal(pa, ra3, 'rational/ounits'); + out4 = eq(pa.hist, ra3.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Test the eq method with an exception list which is in a plist. + % + % + function result = utp_10 + + % + % + % Test that the eq method uses the exception list in a plist. + % + % + + try + % + pa = testCallerIsMethod(@setName, ra3, 'my name'); + pl = plist('Exceptions', {'name', 'UUID'}); + out1 = eq(pa, ra3); + out2 = eq(pa, ra3, pl); + out3 = eq(pa, ra3, pl); + out4 = eq(pa.hist, ra3.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + function res = eqLocal(obj1, obj2, ex) + e = ple1.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {ex}]); + + res = eq(obj1, obj2, ple); + end +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_get.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_get.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,284 @@ +% UTP_RATIONAL_GET a set of UTPs for the rational/get method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_get.m,v 1.3 2011/03/29 13:03:29 ingo Exp $ +% + +% +% +% The get method of the rational class returns the value of an object +% property. This is a very simple method which accepts only one rational as +% input thus are the most general units test not possible. +% +% + +function results = utp_rational_get(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'get'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Algorithm test + results = [results utp_03]; % Algorithm test with a plist + results = [results utp_04]; % Negative test with more than one rational + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('property'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('property')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('property'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests the get method of the rational class. + % + % + function result = utp_02 + + % + % + % Test that the get returns returns the value of the specified + % property. Do this for all properties of the RATIONAL object. + % + % + + try + % + ra = rational([1 2 3], [4 5 6 7], 'my rational', unit('V'), unit('Hz')); + out1 = get(ra, 'num'); + out2 = get(ra, 'den'); + out4 = get(ra, 'iunits'); + out5 = get(ra, 'ounits'); + out6 = get(ra, 'hist'); + out7 = get(ra, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the correct value of the output + % + % + + atest = true; + if stest + % + if ~isequal(out1, ra.num), atest = false; end + if ~isequal(out2, ra.den), atest = false; end + if ~eq(out4, ra.iunits), atest = false; end + if ~eq(out5, ra.ounits), atest = false; end + if ~eq(out6, ra.hist), atest = false; end + if ~isequal(out7, ra.name), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the get method works with a plist. + % + % + function result = utp_03 + + % + % + % Test that the get returns returns the value of the specified + % property which is defined in a plist. + % + % + + try + % + ra = rational([1 2 3], [4 5 6 7], 'my rational', unit('V'), unit('Hz')); + pl1 = plist('property', 'num'); + pl2 = plist('property', 'den'); + pl4 = plist('property', 'iunits'); + pl5 = plist('property', 'ounits'); + pl6 = plist('property', 'hist'); + pl7 = plist('property', 'name'); + out1 = get(ra, pl1); + out2 = get(ra, pl2); + out4 = get(ra, pl4); + out5 = get(ra, pl5); + out6 = get(ra, pl6); + out7 = get(ra, pl7); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the correct value of the output + % + % + + atest = true; + if stest + % + if ~isequal(out1, ra.num), atest = false; end + if ~isequal(out2, ra.den), atest = false; end + if ~eq(out4, ra.iunits), atest = false; end + if ~eq(out5, ra.ounits), atest = false; end + if ~eq(out6, ra.hist), atest = false; end + if ~isequal(out7, ra.name), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests the get method of the rational class. + % + % + function result = utp_04 + + % + % + % Test that the get throws an error if the input are more than + % one RATIONAL object. + % + % + + try + % + ra = rational([1 2 3], [4 5 6 7]); + out = get([ra, ra], 'name'); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_getlowerFreq.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_getlowerFreq.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,219 @@ +% UTP_RATIONAL_GETLOWERFREQ a set of UTPs for the rational/getlowerFreq method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_getlowerFreq.m,v 1.2 2009/07/27 19:28:59 ingo Exp $ +% + +% +% +% The getlowerFreq method of the rational class gets the frequency of the +% lowest pole in the model. This is a very simple method which accepts only +% one rational as input thus are the most general units test not possible. +% +% + +function results = utp_rational_getlowerFreq(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'getlowerFreq'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Algorithm test + results = [results utp_03]; % Negative test with more than one rational + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests the getlowerFreq method of the rational class. + % + % + function result = utp_02 + + % + % + % Test that the getlowerFreq returns the lowest frequence of the pole + % in the rational object. + % + % + + try + % + p1 = pz(3,2); % f = 3 + p2 = pz(40); % f = 40 + z3 = pz(2,3); % f = 2 + z4 = pz(100); % f = 100 + pzm = pzmodel(10, [p1 p2], [z3 z4]); + ra = rational(pzm); + out = getlowerFreq(ra); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + TOL = 1e-15; + if stest + % + if abs(out-2)>TOL, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests the getlowerFreq method of the rational class. + % + % + function result = utp_03 + + % + % + % Test that the getlowerFreq throws an error if the input are more than + % one rational. + % + % + + try + % + p1 = pz(3,2); % f = 3 + p2 = pz(40); % f = 40 + z3 = pz(2,3); % f = 2 + z4 = pz(100); % f = 100 + pzm = pzmodel(10, [p1 p2], [z3 z4]); + ra = rational(pzm); + out = getlowerFreq([ra, ra]); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_getupperFreq.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_getupperFreq.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,219 @@ +% UTP_RATIONAL_GETUPPERFREQ a set of UTPs for the rational/getupperFreq method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_getupperFreq.m,v 1.2 2009/07/27 19:28:59 ingo Exp $ +% + +% +% +% The getupperFreq method of the rational class gets the frequency of the +% lowest pole in the model. This is a very simple method which accepts only +% one rational as input thus are the most general units test not possible. +% +% + +function results = utp_rational_getupperFreq(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'getupperFreq'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Algorithm test + results = [results utp_03]; % Negative test with more than one rational + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests the getupperFreq method of the rational class. + % + % + function result = utp_02 + + % + % + % Test that the getupperFreq returns the lowest frequence in the + % rational object. + % + % + + try + % + p1 = pz(3,2); % f = 3 + p2 = pz(40); % f = 40 + z3 = pz(2,3); % f = 2 + z4 = pz(100); % f = 100 + pzm = pzmodel(10, [p1 p2], [z3 z4]); + ra = rational(pzm); + out = getupperFreq(ra); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + TOL = 1e-13; + if stest + % + if abs(out-100)>TOL, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests the getupperFreq method of the rational class. + % + % + function result = utp_03 + + % + % + % Test that the getupperFreq throws an error if the input are more than + % one rational. + % + % + + try + % + p1 = pz(3,2); % f = 3 + p2 = pz(40); % f = 40 + z3 = pz(2,3); % f = 2 + z4 = pz(100); % f = 100 + pzm = pzmodel(10, [p1 p2], [z3 z4]); + ra = rational(pzm); + out = getupperFreq([ra, ra]); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_index.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_index.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,525 @@ +% UTP_RATIONAL_INDEX a set of UTPs for the rational/index method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_index.m,v 1.4 2009/07/28 17:12:38 ingo Exp $ +% + +% +% +% The index method of the rational class index into a RATIONAL vector or +% matrix. This properly captures the history. +% +% + +function results = utp_rational_index(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'index'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test RATIONAL objects + [ra1,ra2,ra3,rav,ram] = get_test_objects_rational; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test history is working + results = [results utp_06]; % Test the modify call works + results = [results utp_07]; % Test with plist + results = [results utp_08]; % Test select more objects with an index + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('i'), atest = false; end + if ~io(3).plists.isparam('j'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('i')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('j')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('i'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('j'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the index method works with a vector of RATIONAL objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the index method works for a vector of RATIONAL objects as + % input. The following indexing should work: + % I = [ 1 2 3 ] or (I/J) = [(1,1), (1,2), (1,3)] + % + % + + try + % + objvec = [ra1, ra2, ra3]; + out1 = objvec.index(1); + out2 = objvec.index(3); + out3 = objvec.index(1,2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the index method selects the correct object. + % + % + + atest = true; + if stest + % + if ~eq(out1, ra1, ple3), atest = false; end + if ~eq(out2, ra3, ple3), atest = false; end + if ~eq(out3, ra2, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the index method works with a matrix of RATIONAL objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the index method works for a matrix of RATIONAL objects as + % input. The following indexing should work: + % I = [ 1 3 5 ] or (I/J) = [(1,1), (1,2), (1,3)] + % [ 2 4 6 ] [(2,1), (2,2), (2,3)] + % + + try + % + objmat = [ra1, ra2, ra3; ... + ra3, ra1, ra2]; + out1 = objmat.index(5); + out2 = objmat.index(4); + out3 = objmat.index(1,2); + out4 = objmat.index(2,1); + out5 = objmat.index(2,2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the index method selects the correct object. + % + % + + atest = true; + if stest + % + if ~eq(out1, ra3, ple3), atest = false; end + if ~eq(out2, ra1, ple3), atest = false; end + if ~eq(out3, ra2, ple3), atest = false; end + if ~eq(out4, ra3, ple3), atest = false; end + if ~eq(out5, ra1, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the index method works with a list of RATIONAL objects as + % input. + % + % + function result = utp_04 + + % + % + % The index method doesn't work for a list of RATIONAL objects as input. + % + % + + try + % + out = index(ra1,ra2,ra3, 4); + % + stest = false; + catch + stest = true; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the index method properly applies history. + % + % + function result = utp_05 + + % + % + % Test that the result of index have an additional history step. + % + % + + try + % + i = 2; + j = 3; + objmat = [ra1, ra2, ra3; ... + ra3, ra1, ra2]; + out = index(objmat, i, j); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds + % to 'index'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'index'), atest = false; end + % Check that the history-plist contains the used indices. + pl = out.hist.plistUsed; + if pl.find('i') ~= i, atest = false; end + if pl.find('j') ~= j, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the index method works for the modifier command. + % + % + function result = utp_06 + + % + % + % Tests that the index method works for the modifier command. + % + % + + try + % + i = 1; + j = 1; + objmat = [ra1, ra2, ra3; ... + ra3, ra1, ra2]; + out1 = index(objmat, i, j); + out2 = objmat.index(i,j); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history-plist contains the used indices. + % 2) Check that the index method selects the correct object + % + % + + atest = true; + if stest + % + % Check that the history-plist contains the used indices. + pl = out1.hist.plistUsed; + if pl.find('i') ~= i, atest = false; end + if pl.find('j') ~= j, atest = false; end + % Check that the index method selects the correct object + if ~eq(out1, ra1, ple3), atest = false; end + % Check that the history-plist contains the used indices. + pl = out2.hist.plistUsed; + if pl.find('i') ~= i, atest = false; end + if pl.find('j') ~= j, atest = false; end + % Check that the index method selects the correct object + if ~eq(out2, ra1, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Control the method with a plist. + % + % + function result = utp_07 + + % + % + % Test that the index method can be controled with a plist. + % + % + + try + % + i1 = 6; + i2 = 1; + j2 = 3; + objmat = [ra1, ra2, ra3; ... + ra3, ra1, ra2]; + pl1 = plist('i', i1); + pl2 = plist('i', i2, 'j', j2); + out1 = index(objmat, pl1); + out2 = index(objmat, pl2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history-plist contains the used indices. + % 2) Check that the index method selects the correct object + % + % + + atest = true; + if stest + % + % Check that the history-plist contains the used indices. + pl = out1.hist.plistUsed; + if ~isequal(pl.find('i'), i1), atest = false; end + if ~isequal(pl.find('j'), []), atest = false; end + % Check that the index method selects the correct object + if ~eq(out1, ra2, ple3), atest = false; end + % Check that the history-plist contains the used indices. + pl = out2.hist.plistUsed; + if ~isequal(pl.find('i'), i2), atest = false; end + if ~isequal(pl.find('j'), j2), atest = false; end + % Check that the index method selects the correct object + if ~eq(out2, ra3, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test that the index method selects more objects if I have more indices. + % + % + function result = utp_08 + + % + % + % Test that the index method selects more objects if I have more indices. + % + % + + try + % + i = [2 6]; + objmat = [ra1, ra2, ra3; ... + ra3, ra1, ra2]; + pl = plist('i', i); + out1 = objmat.index(i); + out2 = objmat.index(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history-plist contains the used indices. + % 2) Check that the index method selects the correct object + % + % + + atest = true; + if stest + % + % Check that the history-plist contains the used indices. + pl = out1(1).hist.plistUsed; + if ~isequal(pl.find('i'), i), atest = false; end + if ~isequal(pl.find('j'), []), atest = false; end + % Check that the index method selects the correct object + if ~eq(out1(1), ra3, ple3), atest = false; end + if ~eq(out1(2), ra2, ple3), atest = false; end + % Check that the history-plist contains the used indices. + pl = out2(2).hist.plistUsed; + if ~isequal(pl.find('i'), i), atest = false; end + if ~isequal(pl.find('j'), []), atest = false; end + % Check that the index method selects the correct object + if ~eq(out2(1), ra3, ple3), atest = false; end + if ~eq(out2(2), ra2, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_isprop.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_isprop.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,481 @@ +% UTP_RATIONAL_ISPROP a set of UTPs for the rational/isprop method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_isprop.m,v 1.3 2011/03/29 13:13:33 ingo Exp $ +% + +% +% +% The isprop method of the rational class determine whether input is object +% property. +% +% + +function results = utp_rational_isprop(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'isprop'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test RATIONAL objects + [ra1,ra2,ra3,rav,ram] = get_test_objects_rational; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test negative case + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the isprop method works with a vector of RATIONAL objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the isprop method works for a vector of RATIONAL objects as + % input. + % + % + + try + % + out = isprop(rav, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'rav' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(rav)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the isprop method works with a matrix of RATIONAL objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the isprop method works for a matrix of RATIONAL objects as + % input. + % + % + + try + % + out = isprop(ram, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'ram' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(ram)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the isprop method works with a list of RATIONAL objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the isprop method works for a list of RATIONAL objects as + % input. + % + % + + try + % + out = isprop(ra1,ra2,ra3, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the isprop method works with a mix of different shaped + % RATIONAL objects as input. + % + % + function result = utp_05 + + % + % + % Test that the isprop method works with an input of matrices and + % vectors and single RATIONAL objects. + % + % + + try + % + out = isprop(ra1,rav,ra2,ram,ra3, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(ram)+numel(rav)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the isprop method properly applies history. + % + % + function result = utp_06 + + % + % + % The method isprop doesn't change the object, thus it is not necessary + % to apply history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the isprop method works for each property. + % + % + function result = utp_07 + + % + % + % Test that the isprop method works for the properties: + % 'num', 'den', 'iunits', 'ounits', 'hist', 'name' + % + % + + try + % + % copy ra1 to work with + out1 = isprop(ra1, 'num'); + out2 = isprop(ra1, 'den'); + out4 = isprop(ra1, 'iunits'); + out5 = isprop(ra1, 'ounits'); + out6 = isprop(ra1, 'hist'); + out7 = isprop(ra1, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if ~out1, atest = false; end; + if ~out2, atest = false; end; + if ~out4, atest = false; end; + if ~out5, atest = false; end; + if ~out6, atest = false; end; + if ~out7, atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the negative case and the not function command. + % + % + function result = utp_08 + + % + % + % Test that the isprop method retrun false for a unknown property and + % for methods of the object. + % + % + + try + % + out1 = isprop(ra2, 'foo'); + out2 = ra2.isprop('foo'); + out3 = ra2.isprop('name'); + out4 = ra2.isprop('type'); + out5 = ra2.isprop('char'); + out6 = ra2.isprop('creator'); + out7 = ra2.isprop('created'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if out1, atest = false; end; + if out2, atest = false; end; + if ~out3, atest = false; end; + if out4, atest = false; end; + if out5, atest = false; end; + if out6, atest = false; end; + if out7, atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_loadobj.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_loadobj.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,151 @@ +% UTP_RATIONAL_LOADOBJ a set of UTPs for the rational/loadobj method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_loadobj.m,v 1.1 2009/02/08 16:37:26 ingo Exp $ +% + +% +% +% The loadobj method of the rational class will be automatically called by +% MATLAB if an older object is not compatible with the current object structure. +% This happens only for objects which are stored as a MATLAB formatted +% (MAT-file). The load mechanism for XML formated files calls always the +% 'update_struct' method to keep the stored objects up to date. The +% 'update_struct' method convert the read object structure to the object +% structure which is used in the currend LTPDA version. +% This UTP will load old objects which are stored with an older LTPDA version. +% +% REMARK: Since LTPDA version 1.9.2 will be an object which should be saved as a +% MAT file stored as a struct and not as the object. +% +% + +function results = utp_rational_loadobj(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'loadobj'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Run the tests + results = [results utp_01]; % getInfo call + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Get all .MAT and .XML files + path = fullfile(fileparts(which(mfilename)), '..', '..', 'utp_test_files'); + + matfiles = utils.prog.filescan(path, '.mat'); + xmlfiles = utils.prog.filescan(path, '.xml'); + + % Load .MAT files + obj_no = 1; + for ii=1:numel(matfiles) + fn = matfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = rational(fn); + obj_no = obj_no+1; + end + end + + % Load .XML files + for ii=1:numel(xmlfiles) + fn = xmlfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = rational(fn); + obj_no = obj_no+1; + end + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the shape of the loaded objects. + % + % + + atest = true; + if stest + % + for ii = 1:numel(objs) + obj = objs(ii).obj; + fname = objs(ii).fname; + + if ~isempty(strfind(fname, '_vec')) + % Loaded object must be a vector + if ~isvector(obj), atest = false; end + elseif ~isempty(strfind(fname, '_mat')) + % Loaded object must be a matrix + % REMARK: Known error in LTPDA version 1.9.2 + % A saved matrix doesn't keep the shape of the matrix. + if isempty(strfind(fname, '_192')) + if ~(size(obj,1) > 1 && size(obj,2) > 1), atest = false; end + end + else + % Loaded object must be a single object + if ~(size(obj,1) == 1 && size(obj,2) == 1), + atest = false; end + end + + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_ne.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_ne.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,456 @@ +% UTP_RATIONAL_NE a set of UTPs for the rational/ne method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_ne.m,v 1.5 2011/04/19 18:14:02 ingo Exp $ +% + +% +% +% The ne() method of the rational class ra1 ~= ra2 compares each element of +% an rational object with the corresponding element of an second rational +% object and returns a logical 1 (true) where ra1 and ra2 are not equal, or +% logical 0 (false) where they are equal. +% +% + +function results = utp_rational_ne(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'ne'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test RATIONAL objects + [ra1,ra2,ra3,rav,ram] = get_test_objects_rational; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test with the exception list 'name' + results = [results utp_08]; % Test exception list in a plist + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the ne method works with a vector of RATIONAL objects as input. + % + % + function result = utp_02 + + % + % + % Test that the ne method works for a vector of RATIONAL objects as input. + % Test the positive and the negative case. + % + % + + try + % + ra = ra3.setName('my name'); + rav1 = [ra1, ra2, ra3]; + rav2 = [ra1, ra2, ra]; + out1 = ne(rav1, rav1); + out2 = ne(rav1, rav2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the ne function. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the ne method works with a matrix of RATIONAL objects as input. + % + % + function result = utp_03 + + % + % + % Test that the ne method works for a matrix of RATIONAL objects as input. + % Test the positive and the negative case. + % + % + + try + % + ra = ra3.setName('my name'); + ram1 = [ra1, ra2, ra3; ra1, ra2, ra3]; + ram2 = [ra1, ra2, ra3; ra1, ra2, ra]; + out1 = ne(ram1, ram1); + out2 = ne(ram1, ram2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the ne function. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the ne method works with a list of RATIONAL objects as input. + % + % + function result = utp_04 + + % + % + % The ne method doesn't works for a list of RATIONAL objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the ne method works with a mix of different shaped RATIONAL + % objects as input. + % + % + function result = utp_05 + + % + % + % The ne method doesn't works for a list of RATIONAL objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the ne method properly applies history. + % + % + function result = utp_06 + + % + % + % The ne method doesn't change the RATIONAL object, thus will no history + % added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the ne method with an exception list. + % The function rational/ne use the function rational/eq so it is not + % necessary to check all possibilities of the exception list. + % + % + function result = utp_07 + + % + % + % Test the ne method with the exception 'name'. Use the option + % 'internal' to suppress the history. It is necessary to add 'created' + % to the exception list because ra is created at an other time. + % + % + + try + % + ra = testCallerIsMethod(@setName, ra3, 'my name'); + out1 = ne(ra, ra3); + out2 = ne(ra, ra3, 'name', 'created', 'UUID'); + out3 = ne(ra, ra3, 'rational/name', 'created', 'UUID'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + if out3 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the ne method with an exception list which is in a plist. + % + % + function result = utp_08 + + % + % + % Test that the ne method uses the exception list in a plist. + % + % + + try + % + ra = testCallerIsMethod(@setName, ra3, 'my name'); + pl = plist('Exceptions', {'name', 'created', 'UUID'}); + out1 = ne(ra, ra3); + out2 = ne(ra, ra3, pl); + out3 = ne(ra, ra3, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + if out3 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_rational.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_rational.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,1551 @@ +% UTP_RATIONAL_RATIONAL a set of UTPs for the rational/rational method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_rational.m,v 1.18 2011/08/22 05:37:13 hewitson Exp $ +% + +% +% +% The rational method of the rational class constructs RATIONAL objects. +% +% + +function results = utp_rational_rational(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'rational'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test objects + [ra1,ra2,ra3,rav,ram] = get_test_objects_rational; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working with empty constructor + results = [results utp_07]; % Test history is working with copy constructor + results = [results utp_08]; % Test history is working with MAT file constructor + results = [results utp_09]; % Test history is working with XML file constructor + results = [results utp_10]; % Test history is working with struct constructor + results = [results utp_11]; % Test history is working with parfrac-object constructor + results = [results utp_12]; % Test history is working with pzmodel-object constructor + results = [results utp_13]; % Test history is working with plist(filename) constructor + results = [results utp_14]; % Test history is working with plist(hostname) constructor + results = [results utp_15]; % Test history is working with plist(den || num) constructor + results = [results utp_16]; % Test history is working with plist(pzmodel) constructor + results = [results utp_17]; % Test history is working with plist(rational) constructor + results = [results utp_18]; % Test history is working with plist(plist) constructor + results = [results utp_19]; % Test history is working with conn+Id constructor + results = [results utp_20]; % Test history is working with num + den constructor + results = [results utp_21]; % Test history is working with num + den + name constructor + results = [results utp_22]; % Test history is working with res + poles + dir + name + iunits + ounits constructor + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Pzmodel')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Coefficients')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Repository')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From XML File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From MAT File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Parfrac')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Built-in Model')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 3, atest = false; end + % Check key + % Check default value + % Check options + %%%%%%%%%% SET 'From MAT File' + pn = 4; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + %%%%%%%%%% SET 'From XML File' + pn = 5; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + %%%%%%%%%% SET 'From Repository' + pn = 6; + if io(pn).plists.nparams ~= 10, atest = false; end + % Check key + if ~io(pn).plists.isparam('hostname'), atest = false; end + if ~io(pn).plists.isparam('id'), atest = false; end + if ~io(pn).plists.isparam('cid'), atest = false; end + if ~io(pn).plists.isparam('database'), atest = false; end + if ~io(pn).plists.isparam('binary'), atest = false; end + if ~io(pn).plists.isparam('username'), atest = false; end + if ~io(pn).plists.isparam('password'), atest = false; end + % Check default value + if ~isEmptyDouble(io(pn).plists.find('id')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('cid')), atest = false; end + if ~isequal(io(pn).plists.find('binary'), 'yes'), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('id'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('cid'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('binary'), {'yes', 'no'}), atest = false; end + %%%%%%%%%% SET 'From Built-in Model' + pn = 7; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('built-in'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('built-in')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('built-in'), {''}), atest = false; end + %%%%%%%%%% SET 'From Pzmodel' + pn = 8; + if io(pn).plists.nparams ~= 6, atest = false; end + % Check key + if ~io(pn).plists.isparam('pzmodel'), atest = false; end + % Check default value + if ~eq(io(pn).plists.find('pzmodel'), pzmodel(), ple1), atest = false; end + % Check options + %%%%%%%%%% SET 'From Coefficients' + pn = 9; + if io(pn).plists.nparams ~= 7, atest = false; end + % Check key + if ~io(pn).plists.isparam('num'), atest = false; end + if ~io(pn).plists.isparam('den'), atest = false; end + if ~io(pn).plists.isparam('name'), atest = false; end + % Check default value + if ~isEmptyDouble(io(pn).plists.find('num')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('den')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('num'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('den'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('name'), {''}), atest = false; end + %%%%%%%%%% SET 'From Parfrac' + pn = 10; + if io(pn).plists.nparams ~= 6, atest = false; end + % Check key + if ~io(pn).plists.isparam('parfrac'), atest = false; end + % Check default value + if ~eq(io(pn).plists.find('parfrac'), parfrac(), ple1), atest = false; end + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the rational method works with a vector of RATIONAL objects + % as input. + % + % + function result = utp_02 + + % + % + % Test that the rational method works with a vector of RATIONAL objects + % as input. + % + % + + try + % + out = rational(rav); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output RATIONALs is the same as the + % input shape. + % 2) Check that each output RATIONAL is a copy of the input RATIONAL. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + if stest + % + % Check we have the correct shape + if size(out) ~= size(rav), atest = false; end + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(rav(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(rav(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(rav(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the rational method works with a matrix of RATIONAL objects + % as input. + % + % + function result = utp_03 + + % + % + % Test that the rational method works with a matrix of RATIONAL objects + % as input. + % + % + + try + % + out = rational(ram); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output RATIONALs is the same as the + % input shape. + % 2) Check that each output RATIONAL is a copy of the input RATIONAL. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if size(out) ~= size(ram), atest = false; end + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(ram(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(ram(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(ram(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the rational method works with a list of RATIONAL objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the rational method works with a list of RATIONAL objects as + % input. + % + % + + try + % + out = rational(ra1,ra2,ra3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same of the + % number in the input. + % 2) Check that each output RATIONAL is a copy of the input RATIONAL. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + pfin = [ra1,ra2,ra3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(pfin(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(pfin(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(pfin(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the rational method works with a mix of different shaped + % RATIONALs as input. + % + % + function result = utp_05 + + % + % + % Test that the rational method works with a mix of different shaped + % RATIONALs as input. + % + % + + try + % + out = rational(ra1,rav,ra2,ram,ra3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same of the + % number in the input. + % 2) Check that each output RATIONAL is a copy of the input RATIONAL. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + pfin = [ra1, reshape(rav, 1, []), ra2, reshape(ram, 1, []), ra3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3+numel(rav)+numel(ram), atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(pfin(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(pfin(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(pfin(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the rational method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the rational method can be processed + % back. + % + % + + try + % + out = rational(ra3); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'rational'. + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'rational'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the rational method properly applies history to the copy + % constructor. + % + % + function result = utp_07 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % Test the constructor with a different number of inputs. + % + % + + try + % + out1 = rational(ra1); + out2 = rational(ra1, ra2); + out3 = rational(ra1, ra2, ra3); + out1.setName('my name'); + out2(1).setName('my name'); + out2(2).setName('my name'); + out3(1).setName('my name'); + out3(2).setName('my name'); + out3(3).setName('my name'); + mout = rebuild(out1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'rational'. + % 2) Check that the original objects are not changed by the setter + % function + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + % It is the method 'setName' because we set it in above + if ~strcmp(out1.hist.methodInfo.mname, 'setName'), atest = false; end + % Check next to the last step in the history of 'out' + if ~strcmp(out1.hist.inhists.methodInfo.mname, 'rational'), atest = false; end + % Check the originals + if strcmp(ra1, 'my name'), atest = false; end + if strcmp(ra2, 'my name'), atest = false; end + if strcmp(ra3, 'my name'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out1, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the rational method properly applies history to the read + % MAT-file constructor. + % + % + function result = utp_08 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + filename = 'ra.mat'; + ra = rational(ra3); + save(ra, filename); + + out = rational(filename); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + if ~eq(out, ra, ple1), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), atest = false; end + % + delete(filename); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + + %% UTP_09 + + % + % + % Tests that the rational method properly applies history to the read + % XML-file constructor. + % + % + function result = utp_09 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + filename = 'ram.xml'; + amat = rational(ram); + save(amat, filename); + + out = rational(filename); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the algorithm + for kk = 1:numel(out) + if ~eq(out(kk), amat(kk), ple1), atest = false; end + end + % Check the rebuilt object + for kk = 1:numel(out) + if ~eq(mout(kk), out(kk), ple2), atest = false; end + end + % + delete(filename); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Tests that the rational method properly doesn't apply history to the + % struct constructor. + % + % + function result = utp_10 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + sra3 = struct(ra3); + sra3.iunits = struct(ra3.iunits); + sra3.ounits = struct(ra3.ounits); + sra3.hist = struct(ra3.hist); + + out1 = rational(struct(ra2)); + out2 = rational(sra3); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' + % corresponds to 'rational'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check that the output is a RATIONAL object + if ~isa(out1,'rational'), atest = false; end + if ~isa(out2,'rational'), atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'setName'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'setName'), atest = false; end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_11 + + % + % + % Tests that the rational method properly applies history to the parfrac + % constructor. + % + % + function result = utp_11 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + pf = parfrac([1 2+1i 2-1i], [6 1+3i 1-3i], [1 2 3 4], 'my parfrac', unit('V'), unit('Hz')); + out = rational(pf); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'rational'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check that the output is a RATIONAL object + if ~isa(out,'rational'), atest = false; end + % Check the values of the rationalt object + [a,b] = residue(pf.res,pf.poles,pf.dir); + if ~isequal(out.num, a), atest = false; end + if ~isequal(out.den, b), atest = false; end + if ~isequal(out.name, sprintf('rational(%s)', 'my parfrac')), atest = false; end + if ~eq(out.iunits, unit('V')), atest = false; end + if ~eq(out.ounits, unit('Hz')), atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'rational'), atest = false; end + if ~strcmp(out.hist.inhists.methodInfo.mname, 'parfrac'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_11 + + %% UTP_12 + + % + % + % Tests that the rational method properly applies history to the pzmodel + % constructor. + % + % + function result = utp_12 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + ps = [pz(1) pz(200) pz(2,4)]; + zs = [pz(50) pz(2,3)]; + pzm = pzmodel(1, ps, zs, unit('Hz^2'), unit('V^2')); + out = rational(pzm); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'rational'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check that the output is a RATIONAL object + if ~isa(out,'rational'), atest = false; end + % Check the values of the different proerpties + pg = 2*pi*ps(1).f * 2*pi*ps(2).f * 4*pi*pi*ps(3).f*ps(3).f; + zg = 2*pi*zs(1).f * 4*pi*pi*zs(2).f*zs(2).f; + den = poly(vertcat(pzm.poles(:).ri))./pg; + num = pzm.gain.*poly(vertcat(pzm.zeros(:).ri))./zg; + + if ~isequal(out.den, den), atest = false; end + if ~isequal(out.num, num), atest = false; end + if ~eq(out.iunits, pzm.iunits), atest = false; end + if ~eq(out.ounits, pzm.ounits), atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'rational'), atest = false; end + if ~strcmp(out.hist.inhists.methodInfo.mname, 'pzmodel'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Tests that the rational method properly applies history to the + % plist(filename) constructor. + % + % + function result = utp_13 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + try + % + filename1 = 'ra.xml'; + filename2 = 'ra.mat'; + + f1 = rational(ra3); + f2 = rational(ra2); + + save(f1, filename1); + save(f2, filename2); + + out1 = rational(plist('filename', filename1)); + out2 = rational(plist('filename', filename2)); + + rout1 = out1.rebuild; + rout2 = out2.rebuild; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the save method doesn't change the input object + % 2) Check that the last two entries in the history of 'out' + % doesn't corresponds to 'rational' and 'save' + % 3) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % The load object is the same object as the stored object. + if ~eq(out1, f1, ple1), atest = false; end + if ~eq(out2, f2, ple1), atest = false; end + % Rebuild object and check the result + if ~eq(rout1, out1, ple2), atest = false; end + if ~eq(rout2, out2, ple2), atest = false; end + % + % delete test file + delete(filename1) + delete(filename2) + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + %% UTP_14 + + % + % + % Tests that the RATIONAL method properly applies history to the + % plist(conn) constructor. + % + % + function result = utp_14 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + conn = utpGetConnection + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_rational_rational_14: submit rational vector'; + sinfo.experiment_description = 'utp_rational_rational_14: &description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + plForAutoTest = plist('no dialog', true, 'use selector', false); + ids = submit(rav, sinfo, plForAutoTest); + + out = rational(plist('hostname', utpGetHostname, 'database', utpGetDatabase, 'conn', conn, 'id', ids)); + % + % Close connection + utpCloseConnection(conn); + stest = true; + catch err + disp(err.message) + % Close connection + utpCloseConnection(conn); + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'rational'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + for kk = 1:numel(out) + if ~strcmp(out(kk).hist.methodInfo.mname, 'rational'), atest = false; end + end + % Check data values + if ~eq(out, rav, ple3), atest = false; end + % Rebuild object and check the result + mout = rebuild(out); + if ~eq(mout, out, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_14 + + %% UTP_15 + + % + % + % Tests that the RATIONAL method properly applies history to the + % plist(den || num) constructor. + % + % + function result = utp_15 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + den = [1 2 3]; + num = [4 5 6 7]; + name = 'my rational'; + iunits = unit('V'); + ounits = unit('Hz'); + pl = plist('den', den, 'num', num, 'name', name, 'iunits', iunits, 'ounits', ounits); + out = rational(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'rational'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'rational'), atest = false; end + % Check the properties + if ~isequal(out.den, den), atest = false; end + if ~isequal(out.num, num), atest = false; end + if ~isequal(out.name, name), atest = false; end + if ~eq(out.iunits, iunits), atest = false; end + if ~eq(out.ounits, ounits), atest = false; end + % Rebuild object and check the result + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_15 + + %% UTP_16 + + % + % + % Tests that the RATIONAL method properly applies history to the + % plist(pzmodel) constructor. + % + % + function result = utp_16 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + ps = [pz(1) pz(200)]; + zs = pz(50); + pzm = pzmodel(1, ps, zs, unit('Hz'), unit('V')); + pl = plist('pzmodel', pzm); + out = rational(pl); + + rout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'rational'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'rational'), atest = false; end + % Check the next to the last step in the history. + % It must be the history of the pole/zero model (here 'pzmodel') + if ~strcmp(out.hist.inhists.methodInfo.mname, 'pzmodel'), atest = false; end + % Check values + pg = 2*pi*ps(1).f * 2*pi*ps(2).f; + zg = 2*pi*zs(1).f; + den = poly(vertcat(pzm.poles(:).ri))./pg; + num = pzm.gain.*poly(vertcat(pzm.zeros(:).ri))./zg; + + if ~isequal(out.den, den), atest = false; end + if ~isequal(out.num, num), atest = false; end + if ~eq(out.iunits, unit('Hz')), atest = false; end + if ~eq(out.ounits, unit('V')), atest = false; end + % Rebuild object and check the result + if ~eq(rout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_16 + + %% UTP_17 + + % + % + % Tests that the RATIONAL method properly applies history to the + % plist(rational) constructor. + % + % + function result = utp_17 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + pf = parfrac([1 2+1i 2-1i], [6 1+3i 1-3i], [1 2 3 4], 'my parfrac', unit('V'), unit('Hz')); + pl = plist('parfrac', pf); + out = rational(pl); + + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'rational'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'rational'), atest = false; end + % Check the next to the last step in the history. + % It must be the history of the partial fraction model (here 'rational') + if ~strcmp(out.hist.inhists.methodInfo.mname, 'parfrac'), atest = false; end + % Check values + [a,b] = residue(pf.res,pf.poles,pf.dir); + if ~isequal(out.num, a), atest = false; end + if ~isequal(out.den, b), atest = false; end + if ~isequal(out.name, 'rational(my parfrac)'), atest = false; end + if ~eq(out.iunits, unit('V')), atest = false; end + if ~eq(out.ounits, unit('Hz')), atest = false; end + % Rebuild object and check the result + if ~eq(mout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_17 + + %% UTP_18 + + % + % + % Tests that the RATIONAL method properly applies history to the + % plist() constructor. + % + % + function result = utp_18 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + pf = parfrac([1 2+1i 2-1i], [6 1+3i 1-3i], [1 2 3 4], 'my parfrac', unit('V'), unit('Hz')); + pl = plist('parfrac', pf); + out1 = rational(plist('plist', pl)); + out2 = rational(plist('plist', plist())); % empty plist + + rout1 = rebuild(out1); + rout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'rational'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~strcmp(out1.hist.methodInfo.mname, 'rational'), atest = false; end + % Check the next to the last step in the history. + % It must be the history of the partial fraction model (here 'rational') + if ~strcmp(out1.hist.inhists.methodInfo.mname, 'parfrac'), atest = false; end + % Check values + if ~eq(out1.iunits, unit('V')), atest = false; end + if ~eq(out1.ounits, unit('Hz')), atest = false; end + % Check the last step in the history of 'out2' + if ~strcmp(out2.hist.methodInfo.mname, 'rational'), atest = false; end + % Check the next to the last step in the history. + if ~isempty(out2.hist.inhists), atest = false; end + % Rebuild object and check the result + if ~eq(rout1, out1, ple1), atest = false; end + if ~eq(rout2, out2, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_18 + + %% UTP_19 + + % + % + % Tests that the RATIONAL method properly applies history to the conn+Id + % constructor. + % + % + function result = utp_19 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + conn = utpGetConnection + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_rational_rational_19: submit rational'; + sinfo.experiment_description = 'utp_rational_rational_19: description'; + sinfo.analysis_description = 'utp_rational_rational_19'; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + plForAutoTest = plist('no dialog', true, 'use selector', false); + [ids] = submit(ra3, sinfo, plForAutoTest); + + out = rational(conn, ids); + % + % Close connection + utpCloseConnection(conn); + stest = true; + catch err + disp(err.message) + % Close connection + utpCloseConnection(conn); + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'rational'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'rational'), atest = false; end + % Check data values + if ~eq(out,ra3, ple3), atest = false; end + % Check the history except the additional 'submit' + 'retrieve' steps + if ~eq(out.hist.inhists, ra3.hist), atest = false; end + % Check the rebuilt object + mout = rebuild(out); + if ~eq(mout, out, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_19 + + %% UTP_20 + + % + % + % Tests that the RATIONAL method properly applies history to the + % num + den object constructor. + % + % + function result = utp_20 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + num = [2 -4 7 -2.5]; + den = [1 9 -12]; + out = rational(num ,den); + + rout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'rational'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'rational'), atest = false; end + % Check properties + if ~isequal(out.num, num), atest = false; end + if ~isequal(out.den, den), atest = false; end + % Rebuild object and check the result + if ~eq(rout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_20 + + %% UTP_21 + + % + % + % Tests that the RATIONAL method properly applies history to the + % num + den + name object constructor. + % + % + function result = utp_21 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + num = [2 -4 7 -2.5]; + den = [1 9 -12]; + name = 'my new crazy name'; + out = rational(num, den, name); + + rout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'rational'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'rational'), atest = false; end + % Check properties + if ~isequal(out.num, num), atest = false; end + if ~isequal(out.den, den), atest = false; end + if ~isequal(out.name, name), atest = false; end + % Rebuild object and check the result + if ~eq(rout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_21 + + %% UTP_22 + + % + % + % Tests that the RATIONAL method properly applies history to the + % num + den + name + iunits + ounits object constructor. + % + % + function result = utp_22 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + num = [2 -4 7 -2.5]; + den = [1 9 -12]; + name = 'I''m crazy'; + iu = unit('V^2'); + ou = 's^2/3'; + out = rational(num, den, name, iu, ou); + + rout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'rational'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'rational'), atest = false; end + % Check properties + if ~isequal(out.num, num), atest = false; end + if ~isequal(out.den, den), atest = false; end + if ~isequal(out.name, name), atest = false; end + if ~eq(out.iunits, iu), atest = false; end + if ~eq(out.ounits, unit(ou), ple1), atest = false; end + % Rebuild object and check the result + if ~eq(rout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_22 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_rebuild.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_rebuild.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,421 @@ +% UTP_RATIONAL_REBUILD a set of UTPs for the rational/rebuild method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_rebuild.m,v 1.2 2009/07/27 19:28:59 ingo Exp $ +% + +% +% +% The rebuild method of the rational class rebuilds the input objects using +% the history. This method is also intensively tested in the most other +% UTPs. +% +% + +function results = utp_rational_rebuild(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'rebuild'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test RATIONAL objects + [ra1,ra2,ra3,rav,ram] = get_test_objects_rational; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the output + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the rebuild method works with a vector of RATIONAL objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the rebuild method works for a vector of RATIONAL objects as + % input. + % + % + + try + % + out = rebuild(rav); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + % Check the output + if ~isa(out, 'rational'), atest = false; end; + for kk = 1:numel(rav) + if eq(out(kk), rav(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the rebuild method works with a matrix of RATIONAL objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the rebuild method works for a matrix of RATIONAL objects as + % input. + % + % + + try + % + out = rebuild(ram); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + if ~isa(out, 'rational'), atest = false; end; + for kk = 1:numel(ram) + if eq(out(kk), ram(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the rebuild method works with a list of RATIONAL objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the rebuild method works for a list of RATIONAL objects as + % input. + % + % + + try + % + out = rebuild(ra1,ra2,ra3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + rain = [ra1,ra2,ra3]; + if stest + % + if ~isa(out, 'rational'), atest = false; end; + for kk = 1:numel(rain) + if eq(out(kk), rain(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the rebuild method works with a mix of different shaped + % RATIONAL objects as input. + % + % + function result = utp_05 + + % + % + % Test that the rebuild method works with an input of matrices and + % vectors and single RATIONAL objects. + % + % + + try + % + out = rebuild(ra2,rav,ra1,ram,ra3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + rain = [ra2,reshape(rav,1,[]),ra1,reshape(ram,1,[]),ra3]; + if stest + % + if ~isa(out, 'rational'), atest = false; end; + for kk = 1:numel(rain) + if eq(out(kk), rain(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the rebuild method properly applies history. + % + % + function result = utp_06 + + % + % + % The method rebuild doesn't change the data, thus it is not possible + % to check the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the rebuild method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [o1, o2] = rebuild(ra3, ra1); + o3 = rebuild(ra3, ra1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, ra3, ple2), atest = false; end + if ~eq(o2, ra1, ple2), atest = false; end + if ~eq(o3, [ra3 ra1], ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_resp.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_resp.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,1042 @@ +% UTP_RATIONAL_RESP a set of UTPs for the rational/resp method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_resp.m,v 1.7 2010/03/15 15:57:06 ingo Exp $ +% + +% +% +% The resp method of the rational class returns the complex response of a +% rational TF as an Analysis Object. For a command with no output variables +% plots the method the result into a diagram. +% +% + +function results = utp_rational_resp(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'resp'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test RATIONAL objects + [ra1,ra2,ra3,rav,ram] = get_test_objects_rational; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + warning('This UTP needs a complete update'); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test input data shape == output data shape + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Test with f = ao.y + results = [results utp_11]; % Test with f + results = [results utp_12]; % Test with f1, f2 and nf + results = [results utp_13]; % Test with f1, f2 and nf AND 'scale' + + % Make surethat all figures are closed + close all; + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'List')), atest = false; end + if ~any(strcmpi(io(2).sets, 'Range')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'List' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('f'), atest = false; end + if ~io(3).plists.isparam('bank'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('f')), atest = false; end + if ~isequal(io(3).plists.find('bank'), 'none'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('f'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('bank'), {'none', 'serial', 'parallel'}), atest = false; end + %%%%%%%%%% SET 'Range' + if io(4).plists.nparams ~= 5, atest = false; end + % Check key + if ~io(4).plists.isparam('f1'), atest = false; end + if ~io(4).plists.isparam('f2'), atest = false; end + if ~io(4).plists.isparam('nf'), atest = false; end + if ~io(4).plists.isparam('scale'), atest = false; end + if ~io(4).plists.isparam('bank'), atest = false; end + % Check default value + if ~isEmptyDouble(io(4).plists.find('f1')), atest = false; end + if ~isEmptyDouble(io(4).plists.find('f2')), atest = false; end + if ~isequal(io(4).plists.find('nf'), 1000), atest = false; end + if ~isequal(io(4).plists.find('scale'), 'log'), atest = false; end + if ~isequal(io(4).plists.find('bank'), 'none'), atest = false; end + % Check options + if ~isequal(io(4).plists.getOptionsForParam('f1'), {[]}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('f2'), {[]}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('nf'), {1000}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('scale'), {'lin', 'log'}), atest = false; end + if ~isequal(io(4).plists.getOptionsForParam('bank'), {'none', 'serial', 'parallel'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the resp method works with a vector of RATIONAL objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the resp method works for a vector of RATIONAL objects as + % input. Test the method with an output and with no output + % (a diagram must appear) + % + % + + try + % + % Make sure that all figures are closed. + close all; + resp(rav); + out = resp(rav); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Test the right number of lines in the diagram. + % 2) Check that the number of elements in 'out' is the same as in 'rav' + % 3) Check that each output RATIONAL contains the correct data. + % + % + + atest = true; + TOL = 1e-13; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + % Check that the diagram have the same number of lines as the output + % object + if max(cellfun('size', lines, 1)) ~= numel(rav), atest = false; end + % Check the number of output objects. + if ~isequal(size(out), size(rav)), atest = false; end + % Check each output against the default values for f1, f2 and nf + for ii = 1:numel(out) + f1 = getlowerFreq(rav(ii))/10; + f2 = getupperFreq(rav(ii))*10; + nf = 1000; + if ~isa(out(ii), 'ao'), atest = false; end + if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end + if abs(out(ii).x(1) - f1) > TOL, atest = false; end + if abs(out(ii).x(end) - f2) > TOL, atest = false; end + if numel(out(ii).x) ~= nf, atest = false; end + s = 2*pi*1i*out(ii).x; + numr = polyval(rav(ii).num, s); + denr = polyval(rav(ii).den, s); + rsp = numr./denr; + if ~isequal(out(ii).y, rsp), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the resp method works with a matrix of RATIONAL objects as + % input. + % + % + function result = utp_03 + + % + % + % Tests that the resp method works with a matrix of RATIONAL objects as + % input. Test the method with an output and with no output + % (a diagram must appear) + % + % + + try + % + % Make sure that all figures are closed. + close all; + resp(ram); + out = resp(ram); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Test the right number of lines in the diagram. + % 2) Check that the number of elements in 'out' is the same as in 'ram' + % 3) Check that each output RATIONAL contains the correct data. + % + % + + atest = true; + TOL = 1e-13; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + % Check that the diagram have the same number of lines as the output + % object + if max(cellfun('size', lines, 1)) ~= numel(ram), atest = false; end + % Check the number of output objects. + if ~isequal(size(out), size(ram)), atest = false; end + % Check each output against the default values for f1, f2 and nf + for ii = 1:numel(out) + f1 = getlowerFreq(ram(ii))/10; + f2 = getupperFreq(ram(ii))*10; + nf = 1000; + if ~isa(out(ii), 'ao'), atest = false; end + if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end + if abs(out(ii).x(1) - f1) > TOL, atest = false; end + if abs(out(ii).x(end) - f2) > TOL, atest = false; end + if numel(out(ii).x) ~= nf, atest = false; end + s = 2*pi*1i*out(ii).x; + numr = polyval(ram(ii).num, s); + denr = polyval(ram(ii).den, s); + rsp = numr./denr; + if ~isequal(out(ii).y, rsp), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the resp method works with a list of RATIONAL objects as + % input. + % + % + function result = utp_04 + + % + % + % Tests that the resp method works with a list of RATIONAL objects as + % input. Test the method with an output and with no output + % (a diagram must appear) + % + % + + try + % + % Make sure that all figures are closed. + close all; + resp(ra1, ra2, ra3); + out = resp(ra1, ra2, ra3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Test the right number of lines in the diagram. + % 2) Check that the number of elements in 'out' is the same as in 'rain' + % 3) Check that each output RATIONAL contains the correct data. + % + % + + atest = true; + TOL = 1e-13; + rain = [ra1, ra2, ra3]; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + % Check that the diagram have the same number of lines as the output + % object + if max(cellfun('size', lines, 1)) ~= numel(rain), atest = false; end + % Check the number of output objects. + if ~isequal(size(out), size(rain)), atest = false; end + % Check each output against the default values for f1, f2 and nf + for ii = 1:numel(out) + f1 = getlowerFreq(rain(ii))/10; + f2 = getupperFreq(rain(ii))*10; + nf = 1000; + if ~isa(out(ii), 'ao'), atest = false; end + if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end + if abs(out(ii).x(1) - f1) > TOL, atest = false; end + if abs(out(ii).x(end) - f2) > TOL, atest = false; end + if numel(out(ii).x) ~= nf, atest = false; end + s = 2*pi*1i*out(ii).x; + numr = polyval(rain(ii).num, s); + denr = polyval(rain(ii).den, s); + rsp = numr./denr; + if ~isequal(out(ii).y, rsp), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the resp method works with a mix of different shaped + % RATIONAL objects as input. + % + % + function result = utp_05 + + % + % + % Tests that the resp method works with a mix of different shaped + % RATIONAL objects as input. Test the method with an output and with no + % output (a diagram must appear) + % + % + + try + % + % Make sure that all figures are closed. + close all; + resp(ra1, ram, rav); + out = resp(ra1, ram, rav); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Test the right number of lines in the diagram. + % 2) Check that the number of elements in 'out' is the same as in 'rain' + % 3) Check that each output RATIONAL contains the correct data. + % + % + + atest = true; + TOL = 1e-13; + rain = [ra1, reshape(ram, 1, []), reshape(rav, 1, [])]; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + % Check that the diagram have the same number of lines as the output + % object + if max(cellfun('size', lines, 1)) ~= numel(rain), atest = false; end + % Check the number of output objects. + if ~isequal(size(out), size(rain)), atest = false; end + % Check each output against the default values for f1, f2 and nf + for ii = 1:numel(out) + f1 = getlowerFreq(rain(ii))/10; + f2 = getupperFreq(rain(ii))*10; + nf = 1000; + if ~isa(out(ii), 'ao'), atest = false; end + if ~strcmp(out(ii).hist.methodInfo.mname, 'resp'), atest = false; end + if abs(out(ii).x(1) - f1) > TOL, atest = false; end + if abs(out(ii).x(end) - f2) > TOL, atest = false; end + if numel(out(ii).x) ~= nf, atest = false; end + s = 2*pi*1i*out(ii).x; + numr = polyval(rain(ii).num, s); + denr = polyval(rain(ii).den, s); + rsp = numr./denr; + if ~isequal(out(ii).y, rsp), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the resp method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the resp method can be processed back. + % + % + + try + % + close all; + resp(ra1); + out = resp(ra1); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'resp'. + % 2) Check that re-built object is the same object as the input. + % + % + + atest = true; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + x = get(lines{1}, 'XData'); + y1 = get(lines{1}, 'YData'); + y2 = get(lines{2}, 'YData'); + if ~isequal(x, out.x.'), atest = false; end + if ~isequal(y2, abs(out.y)'), atest = false; end + if ~isequal(y1, utils.math.phase(out.y)'), atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'resp'), atest = false; end + % Run 'test.m' and check the result + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that modify command plots the response into a diagram. + % + % + function result = utp_07 + + % + % + % Tests that modify command plots the response into a diagram. + % + % + + try + % + close all; + ra1.resp(); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the response diagram. + % + % + + atest = true; + TOL = 1e-13; + if stest + % + % Get the current figure. + fi = gcf; + % Get ALL axes including the legends. + ax = get(fi, 'Children'); + % Select only the 'axes' with the lines + ax = ax(ismember(get(ax(:), 'Tag'), '')); + % Get the lines of both axes + lines = get(ax(:), 'Children'); + x = get(lines{1}, 'XData'); + f1 = getlowerFreq(ra1)/10; + f2 = getupperFreq(ra1)*10; + nf = find(pzmodel.getInfo('resp', 'Range').plists, 'nf'); + if abs(x(1) - f1) > TOL, atest = false; end + if abs(x(end) - f2) > TOL, atest = false; end + if numel(x) ~= nf, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the shape of the output. + % + % + function result = utp_08 + + % + % + % Test that the output AO of the resp method keeps the shape of the used + % input f vector. + % + % + + try + % + arow = ao(1:123, linspace(.1, 5, 123)); + acol = arow.'; + f = linspace(.1, 5, 123); + out1 = resp(ra2, arow); + out2 = resp(ra2, acol); + out3 = resp(ra2, f); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the data doesn't change. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if size(out1.data.y,1) ~= 1, atest = false; end + if size(out1.data.y,2) == 1, atest = false; end + if size(out2.data.y,1) == 1, atest = false; end + if size(out2.data.y,2) ~= 1, atest = false; end + if size(out3.data.y,1) ~= 1, atest = false; end + if size(out3.data.y,2) == 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the resp method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [o1, o2] = resp(ra1, ra1); + o3 = resp(ra1, ra1); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the resp method uses the x-data of an input AO for f-vector. + % + % + function result = utp_10 + + % + % + % Call the method with different method to pass an AO in. + % + % + + try + % + f1 = .1; + f2 = 5; + nf = 123; + axy = ao(linspace(f1, f2, nf), randn(nf,1)); + afs = ao(linspace(f1, f2, nf), randn(nf,1), plist('type', 'fsdata')); + out1 = resp(ra3, axy); + out2 = resp(ra3, afs); + out3 = resp(ra3, plist('f', axy)); + out4 = resp(ra3, plist('f', afs)); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the output + if ~isa(out1, 'ao'), atest = false; end + if ~isa(out2, 'ao'), atest = false; end + if ~isa(out3, 'ao'), atest = false; end + if ~isa(out4, 'ao'), atest = false; end + if out1.x(1) ~= f1, atest = false; end + if out1.x(end) ~= f2, atest = false; end + if numel(out1.x) ~= nf, atest = false; end + if out2.x(1) ~= f1, atest = false; end + if out2.x(end) ~= f2, atest = false; end + if numel(out2.x) ~= nf, atest = false; end + if out3.x(1) ~= f1, atest = false; end + if out3.x(end) ~= f2, atest = false; end + if numel(out3.x) ~= nf, atest = false; end + if out4.x(1) ~= f1, atest = false; end + if out4.x(end) ~= f2, atest = false; end + if numel(out4.x) ~= nf, atest = false; end + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + if ~eq(out3, mout3, ple2), atest = false; end + if ~eq(out4, mout4, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_11 + + % + % + % Check that the resp method uses the specified f-vector to compute the + % response. + % + % + function result = utp_11 + + % + % + % Call the method with different method to pass an f-vector in. + % + % + + try + % + f1 = .1; + f2 = 5; + nf = 100; + f = linspace(f1, f2, nf); + out1 = resp(ra3, f); + out2 = resp(ra3, plist('f', f)); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the output + if ~isa(out1, 'ao'), atest = false; end + if ~isa(out2, 'ao'), atest = false; end + if out1.x(1) ~= f1, atest = false; end + if out1.x(end) ~= f2, atest = false; end + if numel(out1.x) ~= nf, atest = false; end + if out2.x(1) ~= f1, atest = false; end + if out2.x(end) ~= f2, atest = false; end + if numel(out2.x) ~= nf, atest = false; end + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_11 + + %% UTP_12 + + % + % + % Check that the resp method uses the specified f1, f2, and nf to compute the response. + % + % + function result = utp_12 + + % + % + % Call the method with different method to pass f1, f2, and nf in. + % + % + + try + % + f1 = .1; + f2 = 5; + nf = 100; + nf2 = 123; + out1 = resp(ra3, f1, f2); + out2 = resp(ra3, f1, f2, nf); + out3 = resp(ra3, plist('f1', f1, 'f2', f2, 'nf', nf)); + out4 = resp(ra3, plist('f1', f1, 'nf', nf2)); + out5 = resp(ra3, plist('f2', f2)); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + mout5 = rebuild(out5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + T = 10e-12; + if stest + % + % Check the output + f1d = getlowerFreq(ra3)/10; + f2d = getupperFreq(ra3)*10; + nfd = find(pzmodel.getInfo('resp', 'Range').plists, 'nf'); + if ~isa(out1, 'ao'), atest = false; end + if ~isa(out2, 'ao'), atest = false; end + if ~isa(out3, 'ao'), atest = false; end + if ~isa(out4, 'ao'), atest = false; end + if ~isa(out5, 'ao'), atest = false; end + if out1.x(1) ~= f1, atest = false; end + if abs(out1.x(end)-f2)>T, atest = false; end + if numel(out1.x) ~= nfd, atest = false; end % Default values + if out2.x(1) ~= f1, atest = false; end + if abs(out2.x(end)-f2)>T, atest = false; end + if numel(out2.x) ~= nf, atest = false; end + if out3.x(1) ~= f1, atest = false; end + if abs(out3.x(end)-f2)>T, atest = false; end + if numel(out3.x) ~= nf, atest = false; end + if out4.x(1) ~= f1, atest = false; end + if abs(out4.x(end) - f2d) > T, atest = false; end % Default values + if numel(out4.x) ~= nf2, atest = false; end + if out5.x(1) ~= f1d, atest = false; end % Default values + if abs(out5.x(end)-f2)>T, atest = false; end + if numel(out5.x) ~= nfd, atest = false; end % Default values + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + if ~eq(out3, mout3, ple2), atest = false; end + if ~eq(out4, mout4, ple2), atest = false; end + if ~eq(out5, mout5, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Check that the resp method uses the specified f1, f2, and nf to compute + % the response. + % + % + function result = utp_13 + + % + % + % Call the method with different method to pass f1, f2, and nf in. + % + % + + try + % + f1 = .1; + f2 = 5; + nf = 123; + out1 = resp(ra3, plist('f1', f1, 'f2', f2, 'nf', nf, 'scale', 'lin')); + out2 = resp(ra3, plist('f1', f1, 'f2', f2, 'nf', nf, 'scale', 'log')); + out3 = resp(ra3, plist('scale', 'lin')); + out4 = resp(ra3, plist('scale', 'log')); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + T = 10e-12; + if stest + % + % Check the output + f1d = getlowerFreq(ra3)/10; + f2d = getupperFreq(ra3)*10; + nfd = find(pzmodel.getInfo('resp', 'Range').plists, 'nf'); + if ~isa(out1, 'ao'), atest = false; end + if ~isa(out2, 'ao'), atest = false; end + if ~isa(out3, 'ao'), atest = false; end + if ~isa(out4, 'ao'), atest = false; end + xlin1 = linspace(f1, f2, nf); + xlin2 = linspace(f1d, f2d, nfd); + xlog1 = logspace(log10(f1), log10(f2), nf); + xlog2 = logspace(log10(f1d), log10(f2d), nfd); + if ~isequal(xlin1, out1.x'), atest = false; end + if ~isequal(xlin2, out3.x'), atest = false; end + if ~isequal(xlog1, out2.x'), atest = false; end + if ~isequal(xlog2, out4.x'), atest = false; end + + % Check the rebuilding of the object + if ~eq(out1, mout1, ple2), atest = false; end + if ~eq(out2, mout2, ple2), atest = false; end + if ~eq(out3, mout3, ple2), atest = false; end + if ~eq(out4, mout4, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_save.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_save.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,647 @@ +% UTP_RATIONAL_SAVE a set of UTPs for the rational/save method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_save.m,v 1.5 2010/08/31 09:43:48 hewitson Exp $ +% + +% +% +% The save method of the rational class saves a rational object to disk. Save +% stores the variables in a MATLAB formatted file (MAT-file) named +% filename.mat or in a XML fromat named filename.xml +% +% + +function results = utp_rational_save(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'save'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test RATIONAL objects + [ra1,ra2,ra3,rav,ram] = get_test_objects_rational; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test plist contains the filename + results = [results utp_09]; % Test with different complex RATIONAL objects + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(3).plists.isparam('filename'), atest = false; end + if ~io(3).plists.isparam('prefix'), atest = false; end + if ~io(3).plists.isparam('postfix'), atest = false; end + if ~io(3).plists.isparam('individual files'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('filename'), ''), atest = false; end + if ~isequal(io(3).plists.find('prefix'), ''), atest = false; end + if ~isequal(io(3).plists.find('postfix'), ''), atest = false; end + if ~isequal(io(3).plists.find('individual files'), false), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('filename'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the save method works with a vector of RATIONAL objects as input. + % + % + function result = utp_02 + + % + % + % Test that the save method works for a vector of RATIONAL objects as input. + % Test both formats 'xml' and 'mat'. + % + % + + try + % + save(rav, 'test.xml'); + save(rav, 'test.mat'); + out1 = rational('test.xml'); + out2 = rational('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the + % same as in 'rav' + % 2) Check that the loaded objects are the same as the saved objects. + % 3) The outputs 'out1' and 'out2' must be the same. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(rav)), atest = false; end + if ~isequal(size(out2), size(rav)), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(rav(kk), out1(kk), ple1), atest = false; end + if ~eq(rav(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the save method works with a matrix of RATIONAL objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the save method works for a matrix of RATIONAL objects as + % input. Test both formats 'xml' and 'mat'. + % + % + + try + % + save(ram, 'test.xml'); + save(ram, 'test.mat'); + out1 = rational('test.xml'); + out2 = rational('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the + % same as in 'ram' + % 2) Check that the loaded objects are the same as the saved objects. + % 3) The outputs 'out1' and 'out2' must be the same. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(ram)), atest = false; end + if ~isequal(size(out2), size(ram)), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(ram(kk), out1(kk), ple1), atest = false; end + if ~eq(ram(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the save method works with a list of RATIONAL objects as input. + % + % + function result = utp_04 + + % + % + % Test that the save method works for a list of RATIONAL objects as input. + % Test both formats 'xml' and 'mat'. + % + % + + try + % + save(ra1, ra2, ra3, 'test.xml'); + save(ra1, ra2, ra3, 'test.mat'); + out1 = rational('test.xml'); + out2 = rational('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the + % same as in the list + % 2) Check that the loaded objects are the same as the saved objects. + % 3) The outputs 'out1' and 'out2' must be the same. + % + % + + atest = true; + rain = [ra1, ra2, ra3]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 3, atest = false; end + if numel(out2) ~= 3, atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(rain(kk), out1(kk), ple1), atest = false; end + if ~eq(rain(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the save method works with a mix of different shaped RATIONAL + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the save method works with an input of matrices and vectors + % and single RATIONAL objects. Test both formats 'xml' and 'mat'. + % + % + + try + % + save(ra1,rav,ra2, 'test.xml'); + save(ra1,rav,ra2, 'test.mat'); + out1 = rational('test.xml'); + out2 = rational('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output RATIONAL object contains the correct data. + % + % + + atest = true; + rain = [ra1, reshape(rav, 1, []), ra2]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 2+numel(rav), atest = false; end + if numel(out2) ~= 2+numel(rav), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(rain(kk), out1(kk), ple1), atest = false; end + if ~eq(rain(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the save method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the save method can be processed back + % to an m-file. Do this for both extensions 'mat' and 'xml' + % + % + + try + % + out1 = save(ra3, 'test.xml'); + out2 = save(ra2, 'test.mat'); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history applies to the output object. Check that + % save doesn't add a history step to the input object. + % 2) Check that the read object doesn't contain the save + load history steps. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % The last history step is the save method + if strcmp(out1.hist.methodInfo.mname, 'save'), atest = false; end + if strcmp(out2.hist.methodInfo.mname, 'save'), atest = false; end + if ~eq(out1.hist, ra3.hist), atest = false; end + if ~eq(out2.hist, ra2.hist), atest = false; end + % check the history steps of the read object (load + save) + % The steps (save + load) shouldn't add history + outr1 = rational('test.xml'); + outr2 = rational('test.mat'); + if strcmp(outr1.hist, ra3.hist), atest = false; end + if strcmp(outr2.hist, ra2.hist), atest = false; end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + % delete test file + delete('test.xml') + delete('test.mat') + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the save method works with the modify command. + % + % + function result = utp_07 + + % + % + % Use the save method with the modifier command. + % + % + + try + % + % copy ra1 to work with + iir_mat = rational(ra1); + iir_mat.save('test.mat'); + iir_xml = rational(ra1); + iir_xml.save('test.xml'); + out1 = rational('test.mat'); + out2 = rational('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the save method doesn't apply the history. + % 2) Check the output against the input. + % + % + + atest = true; + if stest + % + % Check that the modified object have the 'save' method as the last + % history step + if strcmp(iir_xml.hist.methodInfo.mname, 'save'), atest = false; end + if strcmp(iir_mat.hist.methodInfo.mname, 'save'), atest = false; end + % Check the output without the history + if ~eq(iir_mat, out1, ple1), atest = false; end + if ~eq(iir_xml, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the save method uses the filename which is stored in a plist. + % + % + + try + % + pl1 = plist('filename', 'test.mat'); + pl2 = plist('filename', 'test.xml'); + save(ra3, pl1); + save(ra3, pl2); + out1 = rational('test.mat'); + out2 = rational('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + % Check the output + if ~eq(ra3, out1, ple1), atest = false; end + if ~eq(ra3, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test the save method with different complex RATIONAL objects + % + % + function result = utp_09 + + % + % + % Test the save method with different complex RATIONAL objects + % + % + + try + % + pzm = pzmodel(1, [pz(1,1), pz(1+3i), pz(10)], [{[2 1],1, 5-2i}, 4, {3+3i}]); + p = parfrac([1 2+1i 2-1i], [6 1+3i 1-3i], [1 2 3 4], 'my par frac', unit('V'), unit('Hz')); + r1 = rational(pzm); + r2 = rational(p); + r3 = rational([1 2+1i 2-1i], [6 1+3i 1-3i]); + + save(r1, 'test_r1.mat'); % highpass + save(r1, 'test_r1.xml'); % highpass + save(r2, 'test_r2.mat'); % lowpass + save(r2, 'test_r2.xml'); % lowpass + save(r3, 'test_r3.mat'); % bandpass + save(r3, 'test_r3.xml'); % bandpass + out1 = rational('test_r1.mat'); + out2 = rational('test_r1.xml'); + out3 = rational('test_r2.mat'); + out4 = rational('test_r2.xml'); + out5 = rational('test_r3.mat'); + out6 = rational('test_r3.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + % Check highpass + if ~eq(r1, out1, ple1), atest = false; end + if ~eq(r1, out2, ple1), atest = false; end + if ~eq(r2, out3, ple1), atest = false; end + if ~eq(r2, out4, ple1), atest = false; end + if ~eq(r3, out5, ple1), atest = false; end + if ~eq(r3, out6, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + if ~eq(out3, out4, ple2), atest = false; end + if ~eq(out5, out6, ple2), atest = false; end + % + delete('test_r1.mat'); + delete('test_r1.xml'); + delete('test_r2.mat'); + delete('test_r2.xml'); + delete('test_r3.mat'); + delete('test_r3.xml'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_setIunits.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_setIunits.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,568 @@ +% UTP_RATIONAL_SETIUNITS a set of UTPs for the rational/setIunits method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_setIunits.m,v 1.4 2011/04/19 18:14:02 ingo Exp $ +% + +% +% +% The setIunits method of the rational class sets the iunits property. +% +% + +function results = utp_rational_setIunits(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'setIunits'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test RATIONAL objects + [ra1,ra2,ra3,rav,ram] = get_test_objects_rational; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('iunits'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('iunits')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('iunits'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setIunits method works with a vector of RATIONAL objects + % as input. + % + % + function result = utp_02 + + % + % + % Test that the setIunits method works for a vector of RATIONAL objects + % as input. + % + % + + try + % + out = setIunits(rav, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'rav' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(rav)), atest = false; end + % Check iunits field of each output + for kk=1:numel(out) + if ~eq(out(kk).iunits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setIunits method works with a matrix of RATIONAL objects + % as input. + % + % + function result = utp_03 + + % + % + % Test that the setIunits method works for a matrix of RATIONAL objects + % as input. + % + % + + try + % + out = setIunits(ram, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'ram' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(ram)), atest = false; end + % Check iunits field of each output + for kk=1:numel(out) + if ~eq(out(kk).iunits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setIunits method works with a list of RATIONAL objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the setIunits method works for a list of RATIONAL objects as + % input. + % + % + + try + % + out = setIunits(ra1,ra2,ra3, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~eq(out(1).iunits, unit('Hz')), atest = false; end + if ~eq(out(2).iunits, unit('Hz')), atest = false; end + if ~eq(out(3).iunits, unit('Hz')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setIunits method works with a mix of different shaped + % RATIONAL objects as input. + % + % + function result = utp_05 + + % + % + % Test that the setIunits method works with an input of matrices and + % vectors and single RATIONAL objects. + % + % + + try + % + out = setIunits(ra1,rav,ra2,ram,ra3, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(ram)+numel(rav)), atest = false; end + for kk=1:numel(out) + if ~eq(out(kk).iunits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setIunits method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setIunits method can be + % processed back to an m-file. + % + % + + try + % + out1 = setIunits(ra3, unit('Hz')); + out2 = testCallerIsMethod(@setIunits, ra3, unit('Hz')); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setIunits'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setIunits'. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setIunits') && ... + eq(out1.hist.plistUsed, plist('iunits', unit('Hz')), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('iunits', unit('Hz')), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple1), atest = false; end + e = ple1.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'iunits'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setIunits method can modify the input RATIONAL object. + % + % + function result = utp_07 + + % + % + % Test that the setIunits method can modify the input RATIONAL object + % by calling with no output. + % + % + + try + % + % copy ra3 to work with + ain = rational(ra3); + % modify ain + aout = ain.setIunits(unit('Hz')); + ain.setIunits(unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ra3' and 'ain' are now different. + % 2) Check that 'ain' has the correct iunits field + % + % + + atest = true; + if stest + % + % Check that setIunits modified the input by comparing to the copy + if eq(rational(ra3), ain, ple1), atest = false; end + % Check that setIunits doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~eq(ain.iunits, unit('Hz')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setIunits method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setIunits method can modify the property 'iunits' + % with a value in a plist. + % + % + + try + % + pl = plist('iunits', unit('Hz')); + out = ra3.setIunits(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct iunits field + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'iunits' + if ~eq(out.iunits, unit('Hz')), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setIunits method pass back the output objects to a list + % of output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [o1, o2] = setIunits(ra3, ra2, unit('mol')); + o3 = setIunits(ra3, ra2, unit('mol')); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_setName.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_setName.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,568 @@ +% UTP_RATIONAL_SETNAME a set of UTPs for the rational/setName method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_setName.m,v 1.4 2011/04/19 18:14:02 ingo Exp $ +% + +% +% +% The setName method of the rational class sets the name property. +% +% + +function results = utp_rational_setName(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'setName'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test RATIONAL objects + [ra1,ra2,ra3,rav,ram] = get_test_objects_rational; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('name'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('name')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('name'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setName method works with a vector of RATIONAL objects + % as input. + % + % + function result = utp_02 + + % + % + % Test that the setName method works for a vector of RATIONAL objects + % as input. + % + % + + try + % + out = setName(rav, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'rav' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(rav)), atest = false; end + % Check name field of each output + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setName method works with a matrix of RATIONAL objects + % as input. + % + % + function result = utp_03 + + % + % + % Test that the setName method works for a matrix of RATIONAL objects + % as input. + % + % + + try + % + out = setName(ram, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'ram' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(ram)), atest = false; end + % Check name field of each output + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setName method works with a list of RATIONAL objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the setName method works for a list of RATIONAL objects as + % input. + % + % + + try + % + out = setName(ra1,ra2,ra3, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~strcmp(out(1).name, 'my name'), atest = false; end + if ~strcmp(out(2).name, 'my name'), atest = false; end + if ~strcmp(out(3).name, 'my name'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setName method works with a mix of different shaped + % RATIONAL objects as input. + % + % + function result = utp_05 + + % + % + % Test that the setName method works with an input of matrices and + % vectors and single RATIONAL objects. + % + % + + try + % + out = setName(ra1,rav,ra2,ram,ra3, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(ram)+numel(rav)), atest = false; end + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setName method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setName method can be processed + % back to an m-file. + % + % + + try + % + out1 = setName(ra3, 'my name'); + out2 = testCallerIsMethod(@setName, ra3, 'my name'); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setName'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds + % to 'setName'. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setName') && ... + eq(out1.hist.plistUsed, plist('name', 'my name'), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('name', 'my name'), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple1), atest = false; end + e = ple1.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'name'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setName method can modify the input RATIONAL object. + % + % + function result = utp_07 + + % + % + % Test that the setName method can modify the input RATIONAL object + % by calling with no output. + % + % + + try + % + % copy ra3 to work with + ain = rational(ra3); + % modify ain + aout = ain.setName('my name'); + ain.setName('my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ra3' and 'ain' are now different. + % 2) Check that 'ain' has the correct name field + % + % + + atest = true; + if stest + % + % Check that setName modified the input by comparing to the copy + if eq(rational(ra3), ain, ple1), atest = false; end + % Check that setName doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~strcmp(ain.name, 'my name'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setName method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setName method can modify the property 'name' + % with a value in a plist. + % + % + + try + % + pl = plist('name', 'my name'); + out = ra3.setName(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct name field + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'name' + if ~strcmp(out.name, 'my name'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setName method pass back the output objects to a list + % of output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [o1, o2] = setName(ra3, ra2, 'new name'); + o3 = setName(ra3, ra2, 'new name'); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_setOunits.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_setOunits.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,568 @@ +% UTP_RATIONAL_SETOUNITS a set of UTPs for the rational/setOunits method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_setOunits.m,v 1.4 2011/04/19 18:14:02 ingo Exp $ +% + +% +% +% The setOunits method of the rational class sets the ounits property. +% +% + +function results = utp_rational_setOunits(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'setOunits'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test RATIONAL objects + [ra1,ra2,ra3,rav,ram] = get_test_objects_rational; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('ounits'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('ounits')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('ounits'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setOunits method works with a vector of RATIONAL objects + % as input. + % + % + function result = utp_02 + + % + % + % Test that the setOunits method works for a vector of RATIONAL objects + % as input. + % + % + + try + % + out = setOunits(rav, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'rav' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(rav)), atest = false; end + % Check ounits field of each output + for kk=1:numel(out) + if ~eq(out(kk).ounits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setOunits method works with a matrix of RATIONAL objects + % as input. + % + % + function result = utp_03 + + % + % + % Test that the setOunits method works for a matrix of RATIONAL objects + % as input. + % + % + + try + % + out = setOunits(ram, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'ram' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(ram)), atest = false; end + % Check ounits field of each output + for kk=1:numel(out) + if ~eq(out(kk).ounits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setOunits method works with a list of RATIONAL objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the setOunits method works for a list of RATIONAL objects as + % input. + % + % + + try + % + out = setOunits(ra1,ra2,ra3, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~eq(out(1).ounits, unit('Hz')), atest = false; end + if ~eq(out(2).ounits, unit('Hz')), atest = false; end + if ~eq(out(3).ounits, unit('Hz')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setOunits method works with a mix of different shaped + % RATIONAL objects as input. + % + % + function result = utp_05 + + % + % + % Test that the setOunits method works with an input of matrices and + % vectors and single RATIONAL objects. + % + % + + try + % + out = setOunits(ra1,rav,ra2,ram,ra3, unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(ram)+numel(rav)), atest = false; end + for kk=1:numel(out) + if ~eq(out(kk).ounits, unit('Hz')), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setOunits method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setOunits method can be + % processed back to an m-file. + % + % + + try + % + out1 = setOunits(ra3, unit('Hz')); + out2 = testCallerIsMethod(@setOunits, ra3, unit('Hz')); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setOunits'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setOunits'. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setOunits') && ... + eq(out1.hist.plistUsed, plist('ounits', unit('Hz')), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('ounits', unit('Hz')), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple1), atest = false; end + e = ple1.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'ounits'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setOunits method can modify the input RATIONAL object. + % + % + function result = utp_07 + + % + % + % Test that the setOunits method can modify the input RATIONAL object + % by calling with no output. + % + % + + try + % + % copy ra3 to work with + ain = rational(ra3); + % modify ain + aout = ain.setOunits(unit('Hz')); + ain.setOunits(unit('Hz')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ra3' and 'ain' are now different. + % 2) Check that 'ain' has the correct ounits field + % + % + + atest = true; + if stest + % + % Check that setOunits modified the input by comparing to the copy + if eq(rational(ra3), ain, ple1), atest = false; end + % Check that setOunits doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~eq(ain.ounits, unit('Hz')), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setOunits method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setOunits method can modify the property 'ounits' + % with a value in a plist. + % + % + + try + % + pl = plist('ounits', unit('Hz')); + out = ra3.setOunits(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct ounits field + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'ounits' + if ~eq(out.ounits, unit('Hz')), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setOunits method pass back the output objects to a list + % of output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [o1, o2] = setOunits(ra3, ra2, unit('mol')); + o3 = setOunits(ra3, ra2, unit('mol')); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_string.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_string.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,435 @@ +% UTP_RATIONAL_STRING a set of UTPs for the rational/string method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_string.m,v 1.4 2011/09/29 13:49:04 ingo Exp $ +% + +% +% +% The string method of the rational class writes a command string that can +% be used to recreate the input object(s). But the object should not have +% more than one history step. +% +% + +function results = utp_rational_string(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'string'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + ra1 = rational([1 2], [4, 6+2i], 'nice name'); + ra2 = rational(plist('num', [1 2], 'den', [3, 6, -7])); + rav = [ra1, ra2, ra1]; + ram = [ra1, ra2, ra1; ra1, ra2, ra1]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Negative test: The object have more than one history step. + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the string method works with a vector of RATIONAL objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the string method works for a vector of RATIONAL objects as + % input. + % + % + + try + % + out = string(rav); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end; + if ~isa(rout, 'rational'), atest = false; end + if numel(rout) ~= numel(rav), atest = false; end + for kk = 1:numel(rav) + if eq(rout(kk), rav(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the string method works with a matrix of RATIONAL objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the string method works for a matrix of RATIONAL objects as + % input. + % + % + + try + % + out = string(ram); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'rational'), atest = false; end + if numel(rout) ~= numel(ram), atest = false; end + for kk = 1:numel(ram) + if eq(rout(kk), ram(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the string method works with a list of RATIONAL objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the string method works for a list of RATIONAL objects as + % input. + % + % + + try + % + out = string(ra1,ra2); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + rain = [ra1, ra2]; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'rational'), atest = false; end + if numel(rout) ~= numel(rain), atest = false; end + for kk = 1:numel(rain) + if eq(rout(kk), rain(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the string method works with a mix of different shaped + % RATIONAL objects as input. + % + % + function result = utp_05 + + % + % + % Test that the string method works with an input of matrices and + % vectors and single RATIONAL objects. + % + % + + try + % + out = string(ra1,ram,ra2); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + rain = [ra1, reshape(ram, 1, []), ra2]; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'rational'), atest = false; end + if numel(rout) ~= numel(rain), atest = false; end + for kk = 1:numel(rain) + if eq(rout(kk), rain(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the string method properly applies history. + % + % + function result = utp_06 + + % + % + % The method string doesn't change the data, thus it is not possible to + % check the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the string method doesn't work if the RATIONAL object have + % more than one history step. + % + % + function result = utp_07 + + % + % + % The method string throws an error because the input object have more + % than one history step. + % + % + + try + % + pzm = pzmodel(12, {2, [3 5], 7}, {1+2i 5}); + ra3 = parfrac(pzm); + ra3.setName('Second history step'); + out = ra3.string(); + % + stest = false; + catch err + stest = true; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_submit.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_submit.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,528 @@ +% UTP_RATIONAL_SUBMIT a set of UTPs for the rational/submit method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_submit.m,v 1.13 2010/08/18 09:25:56 ingo Exp $ +% + +% +% +% The bsubmit method of the rational class submits a collection of objects +% in XML form to an LTPDA Repository. The type of the objects are +% independent. +% +% + +function results = utp_rational_submit(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'submit'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + [ra1,ra2,ra3,rav,ram] = get_test_objects_rational; + plForAutoTest = plist('no dialog', true, 'use selector', false); + + conn = utpGetConnection(); + try + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_rational_submit: submit rational'; + sinfo.experiment_description = 'utp_rational_submit: description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test output of the data + catch + end + + % Close connection + utpCloseConnection(conn); + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 16, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('sinfo filename'), atest = false; end + if ~io(3).plists.isparam('binary'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isEmptyChar(io(3).plists.find('sinfo filename')), atest = false; end + if ~isequal(io(3).plists.find('binary'), false), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the submit method works with a vector of RATIONAL objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the submit method works for a vector of RATIONAL objects as + % input. + % + % + + try + % + [ids, cids] = submit(rav, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + robjs3 = ltpda_uo.retrieve(conn, ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(rav), atest = false; end + if numel(robjs2) ~= numel(rav), atest = false; end + if numel(robjs3) ~= numel(rav), atest = false; end + % Check the retrieved object against the submitted + if ~eq(rav, [robjs1{:}]), atest = false; end + if ~eq(rav, [robjs2{:}]), atest = false; end + if ~eq(rav, [robjs3{:}]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the submit method works with a matrix of RATIONAL objects as + % input. + % + % + function result = utp_03 + + % + % + % Tests that the submit method works with a matrix of RATIONAL objects + % as input. + % + % + + try + % + [ids, cids] = submit(ram, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + robjs3 = ltpda_uo.retrieve(conn, ids(1), ids(2), ids(3), ids(4), ids(5), ids(6)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(ram), atest = false; end + if numel(robjs2) ~= numel(ram), atest = false; end + if numel(robjs3) ~= numel(ram), atest = false; end + % Check the retrieved object against the submitted + if ~eq(ram, reshape([robjs1{:}], size(ram))), atest = false; end + if ~eq(ram, reshape([robjs2{:}], size(ram))), atest = false; end + if ~eq(ram, reshape([robjs3{:}], size(ram))), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the submit method works with a list of RATIONAL objects as + % input. + % + % + function result = utp_04 + + % + % + % Tests that the submit method works with a list of RATIONAL objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = submit(ra1, pl, iir, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + robjs3 = ltpda_uo.retrieve(conn, ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 3, atest = false; end + if numel(robjs2) ~= 3, atest = false; end + if numel(robjs3) ~= 3, atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, ra1), atest = false; end + if ~eq(robjs1{3}, pl), atest = false; end + if ~eq(robjs1{2}, iir), atest = false; end + % Check robjs2 + if ~eq(robjs2{1}, ra1), atest = false; end + if ~eq(robjs2{3}, pl), atest = false; end + if ~eq(robjs2{2}, iir), atest = false; end + % Check robjs3 + if ~eq(robjs3{1}, ra1), atest = false; end + if ~eq(robjs3{3}, pl), atest = false; end + if ~eq(robjs3{2}, iir), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the abs method works with a mix of different shaped RATIONAL + % objects as input. + % + % + function result = utp_05 + + % + % + % Tests that the submit method works with a list of RATIONAL objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = submit(pl, ram, iir, rav, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 2 + numel(ram) + numel(rav), atest = false; end + if numel(robjs2) ~= 2 + numel(ram) + numel(rav), atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, ram(1)), atest = false; end + if ~eq(robjs1{2}, ram(2)), atest = false; end + if ~eq(robjs1{3}, ram(3)), atest = false; end + if ~eq(robjs1{4}, ram(4)), atest = false; end + if ~eq(robjs1{5}, ram(5)), atest = false; end + if ~eq(robjs1{6}, ram(6)), atest = false; end + if ~eq(robjs1{7}, iir), atest = false; end + if ~eq(robjs1{8}, rav(1)), atest = false; end + if ~eq(robjs1{9}, rav(2)), atest = false; end + if ~eq(robjs1{10}, rav(3)), atest = false; end + if ~eq(robjs1{11}, pl), atest = false; end + % Check robjs2 + if ~isequalwithequalnans(robjs1, robjs2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tthe submit method properly applies history. + % + % + function result = utp_06 + + % + % + % Tthe submit method properly applies history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the submit method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [ids, cids] = submit(ra1, ra2, sinfo, plForAutoTest); + + [o1, o2] = ltpda_uo.retrieve(conn, 'Collection', cids); + o3 = ltpda_uo.retrieve(conn, 'Collection', cids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the output + if ~eq(o1, ra1), atest = false; end + if ~eq(o2, ra2), atest = false; end + if ~eq(o3{1}, ra1), atest = false; end + if ~eq(o3{2}, ra2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_type.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_type.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,401 @@ +% UTP_RATIONAL_TYPE a set of UTPs for the rational/type method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_type.m,v 1.2 2009/07/27 19:28:59 ingo Exp $ +% + +% +% +% The type method of the rational class converts the input objects to +% MATLAB functions that reproduce the processing steps that led to the +% input objects. +% +% + +function results = utp_rational_type(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'type'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test RATIONAL objects + [ra1,ra2,ra3,rav,ram] = get_test_objects_rational; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % DEfine the filename + filename = 'test_rational_type.m'; + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('filename'), atest = false; end + if ~io(3).plists.isparam('stop_option'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('filename')), atest = false; end + if ~isequal(io(3).plists.find('stop_option'), 'full'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('filename'), {''}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('stop_option'), {'full', 'File', 'Repo', 'File Repo', 'N'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the type method works with a vector of RATIONAL objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the type method works for a vector of RATIONAL objects as + % input. + % + % + + try + % + type(rav, filename); + type(rav); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + if ~eq(rav, mout, ple2), atest = false; end; + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the type method works with a matrix of RATIONAL objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the type method works for a matrix of RATIONAL objects as + % input. + % + % + + try + % + type(ram, filename); + type(ram); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + % Type doesn't keep the shape + for ii = 1:numel(ram) + if ~eq(ram(ii), mout(ii), ple2), atest = false; end; + end + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the type method works with a list of RATIONAL objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the type method works for a list of RATIONAL objects as + % input. + % + % + + try + % + type(ra1,ra2,ra3, filename); + type(ra1,ra2,ra3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + rain = [ra1,ra2,ra3]; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + % Type doesn't keep the shape + for ii = 1:numel(rain) + if ~eq(rain(ii), mout(ii), ple2), atest = false; end; + end + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the type method works with a mix of different shaped RATIONAL + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the type method works with an input of matrices and vectors + % and single RATIONAL objects. + % + % + + try + % + type(ra1,rav,ra2,ram,ra3, filename); + type(ra1,rav,ra2,ram,ra3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + rain = [ra1,reshape(rav,1,[]),ra2,reshape(ram,1,[]),ra3]; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + % Type doesn't keep the shape + for ii = 1:numel(rain) + if ~eq(rain(ii), mout(ii), ple2), atest = false; end; + end + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the type method properly applies history. + % + % + function result = utp_06 + + % + % + % The method type doesn't change the data, thus it is not possible to + % check the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/rational/utp_rational_update.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/rational/utp_rational_update.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,387 @@ +% UTP_RATIONAL_UPDATE a set of UTPs for the rational/update method +% +% M Hewitson 06-08-08 +% +% $Id: utp_rational_update.m,v 1.13 2010/08/18 09:25:56 ingo Exp $ +% + +% +% +% The update method of the rational class updates (replace) an LTPDA object +% in the repository with the given replacement object. It is only possible +% to update one object. This is the reason why the general UTPs are not +% possible. +% +% + +function results = utp_rational_update(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'rational'; + mthd = 'update'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + obj = rational([1 2 3], [4 5 6 7], 'my rational', unit('V'), unit('Hz')); + obj.setName(); + + plForAutoTest = plist('no dialog', true, 'use selector', false); + conn = utpGetConnection(); + try + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_rational_update: update rational'; + sinfo.experiment_description = 'utp_rational_update: description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + [ids, cids] = submit(obj, sinfo, plForAutoTest); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Test with conn + results = [results utp_03]; % Test with sinfo + results = [results utp_04]; % Test update of an binary file + results = [results utp_05]; % Test replace with other object + catch + end + + % Close connection + utpCloseConnection(conn); + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 15, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('binary'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isequal(io(3).plists.find('binary'), false), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_02 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Use a database object (conn) to establish the connection. + % + % + + try + % + % Make some changes to the object. + uobj = obj.setName('I was updated (conn)'); + update(uobj, ids, conn, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_03 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Use a database info structure (sinfo) to establish the connection. + % + % + + try + % + % Make some changes to the object. + uobj = obj.setName('I was updated (sinfo)'); + update(uobj, ids, sinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_04 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Check that the update method also updates objects which are stored as + % a binary file. + % + % + + try + % + % Submit the object as a binary + [ids_bin, cids] = bsubmit(obj, sinfo, plForAutoTest); + % Make some changes to the object. + uobj = obj.setName('I was updated (sinfo)'); + update(uobj, ids_bin, sinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids_bin' + robj = ltpda_uo.retrieve(conn, ids_bin); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the update method replaces the object in the repository with + % a completely other object. + % + % + function result = utp_05 + + % + % + % Tests that the update method replaces the object in the repository + % with a completely other object. + % Replace the rational object with a filter object. + % + % + + try + % + % Make some changes to the object. + uobj = miir(plist('type', 'lowpass')); + update(uobj, ids, sinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/smodel/utp_smodel_addAliases.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/smodel/utp_smodel_addAliases.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,199 @@ +% UTP_SMODEL_ADDALIASES a set of UTPs for the smodel/addAliases method +% +% M Hewitson 06-08-08 +% +% $Id: utp_smodel_addAliases.m,v 1.1 2011/04/11 19:45:22 ingo Exp $ +% + +% +% +% The addAliases method of the smodel class sets the 'aliasNames' and +% 'aliasValues' properties. +% +% + +function results = utp_smodel_addAliases(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + cl = 'smodel'; + mthd = 'addAliases'; + + disp('******************************************************'); + disp(['**** Running UTPs for ' cl '/' mthd]); + disp('******************************************************'); + + % Test objects + s1 = smodel('a1*x1 + a2*x2 + a3*x3'); + s1.setName(); + s1.setAliases('x1', 'b', 'c', 123); + + s2 = smodel('a1*x1 + a2*x2'); + s2.setName(); + + s3 = smodel('a1*x1'); + s3.setName(); + + sv = [s1, s2, s1]; + sm = [s1, s2, s1; s1, s2, s1]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % The setter method have different possibilities to set a property + args1 = {'x1', 123}; % obj.addAliases('x1', 123) + args2 = {'x1', 123, 'x2', 'asd'}; % obj.addAliases('x1', 123, 'x2', 'asd') + args3 = {{'x1', 'x2'}, {'asd', 123}}; % obj.addAliases({'x1', 'x2'}, {'asd', 123}) + args4 = {plist('names', 'x1', 'values', 123)}; % obj.addAliases(plist('names', 'x1', 'values', 123)) + args5 = {plist('names', {'x1', 'x2'}, 'values', {123, 'asd'})}; + + % Run the general tests + results(1) = utp_01(); + results(2) = utp_genericAnyShape(mthd, sv, args1, @algoTests); + results(3) = utp_genericAnyShape(mthd, sv, args2, @algoTests); + results(4) = utp_genericAnyShape(mthd, sv, args3, @algoTests); + results(5) = utp_genericAnyShape(mthd, sv, args4, @algoTests); + results(6) = utp_genericAnyShape(mthd, sv, args5, @algoTests); + results(7) = utp_genericAnyShape(mthd, sm, args2, @algoTests); + results(8) = utp_genericList(mthd, s1, s2, s3, args3, @algoTests); + results(9) = utp_genericHistory(mthd, s1, args2, ple2); + results(10) = utp_genericModify(mthd, s1, args5, @algoTests, ple1); + results(11) = utp_genericOutput(mthd, s1, s2, args2, @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 property have the correct value + function atest = algoTests(in, out, idx, argsin) + atest = true; + % Check that the input and output objects are the same except the + % property 'aliases' and the history + ple = plist('EXCEPTIONS', {'created', 'proctime', 'UUID', 'hist', 'aliasNames', 'aliasValues'}); + 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(argsin{1}, 'plist') && argsin{1}.isparam('names') && argsin{1}.isparam('values') + argsin = argsin{1}; + % The value was set with a plist. + names = cellstr(argsin.find('names')); + values = argsin.find('values'); + if ~iscell(values) + values = num2cell(values); + end + else + if numel(argsin) == 2 && iscell(argsin{1}) && iscell(argsin{2}) + names = argsin{1}; + values = argsin{2}; + else + nArgsin = numel(argsin); + names = argsin(1:2:nArgsin); + values = argsin(2:2:nArgsin); + end + end + + n = in(idx).aliasNames; + v = in(idx).aliasValues; + + for ll = 1:numel(names) + namesIdx = strcmp(n, names{ll}); + if any(namesIdx) + % Change at the index the value + v{namesIdx} = values{ll}; + else + % Append the alias key-value pair + n = [n names(ll)]; + v = [v values(ll)]; + end + end + + % Check 'aliasNames' and 'aliasValues' + if ~isequal(out(idx).aliasNames, n), atest = false; end + if ~isequal(out(idx).aliasValues, v), atest = false; end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = feval('smodel.getInfo', mthd, 'none'); + % Call for all sets + io(2) = feval('smodel.getInfo', mthd); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = feval('smodel.getInfo', mthd, io(2).sets{kk}); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('names'), atest = false; end + if ~io(3).plists.isparam('values'), atest = false; end + % Check default value + if ~isEmptyCell(io(3).plists.find('names')), atest = false; end + if ~isEmptyCell(io(3).plists.find('values')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('names'), {{}}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('values'), {{}}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/smodel/utp_smodel_addParameters.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/smodel/utp_smodel_addParameters.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,233 @@ +% UTP_SMODEL_ADDPARAMETERS a set of UTPs for the smodel/addParameters method +% +% M Hewitson 06-08-08 +% +% $Id: utp_smodel_addParameters.m,v 1.1 2011/04/17 15:47:57 ingo Exp $ +% + +% +% +% The addParameters method of the smodel class sets the 'params' and +% 'values' properties. +% +% + +function results = utp_smodel_addParameters(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + cl = 'smodel'; + mthd = 'addParameters'; + + disp('******************************************************'); + disp(['**** Running UTPs for ' cl '/' mthd]); + disp('******************************************************'); + + % Test objects + s1 = smodel('a*x1 + b*x2 + c*x3'); + s1.setParams('a', 'b', 'c'); + s1.setName(); + + s2 = smodel('a*x1 + c*x2'); + s1.setParams('c'); + s2.setName(); + + s3 = smodel('a*x1'); + s1.setParams('a'); + s3.setName(); + + sv = [s1, s2, s1]; + sm = [s1, s2, s1; s1, s2, s1]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % The setter method have different possibilities to set a property + args1 = {{'a', 'b'}}; + args2 = {'a', 'b', 'c'}; + args3 = {{'a', 'b'}, [1 2]}; + args4 = {{'a', 'b'}, {1 2}}; + args5 = {'b', 1}; + args6 = {'a', 1, 'b', 2, 'c', 3}; + args7 = {plist('params', 'a')}; + args8 = {plist('params', {'a', 'b'})}; + args9 = {plist('params', {'c', 'b'}, 'values', [1 2])}; + args10 = {plist('params', {'a', 'e'}, 'values', {1 2})}; + + % Run the general tests + results(1) = utp_01(); + results(2) = utp_genericAnyShape(mthd, s1, args1, @algoTests); + results(3) = utp_genericAnyShape(mthd, s1, args2, @algoTests); + results(4) = utp_genericAnyShape(mthd, s1, args3, @algoTests); + results(5) = utp_genericAnyShape(mthd, s1, args4, @algoTests); + results(6) = utp_genericAnyShape(mthd, s1, args5, @algoTests); + results(7) = utp_genericAnyShape(mthd, s1, args6, @algoTests); + results(8) = utp_genericAnyShape(mthd, s1, args7, @algoTests); + results(9) = utp_genericAnyShape(mthd, s1, args8, @algoTests); + results(10) = utp_genericAnyShape(mthd, s1, args9, @algoTests); + results(11) = utp_genericAnyShape(mthd, s1, args10,@algoTests); + results(12) = utp_genericAnyShape(mthd, sv, args5, @algoTests); + results(13) = utp_genericAnyShape(mthd,sm, args10,@algoTests); + results(14) = utp_genericList(mthd, s1, s2, s3, args4, @algoTests); + results(15) = utp_genericHistory(mthd, s1, args5, ple2); + results(10) = utp_genericModify(mthd, s1, args5, @algoTests, ple1); + results(11) = utp_genericOutput(mthd, s1, s2, args2, @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 property have the correct value + function atest = algoTests(in, out, idx, argsin) + atest = true; + % Check that the input and output objects are the same except the + % properties 'params', 'values' and the history + ple = plist('EXCEPTIONS', {'created', 'proctime', 'UUID', 'hist', 'params', 'values'}); + 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. + values = {}; + if isa(argsin{1}, 'plist') && argsin{1}.isparam('params') + argsin = argsin{1}; + % The value was set with a plist. + names = cellstr(argsin.find('params')); + values = argsin.find('values'); + if ~iscell(values) + values = num2cell(values); + end + else + if numel(argsin) == 1 && iscell(argsin{1}) + names = argsin{1}; + elseif ~isempty(argsin) && iscellstr(argsin) + names = argsin; + elseif numel(argsin) == 2 && iscell(argsin{1}) && isnumeric(argsin{2}) + names = argsin{1}; + values = num2cell(argsin{2}); + elseif numel(argsin) == 2 && iscell(argsin{1}) && iscell(argsin{2}) + names = argsin{1}; + values = argsin{2}; + else + nArgsin = numel(argsin); + names = argsin(1:2:nArgsin); + values = argsin(2:2:nArgsin); + end + end + + p = in(idx).params; + v = in(idx).values; + + if ~isempty(values) && isempty(v) + v = cell(size(p)); + end + + for ll = 1:numel(names) + namesIdx = strcmp(p, names{ll}); + if any(namesIdx) + % Change at the index the value + if ~isempty(values) + v{namesIdx} = values{ll}; + end + else + % Append the alias key-value pair + p = [p names(ll)]; + if ~isempty(values) + v = [v values(ll)]; + end + end + end + + % Check 'params' and 'values' + if ~isequal(out(idx).params, p), atest = false; end + if ~isequal(out(idx).values, v), atest = false; end + + % Check the numbe of values + if ~isempty(out(idx).values) + if numel(out(idx).values) ~= numel(out(idx).params), atest = false; end + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = feval('smodel.getInfo', mthd, 'none'); + % Call for all sets + io(2) = feval('smodel.getInfo', mthd); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = feval('smodel.getInfo', mthd, io(2).sets{kk}); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('params'), atest = false; end + if ~io(3).plists.isparam('values'), atest = false; end + % Check default value + if ~isEmptyCell(io(3).plists.find('params')), atest = false; end + if ~isEmptyCell(io(3).plists.find('values')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('params'), {{}}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('values'), {{}}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/smodel/utp_smodel_clearAliases.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/smodel/utp_smodel_clearAliases.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,150 @@ +% UTP_SMODEL_CLEARALIASES a set of UTPs for the smodel/clearAliases method +% +% M Hewitson 06-08-08 +% +% $Id: utp_smodel_clearAliases.m,v 1.1 2011/04/11 19:45:22 ingo Exp $ +% + +% +% +% The clearAliases method of the smodel class clears the 'aliasNames' and +% 'aliasValues' properties. +% +% + +function results = utp_smodel_clearAliases(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + cl = 'smodel'; + mthd = 'clearAliases'; + + disp('******************************************************'); + disp(['**** Running UTPs for ' cl '/' mthd]); + disp('******************************************************'); + + % Test objects + s1 = smodel('a1*x1 + a2*x2 + a3*x3'); + s1.setName(); + + s2 = smodel('a1*x1 + a2*x2'); + s2.setName(); + + s3 = smodel('a1*x1'); + s3.setName(); + + sv = [s1, s2, s1]; + sm = [s1, s2, s1; s1, s2, s1]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % The setter method have different possibilities to set a property + + % Run the general tests + results(1) = utp_01(); + results(2) = utp_genericAnyShape(mthd, s1, {}, @algoTests); + results(3) = utp_genericAnyShape(mthd, sv, {}, @algoTests); + results(4) = utp_genericAnyShape(mthd, sm, {}, @algoTests); + results(5) = utp_genericList(mthd, s1, s2, s3, {}, @algoTests); + results(6) = utp_genericHistory(mthd, s1, {}, ple2); + results(7) = utp_genericModify(mthd, s1, {}, @algoTests, ple1); + results(8) = utp_genericOutput(mthd, s1, s2, {}, @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 property have the correct value + function atest = algoTests(in, out, idx, argsin) + atest = true; + % Check that the input and output objects are the same except the + % property 'aliases' and the history + ple = plist('EXCEPTIONS', {'created', 'proctime', 'UUID', 'hist', 'aliasNames', 'aliasValues'}); + if ~eq(in(idx), out(idx), ple), atest = false; end + if ~eq(in(idx).hist, out(idx).hist.inhists), atest = false; end + + % Check 'aliasNames' and 'aliasValues' + if ~isequal(out(idx).aliasNames, {}), atest = false; end + if ~isequal(out(idx).aliasValues, {}), atest = false; end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = feval('smodel.getInfo', mthd, 'none'); + % Call for all sets + io(2) = feval('smodel.getInfo', mthd); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = feval('smodel.getInfo', mthd, io(2).sets{kk}); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/smodel/utp_smodel_copy.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/smodel/utp_smodel_copy.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,50 @@ +% UTP_SMODEL_COPY a set of UTPs for the smodel/copy method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_copy.m,v 1.3 2009/08/08 12:21:40 hewitson Exp $ +% + +% +% +% The copy method of the smodel class copies the input object depending of the +% second input. +% +% + +function results = utp_smodel_copy(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'smodel'; + mthd = 'copy'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_69(class, 1, 1, ple2)]; + results = [results utp_69(class, 1, 3, ple2)]; + results = [results utp_69(class, 2, 3, ple2)]; + + 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 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/smodel/utp_smodel_loadobj.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/smodel/utp_smodel_loadobj.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,153 @@ +% UTP_SMODEL_LOADOBJ a set of UTPs for the smodel/loadobj method +% +% M Hewitson 06-08-08 +% +% $Id: utp_smodel_loadobj.m,v 1.1 2010/05/12 15:58:16 ingo Exp $ +% + +% +% +% The loadobj method of the smodel class will be automatically called by +% MATLAB if an older object is not compatible with the current object structure. +% This happens only for objects which are stored as a MATLAB formatted +% (MAT-file). The load mechanism for XML formated files calls always the +% 'update_struct' method to keep the stored objects up to date. The +% 'update_struct' method convert the read object structure to the object +% structure which is used in the currend LTPDA version. +% This UTP will load old objects which are stored with an older LTPDA version. +% +% REMARK: Since LTPDA version 1.9.2 will be an object which should be saved as a +% MAT file stored as a struct and not as the object. +% +% + +function results = utp_smodel_loadobj(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'smodel'; + mthd = 'loadobj'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Run the tests + results = [results utp_01]; % getInfo call + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Get all .MAT and .XML files + path = fullfile(fileparts(which(mfilename)), '..', '..', 'utp_test_files'); + + matfiles = utils.prog.filescan(path, '.mat'); + xmlfiles = utils.prog.filescan(path, '.xml'); + + % Load .MAT files + obj_no = 1; + for ii=1:numel(matfiles) + fn = matfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = smodel(fn); + obj_no = obj_no+1; + end + end + + % Load .XML files + for ii=1:numel(xmlfiles) + fn = xmlfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = smodel(fn); + obj_no = obj_no+1; + end + end + % + stest = true; + catch err + disp(objs(obj_no).fname) + disp(fn) + disp(err.message) + stest = false; + end + + % + % + % 1) Check the shape of the loaded objects. + % + % + + atest = true; + if stest + % + for ii = 1:numel(objs) + obj = objs(ii).obj; + fname = objs(ii).fname; + + if ~isempty(strfind(fname, '_vec')) + % Loaded object must be a vector + if ~isvector(obj), atest = false; end + elseif ~isempty(strfind(fname, '_mat')) + % Loaded object must be a matrix + % REMARK: Known error in LTPDA version 1.9.2 + % A saved matrix doesn't keep the shape of the matrix. + if isempty(strfind(fname, '_192')) + if ~(size(obj,1) > 1 && size(obj,2) > 1), atest = false; end + end + else + % Loaded object must be a single object + if ~(size(obj,1) == 1 && size(obj,2) == 1), + atest = false; end + end + + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/smodel/utp_smodel_setAliases.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/smodel/utp_smodel_setAliases.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,183 @@ +% UTP_SMODEL_SETALIASES a set of UTPs for the smodel/setAliases method +% +% M Hewitson 06-08-08 +% +% $Id: utp_smodel_setAliases.m,v 1.1 2011/04/11 19:45:22 ingo Exp $ +% + +% +% +% The setAliases method of the smodel class sets the 'aliasNames' and +% 'aliasValues' properties. +% +% + +function results = utp_smodel_setAliases(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + cl = 'smodel'; + mthd = 'setAliases'; + + disp('******************************************************'); + disp(['**** Running UTPs for ' cl '/' mthd]); + disp('******************************************************'); + + % Test objects + s1 = smodel('a1*x1 + a2*x2 + a3*x3'); + s1.setName(); + + s2 = smodel('a1*x1 + a2*x2'); + s2.setName(); + + s3 = smodel('a1*x1'); + s3.setName(); + + sv = [s1, s2, s1]; + sm = [s1, s2, s1; s1, s2, s1]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % The setter method have different possibilities to set a property + args1 = {'x1', 123}; % obj.setAliases('x1', 123) + args2 = {'x1', 123, 'x2', 'asd'}; % obj.setAliases('x1', 123, 'x2', 'asd') + args3 = {{'x1', 'x2'}, {'asd', 123}}; % obj.setAliases({'x1', 'x2'}, {'asd', 123}) + args4 = {plist('names', 'x1', 'values', 123)}; % obj.setAliases(plist('names', 'x1', 'values', 123)) + args5 = {plist('names', {'x1', 'x2'}, 'values', {123, 'asd'})}; + + % Run the general tests + results(1) = utp_01(); + results(2) = utp_genericAnyShape(mthd, sv, args1, @algoTests); + results(3) = utp_genericAnyShape(mthd, sv, args2, @algoTests); + results(4) = utp_genericAnyShape(mthd, sv, args3, @algoTests); + results(5) = utp_genericAnyShape(mthd, sv, args4, @algoTests); + results(6) = utp_genericAnyShape(mthd, sv, args5, @algoTests); + results(7) = utp_genericAnyShape(mthd, sm, args2, @algoTests); + results(8) = utp_genericList(mthd, s1, s2, s3, args3, @algoTests); + results(9) = utp_genericHistory(mthd, s1, args2, ple2); + results(10) = utp_genericModify(mthd, s1, args5, @algoTests, ple1); + results(11) = utp_genericOutput(mthd, s1, s2, args2, @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 property have the correct value + function atest = algoTests(in, out, idx, argsin) + atest = true; + % Check that the input and output objects are the same except the + % property 'aliases' and the history + ple = plist('EXCEPTIONS', {'created', 'proctime', 'UUID', 'hist', 'aliasNames', 'aliasValues'}); + 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(argsin{1}, 'plist') && argsin{1}.isparam('names') && argsin{1}.isparam('values') + argsin = argsin{1}; + % The value was set with a plist. + names = cellstr(argsin.find('names')); + values = argsin.find('values'); + if ~iscell(values) + values = num2cell(values); + end + else + if numel(argsin) == 2 && iscell(argsin{1}) && iscell(argsin{2}) + names = argsin{1}; + values = argsin{2}; + else + nArgsin = numel(argsin); + names = argsin(1:2:nArgsin); + values = argsin(2:2:nArgsin); + end + end + + % Check 'aliasNames' and 'aliasValues' + if ~isequal(out(idx).aliasNames, names), atest = false; end + if ~isequal(out(idx).aliasValues, values), atest = false; end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = feval('smodel.getInfo', mthd, 'none'); + % Call for all sets + io(2) = feval('smodel.getInfo', mthd); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = feval('smodel.getInfo', mthd, io(2).sets{kk}); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('names'), atest = false; end + if ~io(3).plists.isparam('values'), atest = false; end + % Check default value + if ~isEmptyCell(io(3).plists.find('names')), atest = false; end + if ~isEmptyCell(io(3).plists.find('values')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('names'), {{}}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('values'), {{}}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/smodel/utp_smodel_setParameters.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/smodel/utp_smodel_setParameters.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,212 @@ +% UTP_SMODEL_SETPARAMETERS a set of UTPs for the smodel/setParameters method +% +% M Hewitson 06-08-08 +% +% $Id: utp_smodel_setParameters.m,v 1.1 2011/04/17 15:47:57 ingo Exp $ +% + +% +% +% The setParameters method of the smodel class sets the 'params' and +% 'values' properties. +% +% + +function results = utp_smodel_setParameters(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + cl = 'smodel'; + mthd = 'setParameters'; + + disp('******************************************************'); + disp(['**** Running UTPs for ' cl '/' mthd]); + disp('******************************************************'); + + % Test objects + s1 = smodel('a*x1 + b*x2 + c*x3'); + s1.setParams('a', 'b', 'c'); + s1.setName(); + + s2 = smodel('a*x1 + c*x2'); + s1.setParams('c'); + s2.setName(); + + s3 = smodel('a*x1'); + s1.setParams('a'); + s3.setName(); + + sv = [s1, s2, s1]; + sm = [s1, s2, s1; s1, s2, s1]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % The setter method have different possibilities to set a property + args1 = {{'a', 'b'}}; + args2 = {'a', 'b', 'c'}; + args3 = {{'a', 'b'}, [1 2]}; + args4 = {{'a', 'b'}, {1 2}}; + args5 = {'b', 1}; + args6 = {'a', 1, 'b', 2, 'c', 3}; + args7 = {plist('params', 'a')}; + args8 = {plist('params', {'a', 'b'})}; + args9 = {plist('params', {'c', 'b'}, 'values', [1 2])}; + args10 = {plist('params', {'a', 'e'}, 'values', {1 2})}; + + % Run the general tests + results(1) = utp_01(); + results(2) = utp_genericAnyShape(mthd, s1, args1, @algoTests); + results(3) = utp_genericAnyShape(mthd, s1, args2, @algoTests); + results(4) = utp_genericAnyShape(mthd, s1, args3, @algoTests); + results(5) = utp_genericAnyShape(mthd, s1, args4, @algoTests); + results(6) = utp_genericAnyShape(mthd, s1, args5, @algoTests); + results(7) = utp_genericAnyShape(mthd, s1, args6, @algoTests); + results(8) = utp_genericAnyShape(mthd, s1, args7, @algoTests); + results(9) = utp_genericAnyShape(mthd, s1, args8, @algoTests); + results(10) = utp_genericAnyShape(mthd, s1, args9, @algoTests); + results(11) = utp_genericAnyShape(mthd, s1, args10,@algoTests); + results(12) = utp_genericAnyShape(mthd, sv, args5, @algoTests); + results(13) = utp_genericAnyShape(mthd,sm, args10,@algoTests); + results(14) = utp_genericList(mthd, s1, s2, s3, args4, @algoTests); + results(15) = utp_genericHistory(mthd, s1, args5, ple2); + results(10) = utp_genericModify(mthd, s1, args5, @algoTests, ple1); + results(11) = utp_genericOutput(mthd, s1, s2, args2, @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 property have the correct value + function atest = algoTests(in, out, idx, argsin) + atest = true; + % Check that the input and output objects are the same except the + % properties 'params', 'values' and the history + ple = plist('EXCEPTIONS', {'created', 'proctime', 'UUID', 'hist', 'params', 'values'}); + 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. + values = {}; + if isa(argsin{1}, 'plist') && argsin{1}.isparam('params') + argsin = argsin{1}; + % The value was set with a plist. + names = cellstr(argsin.find('params')); + if argsin.isparam('values') + values = argsin.find('values'); + if isnumeric(values) + values = num2cell(values); + end + end + else + if numel(argsin) == 1 && iscell(argsin{1}) + names = argsin{1}; + elseif ~isempty(argsin) && iscellstr(argsin) + names = argsin; + elseif numel(argsin) == 2 && iscell(argsin{1}) && isnumeric(argsin{2}) + names = argsin{1}; + values = num2cell(argsin{2}); + elseif numel(argsin) == 2 && iscell(argsin{1}) && iscell(argsin{2}) + names = argsin{1}; + values = argsin{2}; + else + nArgsin = numel(argsin); + names = argsin(1:2:nArgsin); + values = argsin(2:2:nArgsin); + end + end + + % Check 'params' and 'values' + if ~isequal(out(idx).params, names), atest = false; end + if ~isequal(out(idx).values, values), atest = false; end + + % Check the numbe of values + if ~isempty(out(idx).values) + if numel(out(idx).values) ~= numel(out(idx).params), atest = false; end + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = feval('smodel.getInfo', mthd, 'none'); + % Call for all sets + io(2) = feval('smodel.getInfo', mthd); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = feval('smodel.getInfo', mthd, io(2).sets{kk}); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('params'), atest = false; end + if ~io(3).plists.isparam('values'), atest = false; end + % Check default value + if ~isEmptyCell(io(3).plists.find('params')), atest = false; end + if ~isEmptyCell(io(3).plists.find('values')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('params'), {{}}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('values'), {{}}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/smodel/utp_smodel_setParams.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/smodel/utp_smodel_setParams.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,235 @@ +% UTP_SMODEL_SETPARAMS a set of UTPs for the smodel/setParams method +% +% M Hewitson 06-08-08 +% +% $Id: utp_smodel_setParams.m,v 1.2 2011/05/10 04:53:37 mauro Exp $ +% + +% +% +% The setParams method of the smodel class sets the 'params' property and +% in some cases also the 'values' property +% +% + +function results = utp_smodel_setParams(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + cl = 'smodel'; + mthd = 'setParams'; + + disp('******************************************************'); + disp(['**** Running UTPs for ' cl '/' mthd]); + disp('******************************************************'); + + s0 = smodel(); + + s1 = smodel('a*x1 + b*x2 + c*x3'); + s1.setParams({'a', 'b'}); + s1.setName(); + + s2 = smodel('a*x1 + b*x2 + c*x3'); + s2.setParams({'a', 'b'}, [1 2]); + s2.setName(); + + s3 = smodel('a*x1 + b*x2 + c*x3'); + s3.setParams({'a', 'b'}, [1 2]); + s3.setName(); + + sv = [s1, s2, s1]; + sm = [s1, s2, s1; s1, s2, s1]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % The setter method have different possibilities to set a property + args1 = {{'a', 'b'}}; % obj.setParams({'a', 'b'}) + args2 = {{'a', 'b'}, [1 2]}; % obj.setParams({'a', 'b'}, [1 2]) + args3 = {{'a', 'b'}, {1 2}}; % obj.setParams({'a', 'b'}, {1 2}) + args4 = {'a', 3}; % obj.setParams('a', 3) + args5 = {'a1', 'a4'}; % obj.setParams('a1', 'a4') + args6 = {plist('params', 'a')}; + args7 = {plist('params', {'a', 'b'})}; + args8 = {plist('params', 'a', 'values', 1)}; + args9 = {plist('params', {'a', 'b'}, 'values', [1 2])}; + + % Run the general tests + results(1) = utp_01(); + results(2) = utp_genericAnyShape(mthd, s0, args1, @algoTests); + results(3) = utp_genericAnyShape(mthd, s0, args2, @algoTests); + results(4) = utp_genericAnyShape(mthd, s1, args3, @algoTests); + results(5) = utp_genericAnyShape(mthd, s2, args4, @algoTests); + results(6) = utp_genericAnyShape(mthd, s3, args5, @algoTests); + results(7) = utp_genericAnyShape(mthd, s0, args6, @algoTests); + results(8) = utp_genericAnyShape(mthd, s0, args7, @algoTests); + results(9) = utp_genericAnyShape(mthd, s1, args8, @algoTests); + results(10) = utp_genericAnyShape(mthd, s1, args9, @algoTests); + results(11) = utp_genericAnyShape(mthd, sv, args3, @algoTests); + results(12) = utp_genericAnyShape(mthd, sm, args8, @algoTests); + results(13) = utp_genericList(mthd, s1, s2, s3, args7, @algoTests); + results(14) = utp_genericHistory(mthd, s1, args2, ple2); + results(15) = utp_genericModify(mthd, s1, args5, @algoTests, ple1); + results(16) = utp_genericOutput(mthd, s1, s2, args2, @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 property have the correct value + function atest = algoTests(in, out, idx, argsin) + atest = true; + % Check that the input and output objects are the same except the + % property 'params' and the history + ple = plist('EXCEPTIONS', {'created', 'proctime', 'UUID', 'hist', 'params', 'values'}); + 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. + values = {}; + if isa(argsin{1}, 'plist') && argsin{1}.isparam('params') + argsin = argsin{1}; + % The value was set with a plist. + params = cellstr(argsin.find('params')); + if argsin.isparam('values') + values = argsin.find('values'); + end + elseif numel(argsin) == 1 && iscell(argsin{1}) + params = argsin{1}; + elseif numel(argsin) == 2 && iscell(argsin{1}) && ( iscell(argsin{2}) || isnumeric(argsin{2})) + params = argsin{1}; + if iscell(argsin{2}) + values = argsin{2}; + else + values = argsin{2}; + end + elseif numel(argsin) == 2 && ischar(argsin{1}) && isnumeric(argsin{2}) + params = argsin(1); + values = argsin(2); + elseif iscellstr(argsin) + params = argsin; + end + + if isnumeric(values) + values = num2cell(values); + end + + p = in(idx).params; + v = in(idx).values; + + if ~isempty(values) && isempty(v) + v = cell(size(p)); + end + + for ll = 1:numel(params) + paramsIdx = strcmp(p, params{ll}); + if any(paramsIdx) + if ~isempty(values) + v{paramsIdx} = values{ll}; + end + else + % Append the alias key-value pair + p = [p params(ll)]; + if ~isempty(values) + v = [v values(ll)]; + elseif ~isempty(v) + v = [v cell(1)]; + end + end + end + + % Check 'params' and 'values' + if ~isequal(out(idx).params, p), atest = false; end + if ~isequal(out(idx).values, v), atest = false; end + + % Check if we have specified some values that the number of values ans + % params are the same + if ~isempty(values) + if numel(out(idx).params) ~= numel(out(idx).values), atest = false; end + end + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = feval('smodel.getInfo', mthd, 'none'); + % Call for all sets + io(2) = feval('smodel.getInfo', mthd); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = feval('smodel.getInfo', mthd, io(2).sets{kk}); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('params'), atest = false; end + if ~io(3).plists.isparam('values'), atest = false; end + % Check default value + if ~isEmptyCell(io(3).plists.find('params')), atest = false; end + if ~isEmptyCell(io(3).plists.find('values')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('params'), {{}}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('values'), {{}}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/smodel/utp_smodel_setTrans.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/smodel/utp_smodel_setTrans.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,129 @@ +% UTP_SMODEL_SETTRANS a set of UTPs for the smodel/setTrans method +% +% M Hewitson 06-08-08 +% +% $Id: utp_smodel_setTrans.m,v 1.3 2011/04/11 19:45:45 ingo Exp $ +% + +% +% +% The setTrans method of the smodel class sets the trans property. +% +% + +function results = utp_smodel_setTrans(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + cl = 'smodel'; + mthd = 'setTrans'; + prop = 'trans'; + + disp('******************************************************'); + disp(['**** Running UTPs for ' cl '/' mthd]); + disp('******************************************************'); + + % Test objects + s1 = smodel('a1*x1 + a2*x2 + a3*x3'); + s1.setName(); + + s2 = smodel('a1*x1 + a2*x2'); + s2.setName(); + + s3 = smodel('a1*x1'); + s3.setName(); + + sv = [s1, s2, s1]; + sm = [s1, s2, s1; s1, s2, s1]; + + % 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 = 'x1'; % obj.setTrans(val1) + val2 = {'x2', 'x3'}; % obj.setTrans(val2) + val3 = plist(prop, 'x4'); % obj.setTrans(plist('trans', 'm') + val4 = {val1, val2, val3}; % obj.setTrans(val1, val2, val3) + val5 = {{val1, val2, val3}}; % obj.setTrans({val1, val2, val3}) + val6 = {{val1, val2, val3}, val1, val2}; % obj.setTrans({val1, val2, val3}, val1, val2) + + % Run the general tests + results(1) = utp_genericSet_minfo(mthd, s1, prop, @algoTests_minfo); + results(2) = utp_genericAnyShape(mthd, sv, val1, @algoTests); + results(3) = utp_genericAnyShape(mthd, sv, val2, @algoTests); + results(4) = utp_genericAnyShape(mthd, sv, val3, @algoTests); + results(5) = utp_genericAnyShape(mthd, sv, val4, @algoTests); + results(6) = utp_genericAnyShape(mthd, sv, val5, @algoTests); + results(7) = utp_genericAnyShape(mthd, sv, val6, @algoTests); + results(8) = utp_genericAnyShape(mthd, sm, val6, @algoTests); + results(9) = utp_genericList(mthd, s1, s2, s3, val1, @algoTests); + results(10) = utp_genericList(mthd, s1, sv, s3, val3, @algoTests); + results(11) = utp_genericHistory(mthd, s1, val1, ple2); + results(12) = utp_genericModify(mthd, s1, val5, @algoTests, ple1); % test the modifier call + results(13) = utp_genericOutput(mthd, s1, s2, val6, @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 'Trans' + if ~isequal(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 'Trans' 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. + values = processValues([], value.find(prop)); + if ~isequal(out(idx).(prop), values), atest = false; end + else + values = processValues([], value); + if ~isequal(out(idx).(prop), values), atest = false; end + end + end + + function values = processValues(values, val) + switch class(val) + case 'cell' + if iscellstr(val) + values = [values val]; + else + for ii=1:numel(val); + values = processValues(values, val{ii}); + end + end + case 'double' + values = [values {num2str(val)}]; + case 'char' + values = [values {val}]; + case 'plist' + if length(val) == 1 && isa(val, 'plist') && isparam(val, prop) + vals = find(val, prop); + values = processValues(values, vals); + end + otherwise + end + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/smodel/utp_smodel_setValues.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/smodel/utp_smodel_setValues.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,127 @@ +% UTP_SMODEL_SETVALUES a set of UTPs for the smodel/setValues method +% +% M Hewitson 06-08-08 +% +% $Id: utp_smodel_setValues.m,v 1.1 2011/04/06 19:15:48 ingo Exp $ +% + +% +% +% The setValues method of the smodel class sets the values property. +% +% + +function results = utp_smodel_setValues(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + cl = 'smodel'; + mthd = 'setValues'; + prop = 'values'; + + disp('******************************************************'); + disp(['**** Running UTPs for ' cl '/' mthd]); + disp('******************************************************'); + + % Test objects + s1 = smodel('a1*x1 + a2*x2 + a3*x3'); + s1.setParams({'a1', 'a2', 'a3'}); + s1.setName(); + + s2 = smodel('a1*x1 + a2*x2'); + s2.setParams({'a1', 'a2'}); + s2.setName(); + + s3 = smodel('a1*x1'); + s3.setParams('a1'); + s3.setName(); + + sv = [s1, s2, s1]; + sm = [s1, s2, s1; s1, s2, s1]; + + % 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 = 111; % obj.setValues(val1) + val2 = [11 22]; % obj.setValues(val2) + val3 = [1 2 3]; % obj.setValues(val3) + val4 = plist(prop, val1); % obj.setValues(plist('values', val1) + + % Run the general tests + results(1) = utp_genericSet_minfo(mthd, s1, prop, @algoTests_minfo); + results(2) = utp_genericAnyShape(mthd, sv, val2, @algoTests); + results(3) = utp_genericAnyShape(mthd, sm, val2, @algoTests); + results(4) = utp_genericList(mthd, s1, s2, s3, val1, @algoTests); + results(5) = utp_genericList(mthd, s1, sv, s3, val3, @algoTests); + results(6) = utp_genericHistory(mthd, s1, val3, ple2); + results(7) = utp_genericModify(mthd, s1, val3, @algoTests, ple1); + results(8) = utp_genericOutput(mthd, s2, s2, val2, @algoTests, ple2); + + 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 'values' + if ~isequal(defVal, {}), atest = false; end + end + + % Check that the property have the correct value + function atest = algoTests(in, out, idx, varargin) + atest = true; + value = varargin; + % Check that the input and output objects are the same except the + % property 'values' and the history + ple = plist('EXCEPTIONS', {'created', 'proctime', 'UUID', 'hist', prop}); + if numel(value{1}) == numel(in(idx).params) + 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{1}, 'plist') && value{1}.nparams == 1 && value{1}.isparam(prop) + % The value was set with a plist. + values = processValues([], value{1}.find(prop)); + if ~isequal(out(idx).(prop), values), atest = false; end + else + if iscell(value{1}), value = value{1}; end + if numel(value) == numel(out) + if ~isequal(out(idx).(prop), num2cell(value{idx})), atest = false; end + else + if ~isequal(out(idx).(prop), num2cell(value{1})), atest = false; end + end + end + end + end + + function values = processValues(values, val) + switch class(val) + case 'char' + values = [values unit(val)]; + case 'unit' + values = [values reshape(val, 1, [])]; + case 'cell' + for ii=1:numel(val) + values = processValues(values, val{ii}); + end + case 'plist' + if length(val) == 1 && isa(val, 'plist') && isparam(val, prop) + vals = find(val, prop); + values = processValues(values, vals); + end + end + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/smodel/utp_smodel_setXunits.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/smodel/utp_smodel_setXunits.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,124 @@ +% UTP_SMODEL_SETXUNITS a set of UTPs for the smodel/setXunits method +% +% M Hewitson 06-08-08 +% +% $Id: utp_smodel_setXunits.m,v 1.2 2011/04/06 19:15:34 ingo Exp $ +% + +% +% +% The setXunits method of the smodel class sets the xunits property. +% +% + +function results = utp_smodel_setXunits(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + cl = 'smodel'; + mthd = 'setXunits'; + prop = 'xunits'; + + disp('******************************************************'); + disp(['**** Running UTPs for ' cl '/' mthd]); + disp('******************************************************'); + + % Test objects + s1 = smodel('a1*x1 + a2*x2 + a3*x3'); + s1.setName(); + + s2 = smodel('a1*x1 + a2*x2'); + s2.setName(); + + s3 = smodel('a1*x1'); + s3.setName(); + + sv = [s1, s2, s1]; + sm = [s1, s2, s1; s1, s2, s1]; + + % 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'; % obj.setXunits(val1) + val2 = unit('s'); % obj.setXunits(val2) + val3 = plist(prop, 'm'); % obj.setXunits(plist('xunits', 'm') + val4 = {val1, val2, val3}; % obj.setXunits(val1, val2, val3) + val5 = {{val1, val2, val3}}; % obj.setXunits({val1, val2, val3}) + val6 = {{val1, val2, val3}, val1, val2}; % obj.setXunits({val1, val2, val3}, val1, val2) + + % Run the general tests + results(1) = utp_genericSet_minfo(mthd, s1, prop, @algoTests_minfo); + results(2) = utp_genericAnyShape(mthd, sv, val1, @algoTests); + results(3) = utp_genericAnyShape(mthd, sv, val2, @algoTests); + results(4) = utp_genericAnyShape(mthd, sv, val3, @algoTests); + results(5) = utp_genericAnyShape(mthd, sv, val4, @algoTests); + results(6) = utp_genericAnyShape(mthd, sv, val5, @algoTests); + results(7) = utp_genericAnyShape(mthd, sv, val6, @algoTests); + results(8) = utp_genericAnyShape(mthd, sm, val6, @algoTests); + results(9) = utp_genericList(mthd, s1, s2, s3, val1, @algoTests); + results(10) = utp_genericList(mthd, s1, sv, s3, val3, @algoTests); + results(11) = utp_genericHistory(mthd, s1, val1, ple2); + results(12) = utp_genericModify(mthd, s1, val5, @algoTests, ple1); % test the modifier call + results(13) = utp_genericOutput(mthd, s1, s2, val6, @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 'xunits' + 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 'xunits' 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. + values = processValues([], value.find(prop)); + if ~isequal(out(idx).(prop), values), atest = false; end + else + values = processValues([], value); + if ~isequal(out(idx).(prop), values), atest = false; end + end + end + + function values = processValues(values, val) + switch class(val) + case 'char' + values = [values unit(val)]; + case 'unit' + values = [values reshape(val, 1, [])]; + case 'cell' + for ii=1:numel(val) + values = processValues(values, val{ii}); + end + case 'plist' + if length(val) == 1 && isa(val, 'plist') && isparam(val, prop) + vals = find(val, prop); + values = processValues(values, vals); + end + end + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/smodel/utp_smodel_setXvals.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/smodel/utp_smodel_setXvals.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,128 @@ +% UTP_SMODEL_SETXVALS a set of UTPs for the smodel/setXvals method +% +% M Hewitson 06-08-08 +% +% $Id: utp_smodel_setXvals.m,v 1.3 2011/04/11 19:45:45 ingo Exp $ +% + +% +% +% The setXvals method of the smodel class sets the Xvals property. +% +% + +function results = utp_smodel_setXvals(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + cl = 'smodel'; + mthd = 'setXvals'; + prop = 'xvals'; + + disp('******************************************************'); + disp(['**** Running UTPs for ' cl '/' mthd]); + disp('******************************************************'); + + % Test objects + s1 = smodel('a1*x1 + a2*x2 + a3*x3'); + s1.setName(); + + s2 = smodel('a1*x1 + a2*x2'); + s2.setName(); + + s3 = smodel('a1*x1'); + s3.setName(); + + sv = [s1, s2, s1]; + sm = [s1, s2, s1; s1, s2, s1]; + + % 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 = 1:1e3; % obj.setXvals(val1) + val2 = ao(1:1e3,randn(1e3,1)); % obj.setXvals(val2) + val3 = plist(prop, 1:2:2e3); % obj.setXvals(plist('Xvals', 'm') + val4 = {val1, val2, val3}; % obj.setXvals(val1, val2, val3) + val5 = {{val1, val2, val3}}; % obj.setXvals({val1, val2, val3}) + val6 = {{val1, val2, val3}, val1, val2}; % obj.setXvals({val1, val2, val3}, val1, val2) + + % Run the general tests + results(1) = utp_genericSet_minfo(mthd, s1, prop, @algoTests_minfo); + results(2) = utp_genericAnyShape(mthd, sv, val1, @algoTests); + results(3) = utp_genericAnyShape(mthd, sv, val2, @algoTests); + results(4) = utp_genericAnyShape(mthd, sv, val3, @algoTests); + results(5) = utp_genericAnyShape(mthd, sv, val4, @algoTests); + results(6) = utp_genericAnyShape(mthd, sv, val5, @algoTests); + results(7) = utp_genericAnyShape(mthd, sv, val6, @algoTests); + results(8) = utp_genericAnyShape(mthd, sm, val6, @algoTests); + results(9) = utp_genericList(mthd, s1, s2, s3, val1, @algoTests); + results(10) = utp_genericList(mthd, s1, sv, s3, val3, @algoTests); + results(11) = utp_genericHistory(mthd, s1, val1, ple2); + results(12) = utp_genericModify(mthd, s1, val5, @algoTests, ple1); % test the modifier call + results(13) = utp_genericOutput(mthd, s1, s2, val6, @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 'Xvals' + if ~isequal(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 'Xvals' 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(1)), 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. + values = processValues([], value.find(prop)); + if ~isequal(out(idx).(prop), values), atest = false; end + else + values = processValues([], value); + if ~isequal(out(idx).(prop), values), atest = false; end + end + end + + function values = processValues(values, val) + switch class(val) + case 'cell' + for ii=1:numel(val); + values = processValues(values, val{ii}); + end + case 'double' + values = [values {val}]; + case 'ao' + ax = 'y'; % Special case: Only check the 'y'-axis + for ii=1:numel(val) + values = [values {val(ii).(ax)}]; + end + case 'plist' + if length(val) == 1 && isa(val, 'plist') && isparam(val, prop) + vals = find(val, prop); + values = processValues(values, vals); + end + otherwise + end + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/smodel/utp_smodel_setXvar.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/smodel/utp_smodel_setXvar.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,129 @@ +% UTP_SMODEL_SETXVAR a set of UTPs for the smodel/setXvar method +% +% M Hewitson 06-08-08 +% +% $Id: utp_smodel_setXvar.m,v 1.3 2011/04/11 19:45:45 ingo Exp $ +% + +% +% +% The setXvar method of the smodel class sets the xvar property. +% +% + +function results = utp_smodel_setXvar(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + cl = 'smodel'; + mthd = 'setXvar'; + prop = 'xvar'; + + disp('******************************************************'); + disp(['**** Running UTPs for ' cl '/' mthd]); + disp('******************************************************'); + + % Test objects + s1 = smodel('a1*x1 + a2*x2 + a3*x3'); + s1.setName(); + + s2 = smodel('a1*x1 + a2*x2'); + s2.setName(); + + s3 = smodel('a1*x1'); + s3.setName(); + + sv = [s1, s2, s1]; + sm = [s1, s2, s1; s1, s2, s1]; + + % 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 = 'x1'; % obj.setXvar(val1) + val2 = {'x2', 'x3'}; % obj.setXvar(val2) + val3 = plist(prop, 'x4'); % obj.setXvar(plist('Xvar', 'm') + val4 = {val1, val2, val3}; % obj.setXvar(val1, val2, val3) + val5 = {{val1, val2, val3}}; % obj.setXvar({val1, val2, val3}) + val6 = {{val1, val2, val3}, val1, val2}; % obj.setXvar({val1, val2, val3}, val1, val2) + + % Run the general tests + results(1) = utp_genericSet_minfo(mthd, s1, prop, @algoTests_minfo); + results(2) = utp_genericAnyShape(mthd, sv, val1, @algoTests); + results(3) = utp_genericAnyShape(mthd, sv, val2, @algoTests); + results(4) = utp_genericAnyShape(mthd, sv, val3, @algoTests); + results(5) = utp_genericAnyShape(mthd, sv, val4, @algoTests); + results(6) = utp_genericAnyShape(mthd, sv, val5, @algoTests); + results(7) = utp_genericAnyShape(mthd, sv, val6, @algoTests); + results(8) = utp_genericAnyShape(mthd, sm, val6, @algoTests); + results(9) = utp_genericList(mthd, s1, s2, s3, val1, @algoTests); + results(10) = utp_genericList(mthd, s1, sv, s3, val3, @algoTests); + results(11) = utp_genericHistory(mthd, s1, val1, ple2); + results(12) = utp_genericModify(mthd, s1, val5, @algoTests, ple1); % test the modifier call + results(13) = utp_genericOutput(mthd, s1, s2, val6, @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 'Xvar' + if ~isequal(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 'Xvar' 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. + values = processValues([], value.find(prop)); + if ~isequal(out(idx).(prop), values), atest = false; end + else + values = processValues([], value); + if ~isequal(out(idx).(prop), values), atest = false; end + end + end + + function values = processValues(values, val) + switch class(val) + case 'cell' + if iscellstr(val) + values = [values val]; + else + for ii=1:numel(val); + values = processValues(values, val{ii}); + end + end + case 'double' + values = [values {num2str(val)}]; + case 'char' + values = [values {val}]; + case 'plist' + if length(val) == 1 && isa(val, 'plist') && isparam(val, prop) + vals = find(val, prop); + values = processValues(values, vals); + end + otherwise + end + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/smodel/utp_smodel_setYunits.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/smodel/utp_smodel_setYunits.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,125 @@ +% UTP_SMODEL_SETYUNITS a set of UTPs for the smodel/setYunits method +% +% M Hewitson 06-08-08 +% +% $Id: utp_smodel_setYunits.m,v 1.1 2011/04/06 19:15:48 ingo Exp $ +% + +% +% +% The setYunits method of the smodel class sets the yunits property. +% +% + +function results = utp_smodel_setYunits(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + cl = 'smodel'; + mthd = 'setYunits'; + prop = 'yunits'; + + disp('******************************************************'); + disp(['**** Running UTPs for ' cl '/' mthd]); + disp('******************************************************'); + + % Test objects + s1 = smodel('a1*x1 + a2*x2 + a3*x3'); + s1.setName(); + + s2 = smodel('a1*x1 + a2*x2'); + s2.setName(); + + s3 = smodel('a1*x1'); + s3.setName(); + + sv = [s1, s2, s1]; + sm = [s1, s2, s1; s1, s2, s1]; + + % 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'; % obj.setYunits(val1) + val2 = unit('s'); % obj.setYunits(val2) + val3 = plist(prop, 'm'); % obj.setYunits(plist('yunits', 'm') + val4 = {val1, val2, val1}; % obj.setYunits(val1, val2, val3) + + % Run the general tests + results(1) = utp_genericSet_minfo(mthd, s1, prop, @algoTests_minfo); + results(2) = utp_genericAnyShape(mthd, sv, val1, @algoTests); + results(3) = utp_genericAnyShape(mthd, sv, val2, @algoTests); + results(4) = utp_genericAnyShape(mthd, sv, val3, @algoTests); + results(5) = utp_genericAnyShape(mthd, sv, val4, @algoTests); + results(6) = utp_genericAnyShape(mthd, sm, val2, @algoTests); + results(7) = utp_genericList(mthd, s1, s2, s3, val1, @algoTests); + results(8) = utp_genericList(mthd, s1, sv, s3, val3, @algoTests); + results(9) = utp_genericHistory(mthd, s1, val1, ple2); + results(10) = utp_genericModify(mthd, s1, val2, @algoTests, ple1); + results(11) = utp_genericOutput(mthd, s1, s2, val1, @algoTests, ple2); + + 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, varargin) + atest = true; + value = varargin; + % 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{1}, 'plist') && value{1}.nparams == 1 && value{1}.isparam(prop) + % The value was set with a plist. + values = processValues([], value{1}.find(prop)); + if ~isequal(out(idx).(prop), values), atest = false; end + else + if iscell(value{1}), value = value{1}; end + if numel(value) == numel(out) + if ~isequal(out(idx).(prop), unit(value{idx})), atest = false; end + else + if ~isequal(out(idx).(prop), unit(value{1})), atest = false; end + end + end + end + + function values = processValues(values, val) + switch class(val) + case 'char' + values = [values unit(val)]; + case 'unit' + values = [values reshape(val, 1, [])]; + case 'cell' + for ii=1:numel(val) + values = processValues(values, val{ii}); + end + case 'plist' + if length(val) == 1 && isa(val, 'plist') && isparam(val, prop) + vals = find(val, prop); + values = processValues(values, vals); + end + end + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/smodel/utp_smodel_smodel.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/smodel/utp_smodel_smodel.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,304 @@ +% UTP_SMODEL_SMODEL a set of UTPs for the smodel/smodel method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ssm_ssm.m,v 1.4 2009/08/07 07:31:46 hewitson Exp $ +% + +% +% +% The smodel method of the smodel class constructs smodel objects. +% +% + +function results = utp_smodel_smodel(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'smodel'; + mthd = 'smodel'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test objects + sm1 = smodel('a'); + sm1.setName; + sm2 = smodel('a+b'); + sm2.setName; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the general tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, [sm1 sm2 sm1], [], [], ple3)]; % Vector input + results = [results utp_03(mthd, [sm1 sm2 sm1; sm2 sm2 sm1], [], [], ple3)]; % Matrix input + results = [results utp_04(mthd, sm1, sm2, sm1, [], [], ple3)]; % List input + results = [results utp_05(mthd, sm1, [sm1 sm2], [sm1 sm2 sm1; sm2 sm2 sm1], [], [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, sm1, [], ple2)]; % Test history is working + results = [results utp_07]; % Read older MAT-files + % constructor specific tests + results = [results utp_60(class, sm1, ple2)]; % Test history is properly handled with MAT file constructor + results = [results utp_61(class, sm1, ple2)]; % Test history is properly handled with XML file constructor + results = [results utp_62(class, sm1, sm2, ple2)]; % Test history is working with struct constructor + results = [results utp_64(class, sm1, ple2, ple2)]; % Test history is working with plist(filename) constructor + results = [results utp_65(class, sm2, ple3)]; % Test history is working with plist(hostname) constructor + results = [results utp_68(class, sm1, ple3)]; % Test history is working with conn+Id constructor + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Expression')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From XML File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From MAT File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From ASCII File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Repository')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Built-in Model')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + pn = 3; + if io(pn).plists.nparams ~= 3, atest = false; end + % Check key + % Check default value + % Check options + %%%%%%%%%% SET 'From MAT File' + pn = 4; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + %%%%%%%%%% SET 'From XML File' + pn = 5; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end + %%%%%%%%%% SET 'From Repository' + pn = 6; + if io(pn).plists.nparams ~= 10, atest = false; end + % Check key + if ~io(pn).plists.isparam('hostname'), atest = false; end + if ~io(pn).plists.isparam('id'), atest = false; end + if ~io(pn).plists.isparam('cid'), atest = false; end + if ~io(pn).plists.isparam('database'), atest = false; end + if ~io(pn).plists.isparam('binary'), atest = false; end + if ~io(pn).plists.isparam('username'), atest = false; end + if ~io(pn).plists.isparam('password'), atest = false; end + % Check default value + if ~isEmptyDouble(io(pn).plists.find('id')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('cid')), atest = false; end + if ~isequal(io(pn).plists.find('binary'), 'yes'), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('id'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('cid'), {[]}), atest = false; end + if ~isequal(io(pn).plists.getOptionsForParam('binary'), {'yes', 'no'}), atest = false; end + %%%%%%%%%% SET 'From Built-in Model' + pn = 7; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('BUILT-IN'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('built-in')), atest = false; end + % Check options + if ~isequal(io(pn).plists.getOptionsForParam('built-in'), {''}), atest = false; end + %%%%%%%%%% SET 'From Expression' + pn = 8; + if io(pn).plists.nparams ~= 10, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('EXPRESSION'), atest = false; end + if ~io(pn).plists.isparam('params'), atest = false; end + if ~io(pn).plists.isparam('values'), atest = false; end + if ~io(pn).plists.isparam('xvar'), atest = false; end + if ~io(pn).plists.isparam('xvals'), atest = false; end + if ~io(pn).plists.isparam('xunits'), atest = false; end + if ~io(pn).plists.isparam('yunits'), atest = false; end + % Check default value + % Check options + %%%%%%%%%% SET 'From ASCII File' + pn = 9; + if io(pn).plists.nparams ~= 7, atest = false; end + % Check key + if ~io(pn).plists.isparam('Name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('filename'), atest = false; end + if ~io(pn).plists.isparam('xvals'), atest = false; end + if ~io(pn).plists.isparam('yunits'), atest = false; end + if ~io(pn).plists.isparam('xunits'), atest = false; end + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_07 + + % + % + % Tests that the smodel can read older MAT files which have different + % values in 'xvals' + % + % + function result = utp_07 + + % + % + % Tests that the smodel can read older MAT files which have different + % values in 'xvals' + % The smodel object was created with the commands: + % s = smodel('A.*(t >= toff)'); + % s.setXvar('t'); + % s.setParams({'A','toff'}, {5,300}); + % s.setName('Step at toff'); + % s.setDescription('Step function of amplitude A at time toff'); + % s.setXunits('Hz^1/2 km^2'); + % s.setYunits('s^2 m^-1'); + % s.setXvals(1:1e3); + % s.setAliasNames('a'); + % s.setAliasValues(8); + % + % + + try + % + p = mfilename('fullpath'); + % p = regexp(p, '.*(?=/\w+$)', 'match'); + p = p(1:end-(numel(mfilename)+1)); + p = fullfile(p, 'reference_files'); + + fn1 = 'smodel_231_xvals_cdata.mat'; + fn2 = 'smodel_231_xvals_fsdata.mat'; + fn3 = 'smodel_231_xvals_double.mat'; + fn4 = 'smodel_231_xvals_tsdata.mat'; + fn5 = 'smodel_231_xvals_double.xml'; + + s1 = smodel(fullfile(p, fn1)); + s2 = smodel(fullfile(p, fn2)); + s3 = smodel(fullfile(p, fn3)); + s4 = smodel(fullfile(p, fn4)); + s5 = smodel(fullfile(p, fn5)); + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the objects are quite the same + % + % 2) Check that 'xvals' is a cell-array with the numbers from 1 to 1000 + % + % + + atest = true; + if stest + % + try + assert(eq(s1, s2, 'UUID', 'proctime', 'mversion', 'plistUsed')); + assert(eq(s1, s3, 'UUID', 'proctime', 'mversion', 'plistUsed')); + assert(eq(s1, s4, 'UUID', 'proctime', 'mversion', 'plistUsed')); + assert(eq(s1, s5, 'UUID', 'proctime', 'mversion', 'plistUsed', 'mpackage', 'creator')); + + assert(isequal(s1.xvals{1}, 1:1e3)); + assert(isequal(s2.xvals{1}, 1:1e3)); + assert(isequal(s3.xvals{1}, 1:1e3)); + assert(isequal(s4.xvals{1}, 1:1e3)); + assert(isequal(s5.xvals{1}, 1:1e3)); + catch + atest = false; + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ssm/reference_files/make_bode_references.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ssm/reference_files/make_bode_references.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,24 @@ +% Make bode reference files for different SSM models and save to disk. +% +% M Hewitson 27-07-10 +% +% $Id: make_bode_references.m,v 1.1 2010/07/27 07:17:17 hewitson Exp $ +% + +models = {'DFACS', 'IFO'}; + +for kk=1:numel(models) + + mdl = models{kk}; + disp(['*** Making bode references for ' mdl]); + + pl = plist('built-in', mdl); + s = ssm(pl); + out = bode(s); + + % save reference file + save(out, sprintf('ref_bode_%s.mat', mdl)); + +end + + diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ssm/utp_ssm_addParameters.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ssm/utp_ssm_addParameters.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,71 @@ +% UTP_SSM_ADDPARAMETERS a set of UTPs for the ssm/addParameters method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ssm_addParameters.m,v 1.1 2009/08/06 16:56:25 hewitson Exp $ +% + +% +% +% The addParameters method of the ssm class adds the given parameters to +% the model. +% +% + +function results = utp_ssm_addParameters(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ssm'; + mthd = 'addParameters'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test miir objects + [sys1, sys2] = get_test_objects_ssm; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_02(mthd, [sys1 sys2], @algo_test_plist, plist('prop', 2), ple2)]; + results = [results utp_03(mthd, [sys1 sys2 sys1; sys2 sys2 sys1], @algo_test_plist, plist('prop', 2), ple2)]; + results = [results utp_04(mthd, sys1, sys2, sys1, @algo_test_plist, plist('prop', 2), ple2)]; + results = [results utp_04(mthd, sys1, sys2, sys1, @algo_test_param, param('prop', 2), ple2)]; + results = [results utp_05(mthd, sys1, [sys1 sys2 sys1; sys2 sys2 sys1], [sys2 sys1], @algo_test_plist, plist('prop', 2), ple2)]; + results = [results utp_06(mthd, sys1, plist('prop', 2), ple2)]; + + 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 + +end + +function atest = algo_test_plist(in, out, pli) + + atest = true; + if ~eq(out.params.find(pli.params(1).key), pli.params(1).getVal), atest = false; end + +end + + +function atest = algo_test_param(in, out, pli) + + atest = true; + if ~eq(out.params.find(pli(1).key), pli(1).getVal), atest = false; end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ssm/utp_ssm_copy.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ssm/utp_ssm_copy.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,53 @@ +% UTP_SSM_COPY a set of UTPs for the ssm/copy method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ssm_copy.m,v 1.2 2009/08/06 16:56:25 hewitson Exp $ +% + +% +% +% The copy method of the ssm class copies the input object depending of the +% second input. +% +% + +function results = utp_ssm_copy(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ssm'; + mthd = 'copy'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test miir objects + [sys1, sys2] = get_test_objects_ssm; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_69(class, 1, 1, ple2)]; + results = [results utp_69(class, 1, 3, ple2)]; + results = [results utp_69(class, 2, 3, ple2)]; + + 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 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ssm/utp_ssm_loadobj.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ssm/utp_ssm_loadobj.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,155 @@ +% UTP_SSM_LOADOBJ a set of UTPs for the ssm/loadobj method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ssm_loadobj.m,v 1.2 2010/11/25 15:12:25 ingo Exp $ +% + +% +% +% The loadobj method of the ssm class will be automatically called by +% MATLAB if an older object is not compatible with the current object structure. +% This happens only for objects which are stored as a MATLAB formatted +% (MAT-file). The load mechanism for XML formated files calls always the +% 'update_struct' method to keep the stored objects up to date. The +% 'update_struct' method convert the read object structure to the object +% structure which is used in the currend LTPDA version. +% This UTP will load old objects which are stored with an older LTPDA version. +% +% REMARK: Since LTPDA version 1.9.2 will be an object which should be saved as a +% MAT file stored as a struct and not as the object. +% +% + +function results = utp_ssm_loadobj(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ssm'; + mthd = 'loadobj'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Run the tests + results = [results utp_01]; % getInfo call + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Get all .MAT and .XML files + path = fullfile(fileparts(which(mfilename)), '..', '..', 'utp_test_files'); + + matfiles = utils.prog.filescan(path, '.mat'); + xmlfiles = utils.prog.filescan(path, '.xml'); + + % Load .MAT files + obj_no = 1; + for ii=1:numel(matfiles) + fn = matfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = ssm(fn); + obj_no = obj_no+1; + end + end + + % Load .XML files + for ii=1:numel(xmlfiles) + fn = xmlfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = ssm(fn); + obj_no = obj_no+1; + end + end + % + stest = true; + catch err + disp(objs(obj_no).fname) + disp(fn) + disp(err.message) + stest = false; + end + + % + % + % 1) Check the shape of the loaded objects. + % + % + + atest = true; + if stest + % + if exist('objs', 'var') + for ii = 1:numel(objs) + obj = objs(ii).obj; + fname = objs(ii).fname; + + if ~isempty(strfind(fname, '_vec')) + % Loaded object must be a vector + if ~isvector(obj), atest = false; end + elseif ~isempty(strfind(fname, '_mat')) + % Loaded object must be a matrix + % REMARK: Known error in LTPDA version 1.9.2 + % A saved matrix doesn't keep the shape of the matrix. + if isempty(strfind(fname, '_192')) + if ~(size(obj,1) > 1 && size(obj,2) > 1), atest = false; end + end + else + % Loaded object must be a single object + if ~(size(obj,1) == 1 && size(obj,2) == 1), + atest = false; end + end + + end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ssm/utp_ssm_model_DFACS.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ssm/utp_ssm_model_DFACS.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,53 @@ +% UTP_SSM_MODEL_DFACS a set of UTPs for the DFACS SSM built-in model. +% +% M Hewitson 26-07-10 +% +% $Id: utp_ssm_model_DFACS.m,v 1.2 2010/07/27 07:13:59 hewitson Exp $ +% + +% +% +% The built-in model 'DFACS' represents different incarnations of the controllers +% for LPF. +% +% + +function results = utp_ssm_model_DFACS(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ssm'; + model = 'DFACS'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' model]); + disp('******************************************************'); + + % Run the tests + results = [results utp_901(class, model, plist)]; % check model name + results = [results utp_902(class, model, plist)]; % check model description + results = [results utp_903(class, model, plist)]; % check model responds to 'DIM' + +% results = [results utp_920(class, model, plist)]; % check model bode response + + 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 + + + + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ssm/utp_ssm_model_IFO.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ssm/utp_ssm_model_IFO.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,47 @@ +% UTP_SSM_MODEL_IFO a set of UTPs for the IFO SSM built-in model. +% +% M Hewitson 26-07-10 +% +% $Id: utp_ssm_model_IFO.m,v 1.1 2010/07/26 16:42:29 hewitson Exp $ +% + +% +% +% The built-in model 'IFO' represents different incarnations of the +% interferometric sensing for LTP. +% +% + +function results = utp_ssm_model_IFO(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ssm'; + model = 'IFO'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' model]); + disp('******************************************************'); + + % Run the tests + results = [results utp_901(class, model, plist)]; % check model name + results = [results utp_902(class, model, plist)]; % check model description + results = [results utp_903(class, model, plist)]; % check model responds to 'DIM' + + 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 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/ssm/utp_ssm_ssm.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/ssm/utp_ssm_ssm.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,275 @@ +% UTP_SSM_SSM a set of UTPs for the ssm/ssm method +% +% M Hewitson 06-08-08 +% +% $Id: utp_ssm_ssm.m,v 1.14 2011/09/29 13:46:19 ingo Exp $ +% + +% +% +% The ssm method of the ssm class constructs SSM objects. +% +% + +function results = utp_ssm_ssm(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'ssm'; + mthd = 'ssm'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test objects + [sys1, sys2] = get_test_objects_ssm; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the general tests + results = [results utp_01]; % getInfo call + results = [results utp_02(mthd, [sys1 sys2], [], [], ple3)]; % Vector input + results = [results utp_03(mthd, [sys1 sys2 sys1; sys2 sys2 sys1], [], [], ple3)]; % Matrix input + results = [results utp_04(mthd, sys1, sys2, sys1, [], [], ple3)]; % List input + results = [results utp_05(mthd, sys1, [sys1 sys2], [sys1 sys2 sys1; sys2 sys2 sys1], [], [], ple3)]; % Test with mixed input + results = [results utp_06(mthd, sys1, [], ple1)]; % Test history is working + + % constructor specific tests + results = [results utp_60(class, sys1, ple1)]; % Test history is properly handled with MAT file constructor + results = [results utp_61(class, sys1, ple1)]; % Test history is properly handled with XML file constructor + results = [results utp_62(class, sys1, sys2, ple2)]; % Test history is working with struct constructor + results = [results utp_63(class, ple1)]; % Test history is working with pzmodel-object constructor + results = [results utp_64(class, sys1, ple1, ple2)]; % Test history is working with plist(filename) constructor + results = [results utp_65(class, sys2, ple3)]; % Test history is working with plist(hostname) constructor + results = [results utp_66(class, ple1)]; % Test history is working with plist(pzmodel) constructor + results = [results utp_67(class, ple1)]; % Test history is working with pzmodel + plist constructor + results = [results utp_68(class, sys1, ple3)]; % Test history is working with conn+Id constructor + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From MAT File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From XML File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Repository')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Built-in Model')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Description')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Pzmodel')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Miir')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Rational')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + pn = 3; + if io(pn).plists.nparams ~= 12, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('states'), atest = false; end + if ~io(pn).plists.isparam('outputs'), atest = false; end + if ~io(pn).plists.isparam('inputs'), atest = false; end + if ~io(pn).plists.isparam('timestep'), atest = false; end + if ~io(pn).plists.isparam('amats'), atest = false; end + if ~io(pn).plists.isparam('bmats'), atest = false; end + if ~io(pn).plists.isparam('cmats'), atest = false; end + if ~io(pn).plists.isparam('dmats'), atest = false; end + if ~io(pn).plists.isparam('params'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + %%%%%%%%%% SET 'From MAT File' + pn = 4; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + %%%%%%%%%% SET 'From XML File' + pn = 5; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + %%%%%%%%%% SET 'From Repository' + pn = 6; + if io(pn).plists.nparams ~= 10, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('hostname'), atest = false; end + if ~io(pn).plists.isparam('id'), atest = false; end + if ~io(pn).plists.isparam('cid'), atest = false; end + if ~io(pn).plists.isparam('database'), atest = false; end + if ~io(pn).plists.isparam('binary'), atest = false; end + if ~io(pn).plists.isparam('username'), atest = false; end + if ~io(pn).plists.isparam('password'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('id')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('cid')), atest = false; end + if ~isequal(io(pn).plists.find('binary'), 'yes'), atest = false; end + %%%%%%%%%% SET 'From Built-in Model' + pn = 7; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('built-in'), atest = false; end + if ~io(pn).plists.isparam('symbolic params'), atest = false; end + if ~io(pn).plists.isparam('param names'), atest = false; end + if ~io(pn).plists.isparam('param values'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('built-in')), atest = false; end + %%%%%%%%%% SET 'From Description' + pn = 8; + if io(pn).plists.nparams ~= 12, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('states'), atest = false; end + if ~io(pn).plists.isparam('outputs'), atest = false; end + if ~io(pn).plists.isparam('inputs'), atest = false; end + if ~io(pn).plists.isparam('timestep'), atest = false; end + if ~io(pn).plists.isparam('amats'), atest = false; end + if ~io(pn).plists.isparam('bmats'), atest = false; end + if ~io(pn).plists.isparam('cmats'), atest = false; end + if ~io(pn).plists.isparam('dmats'), atest = false; end + if ~io(pn).plists.isparam('params'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + %%%%%%%%%% SET 'From Pzmodel' + pn = 9; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('pzmodel'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~eq(io(pn).plists.find('pzmodel'), pzmodel(), ple1), atest = false; end + %%%%%%%%%% SET 'From MIIR' + pn = 10; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('miir'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~eq(io(pn).plists.find('miir'), miir(), ple1), atest = false; end + %%%%%%%%%% SET 'From rational' + pn = 11; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('rational'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~eq(io(pn).plists.find('rational'), rational(), ple1), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/time/utp_time_datenum.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/time/utp_time_datenum.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,197 @@ +% UTP_TIME_DOUBLE +% +% +% +% Test the 'datenum' method of the time class. +% +% +% +% NOTE: in this test we manipulate user preferences thus we should make +% sure we restore the original user preferences at the end of the testing +% +% $Id: utp_time_datenum.m,v 1.3 2011/04/28 07:06:27 hewitson Exp $ + +function results = utp_time_datenum(varargin) + + % check inputs + if nargin == 0 + + % some keywords + class = 'time'; + mthd = 'datenum'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % get preferences + prefs = getappdata(0, 'LTPDApreferences'); + oldTimezone = char(prefs.getTimePrefs.getTimeTimezone); + + try + results = [results utp_901]; + results = [results utp_901]; + results = [results utp_902]; + results = [results utp_903]; + catch ex + % restore preferences + + rethrow(ex); + end + + % restore preferences + prefs.getTimePrefs.setTimeTimezone(oldTimezone); + + 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 + + %% UTP_901 + + % + % + % Tests the 'datenum' method. + % + % + function result = utp_901 + + % + % Create a time object and use datenum to produce a serial date number. + % + + stest = false; + try + % + % construct a well known time object + t1 = time('1982-08-31 01:02:03 UTC'); + n1 = datenum(t1); + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % + % Check that the returned value is the same as the one you get when + % using time/format with the same format string when converted using + % MATLAB's datestr() function. + % + + % + assert(strcmp(datestr(n1), t1.format('dd-mmm-yyyy HH:MM:SS'))) + % + catch + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + + %% UTP_902 + + % + % + % Tests the 'datenum' method. + % + % + function result = utp_902 + + % + % Set the time-zone to UTC and create a time object and use datenum to + % produce a serial date number. + % + stest = false; + try + % + % set time zone to UTC + prefs.getTimePrefs.setTimeTimezone('UTC'); + % construct a well known time object + t1 = time('1982-08-31 01:02:03 UTC'); + n1 = datenum(t1); + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + % + % Check that the returned value is the same as the one you get when + % using time/format with the same format string when converted using + % MATLAB's datestr() function. + % + % + assert(strcmp(datestr(n1), t1.format('dd-mmm-yyyy HH:MM:SS'))) + % + + catch + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + + %% UTP_903 + + % + % + % Tests 'double' method. + % + % + function result = utp_903 + + % + % Set the time-zone to PST and create a time object and use datenum to + % produce a serial date number. + % + stest = false; + try + % + % set time zone to PST + prefs.getTimePrefs.setTimeTimezone('PST'); + % construct a well known time object + t1 = time('1982-08-31 01:02:03 UTC'); + n1 = datenum(t1); + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % + % Check that the returned value is the same as the one you get when + % using time/format with the same format string when converted using + % MATLAB's datestr() function. + % + % + assert(strcmp(datestr(n1), t1.format('dd-mmm-yyyy HH:MM:SS'))) + % + catch + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/time/utp_time_double.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/time/utp_time_double.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,92 @@ +% UTP_TIME_DOUBLE +% +% +% +% Test the 'double' method of the time class. +% +% +% +% $Id: utp_time_double.m,v 1.2 2011/04/28 07:06:27 hewitson Exp $ + +function results = utp_time_double(varargin) + + % check inputs + if nargin == 0 + + % some keywords + class = 'time'; + mthd = 'double'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + results = [results utp_901]; + + 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 + + %% UTP_901 + + % + % + % Tests 'double' method. + % + % + function result = utp_901 + + % + % Use the double() method on single time objects and vectors of time + % objects. + % + stest = false; + try + % + % construct a well known time object + t1 = time('1970-01-01 00:00:12.345 UTC'); + d1 = double(t1); + t2 = [t1 t1]; + d2 = double(t2); + t3 = [t2; t2]; + d3 = double(t3); + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % + % Check that double returns the expected numerical values for each + % case. + % + % + assert(d1 == 12.345); + assert(all(d2 == 12.345)); + assert(all(size(d2) == size(t2))); + assert(all(all(d3 == 12.345))); + assert(all(size(d3) == size(t3))); + % + catch + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/time/utp_time_format.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/time/utp_time_format.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,120 @@ +% UTP_TIME_FORMAT +% +% +% +% Test the 'format' method of the time class. +% +% +% +% NOTE: in this test we manipulate user preferences thus we should make +% sure we restore the original user preferences at the end of the testing +% +% $Id: utp_time_format.m,v 1.3 2011/04/28 07:06:27 hewitson Exp $ + +function results = utp_time_format(varargin) + + % check inputs + if nargin == 0 + + % some keywords + class = 'time'; + mthd = 'format'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % get preferences + prefs = getappdata(0, 'LTPDApreferences'); + oldTimezone = char(prefs.getTimePrefs.getTimeTimezone); + oldTimeformat = char(prefs.getTimePrefs.getTimestringFormat); + + % get preferences + try + results = [results utp_901]; + catch ex + % restore preferences + prefs.getTimePrefs.setTimeTimezone(oldTimezone); + prefs.getTimePrefs.setTimestringFormat(oldTimeformat); + rethrow(ex); + end + + % restore preferences + prefs.getTimePrefs.setTimeTimezone(oldTimezone); + prefs.getTimePrefs.setTimestringFormat(oldTimeformat); + + 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 + + + %% UTP_901 + + % + % + % Tests 'format' static method. + % + % + function result = utp_901 + + % + % Use the static format method to produce a number of time strings in + % different formats and for different time-zones. + % + stest = false; + try + % + % set time zone and time format in the toolbox preferences + prefs.getTimePrefs.setTimeTimezone('CET'); + prefs.getTimePrefs.setTimestringFormat('yyyy-mm-dd HH:MM:SS'); + t = time('1970-01-01 00:00:00.000 UTC'); + str1 = t.format(); + str2 = t.format('HH:MM:SS'); + str3 = t.format('HH:MM:SS', 'JST'); + + % set time zone and time format in the toolbox preferences + prefs.getTimePrefs.setTimeTimezone('UTC'); + prefs.getTimePrefs.setTimestringFormat('yyyy-mm-dd HH:MM:SS'); + str4 = t.format(); + str5 = t.format('HH:MM:SS'); + str6 = t.format('HH:MM:SS', 'JST'); + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % + % Check that the returned strings match the expected strings. + % + % + assert(strcmp(str1, '1970-01-01 01:00:00')); + assert(strcmp(str2, '01:00:00')); + assert(strcmp(str3, '09:00:00')); + assert(strcmp(str4, '1970-01-01 00:00:00')); + assert(strcmp(str5, '00:00:00')); + assert(strcmp(str6, '09:00:00')); + % + catch + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/time/utp_time_minus.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/time/utp_time_minus.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,114 @@ +% UTP_TIME_TIME +% +% +% +% Tests time object minus operator. +% +% +% +% $Id: utp_time_minus.m,v 1.2 2011/04/28 07:06:27 hewitson Exp $ + +function results = utp_time_minus(varargin) + + global DEBUG + DEBUG = false; + + % check inputs + if nargin == 0 + + % some keywords + class = 'time'; + mthd = 'minus'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % get preferences + prefs = getappdata(0, 'LTPDApreferences'); + timezone = char(prefs.getTimePrefs.getTimeTimezone); + + % set timezone to UTC to simplify testing + prefs.getTimePrefs.setTimeTimezone('UTC'); + + % get preferences + try + results = [results utp_01]; + catch ex + % restore preferences + prefs.getTimePrefs.setTimeTimezone(timezone); + rethrow(ex); + end + + % restore preferences + prefs.getTimePrefs.setTimeTimezone(timezone); + + 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 + + %% UTP_01 + + % + % + % Tests time object minus operator. + % + % + function result = utp_01 + + % + % Compute the difference between time objects and doubles. + % + stest = false; + try + % + t1 = time(2); + t2 = t1 - time(2); + t3 = t1 - 2; + t4 = t1 - '00:00:02'; + t5 = 2 - t1; + t6 = '00:00:02' - t1; + t7 = t1 - [2 2]; + t8 = [2; 2] - t1; + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % + % Check the resulting time objects have the correct values. + % + % + assert(double(t2) == 0); + assert(double(t3) == 0); + assert(double(t4) == 0); + assert(double(t5) == 0); + assert(double(t6) == 0); + assert(all(double(t7) == 0)); + assert(all(size(t7) == [1, 2])) + assert(all(double(t8) == 0)); + assert(all(size(t8) == [2, 1])) + % + catch ex + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/time/utp_time_parse.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/time/utp_time_parse.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,328 @@ +% UTP_TIME_PARSE +% +% +% +% Test the 'parse' static method of the time class. +% +% +% +% NOTE: in this test we manipulate user preferences thus we should make +% sure we restore the original user preferences at the end of the testing +% +% $Id: utp_time_parse.m,v 1.3 2011/04/28 07:06:27 hewitson Exp $ + +function results = utp_time_parse(varargin) + + % check inputs + if nargin == 0 + + % some keywords + class = 'time'; + mthd = 'parse'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % get preferences + prefs = getappdata(0, 'LTPDApreferences'); + oldTimezone = char(prefs.getTimePrefs.getTimeTimezone); + + try + results = [results utp_901]; + results = [results utp_902]; + results = [results utp_903]; + results = [results utp_904]; + results = [results utp_905]; + catch ex + % restore preferences + prefs.getTimePrefs.setTimeTimezone(oldTimezone); + rethrow(ex); + end + + % restore preferences + prefs.getTimePrefs.setTimeTimezone(oldTimezone); + + 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 + + %% UTP_901 + + % + % + % Tests 'parse' static method with time string only. + % + % + function result = utp_901 + + % + % Use parse() to parse different time strings with different time-zones + % set. + % + stest = false; + try + % + % set timezone to CET + prefs.getTimePrefs.setTimeTimezone('CET'); + msec1 = time.parse('1970-01-01 01:00:01'); + msec2 = time.parse('1970-01-02'); + msec3 = time.parse('01:00:01'); + % set timezone to UTC + prefs.getTimePrefs.setTimeTimezone('UTC'); + msec4 = time.parse('1970-01-01 00:00:01'); + msec5 = time.parse('1970-01-02'); + msec6 = time.parse('01:00:01'); + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if syntax tests failed + assert(stest); + + % time string is interpreted in the given timezone + % + % Check the resulting millsecond values are the expected ones. + % + % + assert(msec1 == 1000); + assert(msec2 == 24*60*60*1000 - 60*60*1000) + assert(msec3 == 1000); + assert(msec4 == 1000); + assert(msec5 == 24*60*60*1000); + assert(msec6 == 1000 + 60*60*1000); + % + catch + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + + %% UTP_902 + + % + % + % Tests 'parse' static method with time and format strings. + % + % + function result = utp_902 + + % + % Use parse() to parse different time strings with different time-zones + % set. The time-string format is specified as a second input argument. + % + stest = false; + try + % + prefs.getTimePrefs.setTimeTimezone('UTC'); + msec1 = time.parse('1970-01-01 00:00:01', 'yyyy-mm-dd HH:MM:SS'); + msec2 = time.parse('1970,01,01 00,00,01', 'yyyy,mm,dd HH,MM,SS'); + msec3 = time.parse('00/00/01', 'HH/MM/SS'); + msec4 = time.parse('02/01/1970', 'dd/mm/yyyy'); + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if syntax tests failed + assert(stest); + + % + % Check the resulting millsecond values are the expected ones. + % + % + assert(msec1 == 1000); + assert(msec2 == 1000); + assert(msec3 == 1000); + assert(msec4 == 24*60*60*1000); + % + catch + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + + %% UTP_903 + + % + % + % Tests 'parse' static method with time string and numeric format. + % + % + function result = utp_903 + + % + % Use parse() to parse different time strings using the supported + % MATLAB numeric time formats. + % + stest = false; + try + % + prefs.getTimePrefs.setTimeTimezone('UTC'); + % of the 31 formats supported by matlab it makes sense to support just a few + % the ones that contain date and time + fullfrmts = [ 0, 21, 30, 31 ]; + % the ones that contain date + datefrmts = [ 1, 2, 22, 23, 24, 25, 26, 29 ]; + % the ones that contain time + timefrmts = [ 13, 14 ]; + % the ones that contain time without seconds + hourfrmts = [ 15, 16 ]; + t = datenum(2010,07,28,01,02,03); + for kk = [ fullfrmts, datefrmts, timefrmts, hourfrmts ] + msec(kk+1) = time.parse(datestr(t, kk), kk); + end + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if syntax tests failed + assert(stest); + + % + % Check the resulting millsecond values against the result of parsing + % a time string. (See time/parse utp_902.) + % + % + % we checked this before and we can trust this value + tmsec = time.parse('2010-07-28 01:02:03'); + assert(all(msec(fullfrmts+1) == tmsec)); + % we checked this before and we can trust this value + tmsec = time.parse('2010-07-28'); + assert(all(msec(datefrmts+1) == tmsec)); + % we checked this before and we can trust this value + tmsec = time.parse('01:02:03'); + assert(all(msec(timefrmts+1) == tmsec)); + % we checked this before and we can trust this value + tmsec = time.parse('01:02:00'); + assert(all(msec(hourfrmts+1) == tmsec)); + % + catch + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + + %% UTP_904 + + % + % + % Tests 'parse' static method with time string containing timezone information. + % + % + function result = utp_904 + + % + % Use parse() to parse different time strings which contain the + % time-zone. + % + stest = false; + try + % + % set timezone to UTC + prefs.getTimePrefs.setTimeTimezone('UTC'); + msec(1) = time.parse('1970-01-01 00:00:01 UTC'); + msec(2) = time.parse('1970-01-01 01:00:01 CET'); + msec(3) = time.parse('1970-01-01 00:00:01 +0000'); + msec(4) = time.parse('1970-01-01 01:00:01 +0100'); + % set timezone to CET + prefs.getTimePrefs.setTimeTimezone('CET'); + msec(5) = time.parse('1970-01-01 00:00:01 UTC'); + msec(6) = time.parse('1970-01-01 01:00:01 CET'); + msec(7) = time.parse('1970-01-01 00:00:01 +0000'); + msec(8) = time.parse('1970-01-01 01:00:01 +0100'); + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if syntax tests failed + assert(stest); + + % + % Check the resulting millisecond value is the expected one. + % + % + assert(all(msec == 1000)); + % + catch + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + + + %% UTP_905 + + % + % + % Tests 'parse' static method with time string and timezone specification. + % + % + function result = utp_905 + + % + % Use parse() to parse different time strings when passing the + % time-zone as the third argument. The second argument (the format) is + % left empty. + % + stest = false; + try + % + % set timezone to UTC + prefs.getTimePrefs.setTimeTimezone('UTC'); + msec(1) = time.parse('1970-01-01 00:00:01', '', 'UTC'); + msec(2) = time.parse('1970-01-01 01:00:01', '', 'CET'); + % set timezone to CET + prefs.getTimePrefs.setTimeTimezone('CET'); + msec(3) = time.parse('1970-01-01 00:00:01', '', 'UTC'); + msec(4) = time.parse('1970-01-01 01:00:01', '', 'CET'); + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if syntax tests failed + assert(stest); + + % + % Check the resulting millisecond value is the expected one. + % + % + assert(all(msec == 1000)); + % + catch + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/time/utp_time_plus.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/time/utp_time_plus.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,111 @@ +% UTP_TIME_TIME +% +% +% +% Tests time object plus operator. +% +% +% +% $Id: utp_time_plus.m,v 1.2 2011/04/28 07:06:27 hewitson Exp $ + +function results = utp_time_plus(varargin) + + % check inputs + if nargin == 0 + + % some keywords + class = 'time'; + mthd = 'plus'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % get preferences + prefs = getappdata(0, 'LTPDApreferences'); + timezone = char(prefs.getTimePrefs.getTimeTimezone); + + % set timezone to UTC to simplify testing + prefs.getTimePrefs.setTimeTimezone('UTC'); + + % get preferences + try + results = [results utp_101]; + catch ex + % restore preferences + prefs.getTimePrefs.setTimeTimezone(timezone); + rethrow(ex); + end + + % restore preferences + prefs.getTimePrefs.setTimeTimezone(timezone); + + 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 + + %% UTP_01 + + % + % + % Tests time object plus operator. + % + % + function result = utp_101 + + % + % Compute the sum of time objects and doubles. + % + stest = false; + try + % + t1 = time(2); + t2 = t1 + time(2); + t3 = t1 + 2; + t4 = t1 + '00:00:02'; + t5 = 2 + t1; + t6 = '00:00:02' + t1; + t7 = t1 + [2 2]; + t8 = [2; 2] + t1; + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % + % Check the resulting time objects have the correct values. + % + % + assert(double(t2) == 4); + assert(double(t3) == 4); + assert(double(t4) == 4); + assert(double(t5) == 4); + assert(double(t6) == 4); + assert(all(double(t7) == 4)); + assert(all(size(t7) == [1, 2])) + assert(all(double(t8) == 4)); + assert(all(size(t8) == [2, 1])) + % + catch ex + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end +end \ No newline at end of file diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/time/utp_time_string.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/time/utp_time_string.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,88 @@ +% UTP_TIME_STRING +% +% +% +% Test the 'string' method of the time class. +% +% +% +% $Id: utp_time_string.m,v 1.2 2011/04/28 07:06:27 hewitson Exp $ + +function results = utp_time_string(varargin) + + % check inputs + if nargin == 0 + + % some keywords + class = 'time'; + mthd = 'string'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % get preferences + results = [results utp_901]; + + 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 + + %% UTP_901 + + % + % + % Tests that the output of the 'string' method can be used to recreate the time object. + % + % + function result = utp_901 + + % + % Use string to convert a time object to a string. Use eval on the + % result to recreate a time object. + % + stest = false; + try + % + % create a time object + t1 = time(); + % obtain its string representation + str = t1.string(); + % recreate the object from the string + t2 = eval(str); + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % test that the original and the recreated object are the same + % + % Check the recreated time object matches the original. + % + % + assert(t1.utc_epoch_milli == t2.utc_epoch_milli); + % + catch + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/time/utp_time_time.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/time/utp_time_time.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,464 @@ +% UTP_TIME_TIME +% +% +% +% Tests time object constructor. +% +% +% +% NOTE: in this test we manipulate user preferences thus we should make +% sure we restore the original user preferences at the end of the testing +% +% $Id: utp_time_time.m,v 1.5 2011/04/28 07:06:27 hewitson Exp $ + +function results = utp_time_time(varargin) + + global DEBUG + DEBUG = false; + + % check inputs + if nargin == 0 + + % some keywords + class = 'time'; + mthd = 'time'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % get preferences + prefs = getappdata(0, 'LTPDApreferences'); + oldTimezone = char(prefs.getTimePrefs.getTimeTimezone); + oldTimeformat = char(prefs.getTimePrefs.getTimestringFormat); + + % set timezone to UTC to simplify testing + prefs.getTimePrefs.setTimeTimezone('UTC'); + + % get preferences + try + results = [results utp_901]; + results = [results utp_902]; + results = [results utp_903]; + results = [results utp_904]; + results = [results utp_905]; + results = [results utp_906]; + results = [results utp_907]; + results = [results utp_908]; + results = [results utp_909]; + catch ex + % restore preferences + prefs.getTimePrefs.setTimeTimezone(oldTimezone); + prefs.getTimePrefs.setTimestringFormat(oldTimeformat); + rethrow(ex); + end + + % restore preferences + prefs.getTimePrefs.setTimeTimezone(oldTimezone); + prefs.getTimePrefs.setTimestringFormat(oldTimeformat); + + 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 + + %% UTP_901 + + % + % + % Tests time object constructor without arguments. Should return the current time. + % + % + function result = utp_901 + + % + % Call the time() constructor with no inputs. + % + stest = false; + try + % + obj = time(); + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % nothing to test here + % + % No test can be done here since we don't know the time when the + % constructor is called. We could check that the resulting time is > + % 0, but that's not so useful. + % + % + % + catch + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + + %% UTP_902 + + % + % + % Tests time object constructor from numeric value. + % + % + function result = utp_902 + + % + % Call the time() constructor with a numeric input (number of seconds + % since epoch). + % + stest = false; + try + % + obj = time(1234.5); + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % nothing to test here + % + % Check the time object has the expected millisecond value. + % + % + assert(obj.utc_epoch_milli == 1234.5*1000.0); + % + catch + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + + %% UTP_903 + + % + % + % Tests time object constructor from string. + % + % + function result = utp_903 + + % + % Call the time() constructor with different time-string inputs. + % + stest = false; + try + % + obj1 = time('1970-01-01 00:00:00'); + obj2 = time('1970-01-01 00:01:00'); + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % + % Check the time objects have the expected millisecond values. + % + % + assertEq(obj1.utc_epoch_milli, 0); + assertEq(obj2.utc_epoch_milli, 60*1000.0); + % + catch ex + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + + + %% UTP_904 + + % + % + % Tests time object constructor from a cell array of strings. + % + % + function result = utp_904 + + % + % Call the time() constructor with cell-array of time-strings. + % + stest = false; + try + % + obj = time({'1970-01-01 00:00:00', '1970-01-01 00:01:00', '1970-01-01 00:02:00'}); + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % + % Check the time objects have the expected millisecond values. + % + % + assert(all(size(obj) == [1, 3])); + assert(all([obj.utc_epoch_milli] == [0 60 120]*1000.0)); + % + catch + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + + %% UTP_905 + + % + % + % Tests time object constructor from plist with 'time' parameter. + % + % + function result = utp_905 + + % + % Call the time() constructor with plist input. Check a plist with a + % numeric value and a plist with a time-string. + % + stest = false; + try + % + obj1 = time(plist('time', 1234.5)); + obj2 = time(plist('time', '1970-01-01 00:01:00')); + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % + % Check the time objects have the expected millisecond values. + % + % + assert(obj1.utc_epoch_milli == 1234.5*1000.0); + assert(obj2.utc_epoch_milli == 60*1000.0); + % + catch + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + + %% UTP_906 + + % + % + % Tests time object constructor from plist with 'milliseconds' parameter + % + % + function result = utp_906 + + % + % Call the time() constructor with plist input using the 'millisecond' + % key. + % + stest = false; + try + % + obj = time(plist('milliseconds', 1234.5)); + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % + % Check the time object has the expected millisecond value. + % + % + assertEq(obj.utc_epoch_milli, 1234.5); + % + catch + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + + + %% UTP_907 + + % + % + % Tests time object constructor from plist with more parameters. + % + % + function result = utp_907 + % + % Call the time() constructor with plist input containing the time + % string and the time-zone. + % key. + % + stest = false; + try + % + obj1 = time(plist('time', '1970-01-01 01:01:00', 'timezone', 'UTC')); + obj2 = time(plist('time', '1970-01-01 01:01:00', 'timezone', 'CET')); + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % + % Check the time objects have the expected millisecond values. + % + % + % time string is interpreted in the given timezone + assertEq(obj1.utc_epoch_milli, 61*60*1000.0); + assertEq(obj2.utc_epoch_milli, 60*1000.0); + % + catch ex + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + + + %% UTP_908 + + % + % + % Tests time object constructor from structure. + % + % + function result = utp_908 + % + % Call the time() constructor with an input structure obtained from + % calling struct() on a time object. + % key. + % + stest = false; + try + % + t = time(plist('time', '1970-01-01 00:01:00')); + w = warning('off', 'MATLAB:structOnObject'); + s = struct(t); + warning(w); + obj = time(s); + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % + % Check the original and reconstructed time objects have the same + % millisecond value. + % + % + assert(obj.utc_epoch_milli == t.utc_epoch_milli); + % + catch + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + + + %% UTP_909 + + % + % + % Tests time object constructor from string and time format. + % + % + function result = utp_909 + % + % Call the time() constructor with an input time string and time format + % string. + % + stest = false; + try + % + obj = time('1970-01-01 00:01:00', 'yyyy-mm-dd HH:MM:SS'); + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % + % Check the resulting time object has the expected millisecond value. + % + % + assertEq(obj.utc_epoch_milli, 60*1000.0); + % + catch + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + +end + +function rv = assertEq(v1, v2) + global DEBUG + if v1 == v2 + rv = true; + else + msg = sprintf('ERROR: assertEq: expected %e got %e\n', v2, v1); + if DEBUG + fprintf([msg '\n']); + end + error(msg); + end +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/time/utp_time_timeformat.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/time/utp_time_timeformat.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,194 @@ +% UTP_TIME_TIMEFORMAT +% +% +% +% Tests time class 'timeformat' static property. +% +% +% +% NOTE: in this test we manipulate user preferences thus we should make +% sure we restore the original user preferences at the end of the testing +% +% $Id: utp_time_timeformat.m,v 1.3 2011/04/28 07:06:27 hewitson Exp $ + +function results = utp_time_timeformat(varargin) + + % check inputs + if nargin == 0 + + % some keywords + class = 'time'; + mthd = 'timeformat'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % get preferences + prefs = getappdata(0, 'LTPDApreferences'); + oldTimezone = char(prefs.getTimePrefs.getTimeTimezone); + oldTimeformat = char(prefs.getTimePrefs.getTimestringFormat); + + % get preferences + try + results = [results utp_901]; + results = [results utp_902]; + results = [results utp_903]; + catch ex + % restore preferences + prefs.getTimePrefs.setTimeTimezone(oldTimezone); + prefs.getTimePrefs.setTimestringFormat(oldTimeformat); + rethrow(ex); + end + + % restore preferences + prefs.getTimePrefs.setTimeTimezone(oldTimezone); + prefs.getTimePrefs.setTimestringFormat(oldTimeformat); + + 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 + + %% UTP_901 + + % + % + % Tests that the method really returns what is in the user preferences. + % + % + function result = utp_901 + + % + % Check that the timeformat method runs without error. + % + stest = false; + try + % + frmt = time.timeformat; + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % + % Check that the returned value is the same as the one set in the + % user preferences. + % + + % + assert(strcmp(frmt, char(prefs.getTimePrefs.getTimestringFormat))); + % + catch ex + atest = false; + % rethrow(ex) + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + + + %% UTP_902 + + % + % + % Change user preferences and do it again. + % + % + function result = utp_902 + + % + % Set the time string format in the preferences and check that the + % timeformat method runs without error. + % + stest = false; + try + % + prefs.getTimePrefs.setTimestringFormat('HH:MM:SS'); + frmt = time.timeformat; + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % + % Check that the returned value is the same as the one set in the + % user preferences. + % + + % + assert(strcmp(frmt, char(prefs.getTimePrefs.getTimestringFormat))); + % + catch ex + atest = false; + % rethrow(ex) + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + + + %% UTP_903 + + % + % + % Change user preferences and do it again. + % + % + function result = utp_903 + + % + % Set the time string format in the preferences and check that the + % timeformat method runs without error. + % + stest = false; + try + % + prefs.getTimePrefs.setTimestringFormat('yyyy-mm-dd'); + frmt = time.timeformat; + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + % + % Check that the returned value is the same as the one set in the + % user preferences. + % + + % + assert(strcmp(frmt, char(prefs.getTimePrefs.getTimestringFormat))); + % + catch ex + atest = false; + % rethrow(ex); + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/time/utp_time_timezone.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/time/utp_time_timezone.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,189 @@ +% UTP_TIME_TIMEZONE +% +% +% +% Tests time class 'timezone' static property. +% +% +% +% NOTE: in this test we manipulate user preferences thus we should make +% sure we restore the original user preferences at the end of the testing +% +% $Id: utp_time_timezone.m,v 1.3 2011/04/28 07:06:27 hewitson Exp $ + +function results = utp_time_timezone(varargin) + + % check inputs + if nargin == 0 + + % some keywords + class = 'time'; + mthd = 'timezone'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % get preferences + prefs = getappdata(0, 'LTPDApreferences'); + oldTimezone = char(prefs.getTimePrefs.getTimeTimezone); + oldTimeformat = char(prefs.getTimePrefs.getTimestringFormat); + + % get preferences + try + results = [results utp_901]; + results = [results utp_902]; + results = [results utp_903]; + catch ex + % restore preferences + prefs.getTimePrefs.setTimeTimezone(oldTimezone); + prefs.getTimePrefs.setTimestringFormat(oldTimeformat); + rethrow(ex); + end + + % restore preferences + prefs.getTimePrefs.setTimeTimezone(oldTimezone); + prefs.getTimePrefs.setTimestringFormat(oldTimeformat); + + 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 + + %% UTP_901 + + % + % + % Tests that the method really returns what is in the user preferences. + % + % + function result = utp_901 + + % + % Call the static timezone method. + % + stest = false; + try + % + tz = time.timezone; + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % + % Check the resulting timezone object against the one in the user + % preferences. + % + % + assert(strcmp(tz.getID(), char(prefs.getTimePrefs.getTimeTimezone))); + % + catch ex + atest = false; + % rethrow(ex) + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + + + %% UTP_902 + + % + % + % Change user preferences and do it again. + % + % + function result = utp_902 + + % + % Set the timezone in the preferences then call the static timezone method. + % + stest = false; + try + % + prefs.getTimePrefs.setTimeTimezone('GMT-12:00'); + tz = time.timezone; + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % + % Check the resulting timezone object against the one in the user + % preferences. + % + % + assert(strcmp(tz.getID(), char(prefs.getTimePrefs.getTimeTimezone))); + % + catch ex + atest = false; + % rethrow(ex) + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + + + %% UTP_903 + + % + % + % Change user preferences and do it again. + % + % + function result = utp_903 + + % + % Set the timezone in the preferences then call the static timezone method. + % + stest = false; + try + % + prefs.getTimePrefs.setTimeTimezone('GMT+06:00'); + tz = time.timezone; + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % + % Check the resulting timezone object against the one in the user + % preferences. + % + % + assert(strcmp(tz.getID(), char(prefs.getTimePrefs.getTimeTimezone))); + % + catch + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_bsubmit.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_bsubmit.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,526 @@ +% UTP_TIMESPAN_BSUBMIT a set of UTPs for the timespan/bsubmit method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_bsubmit.m,v 1.13 2010/08/18 09:25:55 ingo Exp $ +% + +% +% +% The bsubmit method of the timespan class submits a collection of objects +% in binary form to an LTPDA Repository. The type of the objects are +% independent. +% +% + +function results = utp_timespan_bsubmit(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'bsubmit'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + [ts1, ts2, ts3, ts4, ts5, ts6, tsv, tsm] = get_test_objects_timespan; + plForAutoTest = plist('no dialog', true, 'use selector', false); + + try + conn = utpGetConnection(); + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_timespan_bsubmit: submit timespan'; + sinfo.experiment_description = 'utp_timespan_bsubmit: description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test output of the data + catch + end + + % Close connection + utpCloseConnection(conn) + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 15, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('sinfo filename'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isEmptyChar(io(3).plists.find('sinfo filename')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the bsubmit method works with a vector of TIMESPAN objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the bsubmit method works for a vector of TIMESPAN objects as + % input. + % + % + + try + % + [ids, cids] = bsubmit(tsv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(tsv), atest = false; end + if numel(robjs2) ~= numel(tsv), atest = false; end + if numel(robjs3) ~= numel(tsv), atest = false; end + % Check the retrieved object against the submitted + if ~eq(tsv, [robjs1{:}]), atest = false; end + if ~eq(tsv, [robjs2{:}]), atest = false; end + if ~eq(tsv, [robjs3{:}]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the bsubmit method works with a matrix of TIMESPAN objects as + % input. + % + % + function result = utp_03 + + % + % + % Tests that the bsubmit method works with a matrix of TIMESPAN objects + % as input. + % + % + + try + % + [ids, cids] = bsubmit(tsm, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3), ids(4), ids(5), ids(6)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(tsm), atest = false; end + if numel(robjs2) ~= numel(tsm), atest = false; end + if numel(robjs3) ~= numel(tsm), atest = false; end + % Check the retrieved object against the submitted + if ~eq(tsm, reshape([robjs1{:}], size(tsm))), atest = false; end + if ~eq(tsm, reshape([robjs2{:}], size(tsm))), atest = false; end + if ~eq(tsm, reshape([robjs3{:}], size(tsm))), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the bsubmit method works with a list of TIMESPAN objects as + % input. + % + % + function result = utp_04 + + % + % + % Tests that the bsubmit method works with a list of TIMESPAN objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = bsubmit(ts1, pl, iir, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + robjs3 = ltpda_uo.retrieve(conn, 'binary', ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 3, atest = false; end + if numel(robjs2) ~= 3, atest = false; end + if numel(robjs3) ~= 3, atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, ts1), atest = false; end + if ~eq(robjs1{3}, pl), atest = false; end + if ~eq(robjs1{2}, iir), atest = false; end + % Check robjs2 + if ~eq(robjs2{1}, ts1), atest = false; end + if ~eq(robjs2{3}, pl), atest = false; end + if ~eq(robjs2{2}, iir), atest = false; end + % Check robjs3 + if ~eq(robjs3{1}, ts1), atest = false; end + if ~eq(robjs3{3}, pl), atest = false; end + if ~eq(robjs3{2}, iir), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the abs method works with a mix of different shaped TIMESPAN + % objects as input. + % + % + function result = utp_05 + + % + % + % Tests that the bsubmit method works with a list of TIMESPAN objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = bsubmit(pl, tsm, iir, tsv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, 'binary', ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 2 + numel(tsm) + numel(tsv), atest = false; end + if numel(robjs2) ~= 2 + numel(tsm) + numel(tsv), atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, tsm(1)), atest = false; end + if ~eq(robjs1{2}, tsm(2)), atest = false; end + if ~eq(robjs1{3}, tsm(3)), atest = false; end + if ~eq(robjs1{4}, tsm(4)), atest = false; end + if ~eq(robjs1{5}, tsm(5)), atest = false; end + if ~eq(robjs1{6}, tsm(6)), atest = false; end + if ~eq(robjs1{7}, iir), atest = false; end + if ~eq(robjs1{8}, tsv(1)), atest = false; end + if ~eq(robjs1{9}, tsv(2)), atest = false; end + if ~eq(robjs1{10}, tsv(3)), atest = false; end + if ~eq(robjs1{11}, pl), atest = false; end + % Check robjs2 + if ~isequalwithequalnans(robjs1, robjs2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tthe bsubmit method properly applies history. + % + % + function result = utp_06 + + % + % + % Tthe bsubmit method properly applies history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the bsubmit method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [ids, cids] = bsubmit(ts1, ts2, sinfo, plForAutoTest); + + [o1, o2] = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + o3 = ltpda_uo.retrieve(conn, 'binary', 'Collection', cids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the output + if ~eq(o1, ts1), atest = false; end + if ~eq(o2, ts2), atest = false; end + if ~eq(o3{1}, ts1), atest = false; end + if ~eq(o3{2}, ts2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_char.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_char.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,357 @@ +% UTP_TIMESPAN_CHAR a set of UTPs for the timespan/char method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_char.m,v 1.3 2009/07/28 13:17:23 ingo Exp $ +% + +% +% +% The char method of the timespan class converts the objects into one character string +% which contains information of the object. +% +% + +function results = utp_timespan_char(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'char'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test TIMESPAN objects + [ts1, ts2, ts3, ts4, ts5, ts6, tsv, tsm] = get_test_objects_timespan; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the char method works with a vector of TIMESPAN objects as input. + % + % + function result = utp_02 + + % + % + % Test that the char method works for a vector of TIMESPAN objects as input. + % + % + + try + % + out = char(tsv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each start time + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end; + for kk = 1:numel(tsv) + if isempty(strfind(out, 'start:')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the char method works with a matrix of TIMESPAN objects as input. + % + % + function result = utp_03 + + % + % + % Test that the char method works for a matrix of TIMESPAN objects as input. + % + % + + try + % + out = char(tsm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each start time + % + % + + atest = true; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(tsm) + if isempty(strfind(out, 'start:')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the char method works with a list of TIMESPAN objects as input. + % + % + function result = utp_04 + + % + % + % Test that the char method works for a list of TIMESPAN objects as input. + % + % + + try + % + out = char(ts5,ts4,ts3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each start time + % + % + + atest = true; + tsin = [ts5,ts4,ts3]; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(tsin) + if isempty(strfind(out, 'start:')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the char method works with a mix of different shaped TIMESPAN objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the char method works with an input of matrices and vectors + % and single TIMESPAN objects. + % + % + + try + % + out = char(ts4,tsv,ts2,tsm,ts1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each start time + % + % + + atest = true; + tsin = [ts4,reshape(tsv,1,[]),ts2,reshape(tsm,1,[]),ts1]; + if stest + % + if ~ischar(out), atest = false; end; + for kk = 1:numel(tsin) + if isempty(strfind(out, 'start:')), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the char method properly applies history. + % + % + function result = utp_06 + + % + % + % The method char doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_copy.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_copy.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,50 @@ +% UTP_TIMESPAN_COPY a set of UTPs for the timespan/copy method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_copy.m,v 1.3 2009/08/08 12:21:40 hewitson Exp $ +% + +% +% +% The copy method of the timespan class copies the input object depending of the +% second input. +% +% + +function results = utp_timespan_copy(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'copy'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_69(class, 1, 1, ple2)]; + results = [results utp_69(class, 1, 3, ple2)]; + results = [results utp_69(class, 2, 3, ple2)]; + + 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 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_created.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_created.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,485 @@ +% UTP_TIMESPAN_CREATED a set of UTPs for the timespan/created method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_created.m,v 1.2 2009/07/28 13:17:23 ingo Exp $ +% + +% +% +% The created method of the timespan returns a time object of the last +% modification. For this uses the created method the 'proctime' property of +% the last history step and computs from this value a timeobject. +% +% + +function results = utp_timespan_created(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'created'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test TIMESPAN objects + [ts1, ts2, ts3, ts4, ts5, ts6, tsv, tsm] = get_test_objects_timespan; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test empty object + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the created method works with a vector of TIMESPAN objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the created method works for a vector of TIMESPAN objects as + % input. + % + % + + try + % + out = created(tsv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'tsv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if ~isequal(size(out), size(tsv)), atest = false; end + % Check the time-object + for kk=1:numel(out) + if out(kk).utc_epoch_milli ~= tsv(kk).hist.proctime, atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the created method works with a matrix of TIMESPAN objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the created method works for a matrix of TIMESPAN objects as + % input. + % + % + + try + % + out = created(tsm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'tsm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if ~isequal(size(out), size(tsm)), atest = false; end + % Check time-object + for kk=1:numel(out) + if out(kk).utc_epoch_milli ~= tsm(kk).hist.proctime, atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the created method works with a list of TIMESPAN objects as + % input. + % + % + function result = utp_04 + + % + % + % Test that the created method works for a list of TIMESPAN objects as + % input. + % + % + + try + % + out = created(ts1,ts2,ts3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if out(1).utc_epoch_milli ~= ts1.hist.proctime, atest = false; end + if out(2).utc_epoch_milli ~= ts2.hist.proctime, atest = false; end + if out(3).utc_epoch_milli ~= ts3.hist.proctime, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the created method works with a mix of different shaped + % TIMESPAN objects as input. + % + % + function result = utp_05 + + % + % + % Test that the created method works with an input of matrices and + % vectors and single TIMESPAN objects. + % + % + + try + % + out = created(ts1,tsv,ts2,tsm,ts3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + tsin = [ts1,reshape(tsv,1,[]),ts2,reshape(tsm,1,[]),ts3]; + if stest + % + % Check that the output is a time object + if ~isa(out, 'time'), atest = false; end + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(tsm)+numel(tsv)), atest = false; end + for kk=1:numel(out) + if out(kk).utc_epoch_milli ~= tsin(kk).hist.proctime, atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the created method properly applies history + % + % + function result = utp_06 + + % + % + % This method doesn't change the input object, thus no history is added + % to the object. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the created method can be used with the modify command. + % + % + function result = utp_07 + + % + % + % Tests that the created method can be used with the modify command. + % + % + + try + % + out1 = ts3.created; + out2 = tsm.created; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the single object + % 2) Check the matrix object + % + % + + atest = true; + if stest + % + % Check the single object + if out1.utc_epoch_milli ~= ts3.hist.proctime, atest = false; end + % Check the matrix + for kk = 1:numel(out2) + if out2(kk).utc_epoch_milli ~= tsm(kk).hist.proctime, atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the created method retruns always a well defined time object + % even for an empty input object. + % + % + function result = utp_08 + + % + % + % Test that the created method with an empty 'TIMESPAN object + % + % + + try + % + ts = timespan(); + out = ts.created; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a time object with a ell defined time. + % + % + + atest = true; + if stest + % + if ~isa(out, 'time'), atest = false; end + if isnan(out.utc_epoch_milli), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_creator.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_creator.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,520 @@ +% UTP_TIMESPAN_CREATED a set of UTPs for the timespan/creator method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_creator.m,v 1.2 2009/07/28 13:17:23 ingo Exp $ +% + +% +% +% The creator method of the timespan extract the creator(s)/modifier from +% the history. Depending to the input parameter returns this method all +% creator/modifier or only the last creator/modifier. +% +% + +function results = utp_timespan_creator(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'creator'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test TIMESPAN objects + [ts1, ts2, ts3, ts4, ts5, ts6, tsv, tsm] = get_test_objects_timespan; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test with different creator/modifier + results = [results utp_09]; % Test negative case for the option 'all' + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('option'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('option')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('option'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the creator method works with a vector of TIMESPAN objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the creator method works for a vector of TIMESPAN objects as + % input. + % + % + + try + % + out = creator(tsv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'tsv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(tsv), atest = false; end + % Check the creator + curr_creator = provenance(); + for kk=1:numel(out) + if ~strcmp(out{kk}, curr_creator.creator), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the creator method works with a matrix of TIMESPAN objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the creator method works for a matrix of TIMESPAN objects as + % input. + % + % + + try + % + out = creator(tsm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'tsm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= numel(tsm), atest = false; end + % Check creator + curr_creator = provenance(); + for kk=1:numel(out) + if ~strcmp(out{kk}, curr_creator.creator), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the creator method works with a list of TIMESPAN objects as + % input. + % + % + function result = utp_04 + + % + % + % The creator method doesn't work for a list of TIMESPAN objects as input. + % + % + + % + try + creator(ts1,ts2,ts3); + stest = false; + catch + stest = true; + end + % + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the creator method works with a mix of different shaped + % TIMESPAN objects as input. + % + % + function result = utp_05 + + % + % + % The creator method doesn't work with different shaped input objects. + % + % + + % + try + creator(ts1,tsv,ts2,tsm,ts3); + stest = false; + catch + stest = true; + end + % + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the creator method properly applies history + % + % + function result = utp_06 + + % + % + % This method doesn't change the input object, thus no history is added + % to the object. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to check. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the creator method can be used with the modify command. + % + % + function result = utp_07 + + % + % + % Tests that the creator method can be used with the modify command. + % + % + + try + % + out1 = ts3.creator; + out2 = tsm.creator; + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the single object + % 2) Check the matrix object + % + % + + atest = true; + if stest + % + curr_creator = provenance(); + % Check the single object + if ~strcmp(out1, curr_creator.creator), atest = false; end + % For a single object must be the the output a char string + if ~ischar(out1), atest = false; end + % Check the matrix + for kk = 1:numel(out2) + if ~strcmp(out2{kk}, curr_creator.creator), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the creator method retruns all creator(s)/modifier(s) which + % are in the history. + % + % + function result = utp_08 + + % + % + % Test that the creator method uses the option 'all' direct or in a + % plist. The test file must have the modifier 'first', 'second' and + % 'third' + % + % + + try + % + % Read object with different modifier + ts = timespan('test_timespan_diff_creator.xml'); + out1 = ts.creator; + out2 = ts.creator('all'); + out3 = ts.creator(plist('option', 'all')); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that out1 contains only one creator + % 2) Check that out2 contain more creator/modifier + % + % + + atest = true; + if stest + % + if ~ischar(out1), atest = false; end + if ~strmatch('fist', out2), atest = false; end + if ~strmatch('second', out2), atest = false; end + if ~strmatch('third', out2), atest = false; end + if ~strmatch('fist', out3), atest = false; end + if ~strmatch('second', out3), atest = false; end + if ~strmatch('third', out3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Tests the negative case for the option 'all'. + % + % + function result = utp_09 + + % + % + % Test that the creator method throws an error if the option 'all' is + % used in connection with a matrix/vector of TIMESPAN objects. + % + % + + try + % + tsm.creator('all'); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_display.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_display.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,361 @@ +% UTP_TIMESPAN_DISPLAY a set of UTPs for the timespan/display method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_display.m,v 1.3 2009/07/28 13:17:23 ingo Exp $ +% + +% +% +% The display method of the timespan class prints defined values of an TIMESPAN object. +% MATLAB calls display when it interprets an object that is not terminated +% by a semicolon. +% +% + +function results = utp_timespan_display(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'display'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test TIMESPAN objects + [ts1, ts2, ts3, ts4, ts5, ts6, tsv, tsm] = get_test_objects_timespan; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the display method works with a vector of TIMESPAN objects as input. + % + % + function result = utp_02 + + % + % + % Test that the display method works for a vector of TIMESPAN objects as input. + % + % + + try + % + tsv + out = display(tsv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + % Check the output + if ~iscell(out), atest = false; end; + for kk = 1:numel(tsv) + if isempty(strfind(out, tsv(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the display method works with a matrix of TIMESPAN objects as input. + % + % + function result = utp_03 + + % + % + % Test that the display method works for a matrix of TIMESPAN objects as input. + % + % + + try + % + tsm + out = display(tsm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(tsm) + if isempty(strfind(out, tsm(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the display method works with a list of TIMESPAN objects as input. + % + % + function result = utp_04 + + % + % + % Test that the display method works for a list of TIMESPAN objects as input. + % + % + + try + % + ts5,ts4,ts3 + out = display(ts5,ts4,ts3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + tsin = [ts5,ts4,ts3]; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(tsin) + if isempty(strfind(out, tsin(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the display method works with a mix of different shaped + % TIMESPAN objects as input. + % + % + function result = utp_05 + + % + % + % Test that the display method works with an input of matrices and vectors + % and single TIMESPAN objects as. + % + % + + try + % + out = display(ts2,tsv,ts1,tsm,ts5); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contain at least each object name + % + % + + atest = true; + tsin = [ts2,reshape(tsv,1,[]),ts1,reshape(tsm,1,[]),ts5]; + if stest + % + if ~iscell(out), atest = false; end; + for kk = 1:numel(tsin) + if isempty(strfind(out, tsin(kk).name)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the display method properly applies history. + % + % + function result = utp_06 + + % + % + % The method display doesn't change the data, thus it is not possible to + % check the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_eq.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_eq.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,590 @@ +% UTP_TIMESPAN_EQ a set of UTPs for the timespan/eq method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_eq.m,v 1.12 2011/04/19 18:14:02 ingo Exp $ +% + +% +% +% The eq() method of the timespan class ts1 == ts2 compares each element of an +% ts object with the corresponding element of an second ts object and returns +% a logical 1 (true) where ts1 and ts2 are equal, or logical 0 (false) +% where they are not equal. +% +% + +function results = utp_timespan_eq(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'eq'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test TIMESPAN objects + [ts1, ts2, ts3, ts4, ts5, ts6, tsv, tsm] = get_test_objects_timespan; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test with the exception list 'name' + results = [results utp_08]; % Test with the exception list 'endT' + results = [results utp_09]; % Test with the exception list 'startT' + results = [results utp_12]; % Test exception list in a plist + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check number of SETS + if numel(io(2).sets) ~= 1, atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + % SET 'Default' + % Check key + if ~io(3).plists.isparam('Exceptions'), atest = false; end + if ~io(3).plists.isparam('Tol'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('Exceptions'), {}), atest = false; end + if ~isequal(io(3).plists.find('Tol'), eps(1)), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('Exceptions'), {{}}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('Tol'), {eps(1)}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the eq method works with a vector of TIMESPAN objects as input. + % + % + function result = utp_02 + + % + % + % Test that the eq method works for a vector of TIMESPAN objects as input. + % Test the positive and the negative case. + % + % + + try + % + ts = ts3.setName('my name'); + tsv1 = [ts5, ts4, ts2, ts3]; + tsv2 = [ts5, ts4, ts2, ts]; + out1 = eq(tsv1, tsv1); + out2 = eq(tsv1, tsv2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the eq function. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the eq method works with a matrix of TIMESPAN objects as input. + % + % + function result = utp_03 + + % + % + % Test that the eq method works for a matrix of TIMESPAN objects as input. + % Test the positive and the negative case. + % + % + + try + % + ts = ts3.setName('my name'); + tsm1 = [ts5, ts4, ts3, ts3, ts2, ts5]; + tsm2 = [ts5, ts4, ts; ts3, ts2, ts5]; + out1 = eq(tsm1, tsm1); + out2 = eq(tsm1, tsm2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the eq function. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the eq method works with a list of TIMESPAN objects as input. + % + % + function result = utp_04 + + % + % + % The eq method doesn't works for a list of TIMESPAN objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the eq method works with a mix of different shaped TIMESPAN objects + % as input. + % + % + function result = utp_05 + + % + % + % The eq method doesn't works for a list of TIMESPAN objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the eq method properly applies history. + % + % + function result = utp_06 + + % + % + % The eq method doesn't change the TIMESPAN object, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_07 + + % + % + % Test the eq method with the exception 'name'. Use the option 'internal' to + % suppress the history. It is necessary to add 'created' to the exception + % list because ts is created at an other time. + % + % + + try + % + ts = testCallerIsMethod(@setName, ts3, 'my name'); + out1 = eq(ts, ts3); + out2 = eqLocal(ts, ts3, 'name'); + out3 = eqLocal(ts, ts3, 'timespan/name'); + out4 = eq(ts.hist, ts3.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_08 + + % + % + % Test the eq method with the exception 'endt'. Use the option 'internal' to + % suppress the history. It is necessary to add 'created' to the exception + % list because ts is created at an other time. + % + % + + try + % + ts = testCallerIsMethod(@setEndT, ts3, time(1234)); + out1 = eq(ts, ts3); + out2 = eqLocal(ts, ts3, 'endT'); + out3 = eqLocal(ts, ts3, 'timespan/endT'); + out4 = eq(ts.hist, ts3.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Test the eq method with an exception list. + % With the LTPDA toolbox 2.0 it is only possible to test the exception list + % with properties where a public set method exist. + % + % + function result = utp_09 + + % + % + % Test the eq method with the exception 'startT'. Use the option 'internal' + % to suppress the history. It is necessary to add 'created' to the exception + % list because ts is created at an other time. + % + % + + try + % + ts = testCallerIsMethod(@setStartT, ts3, time(1234)); + out1 = eq(ts, ts3); + out2 = eqLocal(ts, ts3, 'startT'); + out3 = eqLocal(ts, ts3, 'timespan/startT'); + out4 = eq(ts.hist, ts3.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + + %% UTP_12 + + % + % + % Test the eq method with an exception list which is in a plist. + % + % + function result = utp_12 + + % + % + % Test that the eq method uses the exception list in a plist. + % + % + + try + % + ts = testCallerIsMethod(@setName, ts3, 'my name'); + pl = plist('Exceptions', {'name', 'UUID'}); + out1 = eq(ts, ts3); + out2 = eq(ts, ts3, pl); + out3 = eq(ts, ts3, pl); + out4 = eq(ts.hist, ts3.hist); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + if out3 ~= 1, atest = false; end + if out4 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + function res = eqLocal(obj1, obj2, ex) + e = ple1.find('EXCEPTIONS'); + if ~iscell(e) + e = cellstr(e); + end + if ~iscell(ex) + ex = cellstr(ex); + end + ple = plist('EXCEPTIONS', [e, ex, {'interval', 'time_str'}]); + + res = eq(obj1, obj2, ple); + end +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_get.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_get.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,289 @@ +% UTP_TIMESPAN_GET a set of UTPs for the timespan/get method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_get.m,v 1.3 2011/03/29 13:03:29 ingo Exp $ +% + +% +% +% The get method of the timespan class returns the value of an object +% property. This is a very simple method which accepts only one timespan as +% input thus are the most general units test not possible. +% +% + +function results = utp_timespan_get(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'get'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Algorithm test + results = [results utp_03]; % Algorithm test with a plist + results = [results utp_04]; % Negative test with more than one timespan + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('property'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('property')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('property'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests the get method of the timespan class. + % + % + function result = utp_02 + + % + % + % Test that the get returns returns the value of the specified + % property. Do this for all properties of the TIMESPAN object. + % + % + + try + % + ts = timespan('2008-08-08 12:00:00', '2008-08-08 13:00:00'); + out1 = get(ts, 'startT'); + out2 = get(ts, 'endT'); + out3 = get(ts, 'timeformat'); + out4 = get(ts, 'timezone'); + out5 = get(ts, 'interval'); + out7 = get(ts, 'hist'); + out8 = get(ts, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the correct value of the output + % + % + + atest = true; + if stest + % + if ~eq(out1, ts.startT), atest = false; end + if ~eq(out2, ts.endT), atest = false; end + if ~isequal(out3, ts.timeformat), atest = false; end + if ~isequal(out4, ts.timezone), atest = false; end + if ~isequal(out5, ts.interval), atest = false; end + if ~eq(out7, ts.hist), atest = false; end + if ~isequal(out8, ts.name), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the get method works with a plist. + % + % + function result = utp_03 + + % + % + % Test that the get returns returns the value of the specified + % property which is defined in a plist. + % + % + + try + % + ts = timespan('2008-08-08 12:00:00', '2008-08-08 13:00:00'); + pl1 = plist('property', 'startT'); + pl2 = plist('property', 'endT'); + pl3 = plist('property', 'timeformat'); + pl4 = plist('property', 'timezone'); + pl5 = plist('property', 'interval'); + pl7 = plist('property', 'hist'); + pl8 = plist('property', 'name'); + out1 = get(ts, pl1); + out2 = get(ts, pl2); + out3 = get(ts, pl3); + out4 = get(ts, pl4); + out5 = get(ts, pl5); + out7 = get(ts, pl7); + out8 = get(ts, pl8); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the correct value of the output + % + % + + atest = true; + if stest + % + if ~eq(out1, ts.startT), atest = false; end + if ~eq(out2, ts.endT), atest = false; end + if ~isequal(out3, ts.timeformat), atest = false; end + if ~isequal(out4, ts.timezone), atest = false; end + if ~isequal(out5, ts.interval), atest = false; end + if ~eq(out7, ts.hist), atest = false; end + if ~isequal(out8, ts.name), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests the get method of the timespan class. + % + % + function result = utp_04 + + % + % + % Test that the get throws an error if the input are more than + % one TIMESPAN object. + % + % + + try + % + ts = timespan('2008-08-08 12:00:00', '2008-08-08 13:00:00'); + out = get([ts, ts], 'name'); + stest = false; + % + catch + stest = true; + end + + % + % + % 1) Nothing to test + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_index.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_index.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,525 @@ +% UTP_TIMESPAN_INDEX a set of UTPs for the timespan/index method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_index.m,v 1.4 2009/07/28 17:12:38 ingo Exp $ +% + +% +% +% The index method of the timespan class index into a TIMESPAN vector or +% matrix. This properly captures the history. +% +% + +function results = utp_timespan_index(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'index'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test TIMESPAN objects + [ts1, ts2, ts3, ts4, ts5, ts6, tsv, tsm] = get_test_objects_timespan; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test history is working + results = [results utp_06]; % Test the modify call works + results = [results utp_07]; % Test with plist + results = [results utp_08]; % Test select more objects with an index + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('i'), atest = false; end + if ~io(3).plists.isparam('j'), atest = false; end + % Check default value + if ~isEmptyDouble(io(3).plists.find('i')), atest = false; end + if ~isEmptyDouble(io(3).plists.find('j')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('i'), {[]}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('j'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the index method works with a vector of TIMESPAN objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the index method works for a vector of TIMESPAN objects as + % input. The following indexing should work: + % I = [ 1 2 3 ] or (I/J) = [(1,1), (1,2), (1,3)] + % + % + + try + % + objvec = [ts1, ts2, ts3]; + out1 = objvec.index(1); + out2 = objvec.index(3); + out3 = objvec.index(1,2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the index method selects the correct object. + % + % + + atest = true; + if stest + % + if ~eq(out1, ts1, ple3), atest = false; end + if ~eq(out2, ts3, ple3), atest = false; end + if ~eq(out3, ts2, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the index method works with a matrix of TIMESPAN objects as + % input. + % + % + function result = utp_03 + + % + % + % Test that the index method works for a matrix of TIMESPAN objects as + % input. The following indexing should work: + % I = [ 1 3 5 ] or (I/J) = [(1,1), (1,2), (1,3)] + % [ 2 4 6 ] [(2,1), (2,2), (2,3)] + % + + try + % + objmat = [ts1, ts2, ts3; ... + ts4, ts5, ts6]; + out1 = objmat.index(5); + out2 = objmat.index(4); + out3 = objmat.index(1,2); + out4 = objmat.index(2,1); + out5 = objmat.index(2,2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the index method selects the correct object. + % + % + + atest = true; + if stest + % + if ~eq(out1, ts3, ple3), atest = false; end + if ~eq(out2, ts5, ple3), atest = false; end + if ~eq(out3, ts2, ple3), atest = false; end + if ~eq(out4, ts4, ple3), atest = false; end + if ~eq(out5, ts5, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the index method works with a list of TIMESPAN objects as + % input. + % + % + function result = utp_04 + + % + % + % The index method doesn't work for a list of TIMESPAN objects as input. + % + % + + try + % + out = index(ts1,ts2,ts3, 4); + % + stest = false; + catch + stest = true; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the index method properly applies history. + % + % + function result = utp_05 + + % + % + % Test that the result of index have an additional history step. + % + % + + try + % + i = 2; + j = 3; + objmat = [ts1, ts2, ts3; ... + ts3, ts1, ts2]; + out = index(objmat, i, j); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds + % to 'index'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'index'), atest = false; end + % Check that the history-plist contains the used indices. + pl = out.hist.plistUsed; + if pl.find('i') ~= i, atest = false; end + if pl.find('j') ~= j, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the index method works for the modifier command. + % + % + function result = utp_06 + + % + % + % Tests that the index method works for the modifier command. + % + % + + try + % + i = 1; + j = 1; + objmat = [ts1, ts2, ts3; ... + ts3, ts1, ts2]; + out1 = index(objmat, i, j); + out2 = objmat.index(i,j); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history-plist contains the used indices. + % 2) Check that the index method selects the correct object + % + % + + atest = true; + if stest + % + % Check that the history-plist contains the used indices. + pl = out1.hist.plistUsed; + if pl.find('i') ~= i, atest = false; end + if pl.find('j') ~= j, atest = false; end + % Check that the index method selects the correct object + if ~eq(out1, ts1, ple3), atest = false; end + % Check that the history-plist contains the used indices. + pl = out2.hist.plistUsed; + if pl.find('i') ~= i, atest = false; end + if pl.find('j') ~= j, atest = false; end + % Check that the index method selects the correct object + if ~eq(out2, ts1, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Control the method with a plist. + % + % + function result = utp_07 + + % + % + % Test that the index method can be controled with a plist. + % + % + + try + % + i1 = 6; + i2 = 1; + j2 = 3; + objmat = [ts1, ts2, ts3; ... + ts3, ts1, ts2]; + pl1 = plist('i', i1); + pl2 = plist('i', i2, 'j', j2); + out1 = index(objmat, pl1); + out2 = index(objmat, pl2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history-plist contains the used indices. + % 2) Check that the index method selects the correct object + % + % + + atest = true; + if stest + % + % Check that the history-plist contains the used indices. + pl = out1.hist.plistUsed; + if ~isequal(pl.find('i'), i1), atest = false; end + if ~isequal(pl.find('j'), []), atest = false; end + % Check that the index method selects the correct object + if ~eq(out1, ts2, ple3), atest = false; end + % Check that the history-plist contains the used indices. + pl = out2.hist.plistUsed; + if ~isequal(pl.find('i'), i2), atest = false; end + if ~isequal(pl.find('j'), j2), atest = false; end + % Check that the index method selects the correct object + if ~eq(out2, ts3, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test that the index method selects more objects if I have more indices. + % + % + function result = utp_08 + + % + % + % Test that the index method selects more objects if I have more indices. + % + % + + try + % + i = [2 6]; + objmat = [ts1, ts2, ts3; ... + ts3, ts1, ts2]; + pl = plist('i', i); + out1 = objmat.index(i); + out2 = objmat.index(pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history-plist contains the used indices. + % 2) Check that the index method selects the correct object + % + % + + atest = true; + if stest + % + % Check that the history-plist contains the used indices. + pl = out1(1).hist.plistUsed; + if ~isequal(pl.find('i'), i), atest = false; end + if ~isequal(pl.find('j'), []), atest = false; end + % Check that the index method selects the correct object + if ~eq(out1(1), ts3, ple3), atest = false; end + if ~eq(out1(2), ts2, ple3), atest = false; end + % Check that the history-plist contains the used indices. + pl = out2(2).hist.plistUsed; + if ~isequal(pl.find('i'), i), atest = false; end + if ~isequal(pl.find('j'), []), atest = false; end + % Check that the index method selects the correct object + if ~eq(out2(1), ts3, ple3), atest = false; end + if ~eq(out2(2), ts2, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_isprop.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_isprop.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,477 @@ +% UTP_TIMESPAN_ISPROP a set of UTPs for the timespan/isprop method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_isprop.m,v 1.5 2011/03/29 13:13:33 ingo Exp $ +% + +% +% +% The isprop method of the timespan class determine whether input is object property. +% +% + +function results = utp_timespan_isprop(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'isprop'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test TIMESPAN objects + [ts1, ts2, ts3, ts4, ts5, ts6, tsv, tsm] = get_test_objects_timespan; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test negative case + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the isprop method works with a vector of TIMESPAN objects as input. + % + % + function result = utp_02 + + % + % + % Test that the isprop method works for a vector of TIMESPAN objects as input. + % + % + + try + % + out = isprop(tsv, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'tsv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(tsv)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the isprop method works with a matrix of TIMESPAN objects as input. + % + % + function result = utp_03 + + % + % + % Test that the isprop method works for a matrix of TIMESPAN objects as input. + % + % + + try + % + out = isprop(tsm, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'tsm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(tsm)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the isprop method works with a list of TIMESPAN objects as input. + % + % + function result = utp_04 + + % + % + % Test that the isprop method works for a list of TIMESPAN objects as input. + % + % + + try + % + out = isprop(ts5,ts4,ts3, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the isprop method works with a mix of different shaped + % TIMESPAN objects as input. + % + % + function result = utp_05 + + % + % + % Test that the isprop method works with an input of matrices and vectors + % and single TIMESPAN objects. + % + % + + try + % + out = isprop(ts5,tsv,ts4,tsm,ts3, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(tsm)+numel(tsv)), atest = false; end + % Check each output + if ~all(out), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the isprop method properly applies history. + % + % + function result = utp_06 + + % + % + % The method isprop doesn't change the object, thus it is not necessary to + % apply history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the isprop method works for each property. + % + % + function result = utp_07 + + % + % + % Test that the isprop method works for the properties: + % startT', 'endT', 'timeformat', 'timezone', 'interval' + % 'hist' and 'name' + % + % + + try + % + % copy ts5 to work with + out1 = isprop(ts5, 'startT'); + out2 = isprop(ts5, 'endT'); + out3 = isprop(ts5, 'timeformat'); + out4 = isprop(ts5, 'timezone'); + out5 = isprop(ts5, 'interval'); + out7 = isprop(ts5, 'hist'); + out8 = isprop(ts5, 'name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if ~out1, atest = false; end; + if ~out2, atest = false; end; + if ~out3, atest = false; end; + if ~out4, atest = false; end; + if ~out5, atest = false; end; + if ~out7, atest = false; end; + if ~out8, atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the negative case and the not function command. + % + % + function result = utp_08 + + % + % + % Test that the isprop method retrun false for a unknown property and for + % methods of the object. + % + % + + try + % + out1 = isprop(ts2, 'foo'); + out2 = ts2.isprop('foo'); + out3 = ts2.isprop('name'); + out4 = ts2.isprop('type'); + out5 = ts2.isprop('char'); + out6 = ts2.isprop('creator'); + out7 = ts2.isprop('created'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if out1, atest = false; end; + if out2, atest = false; end; + if ~out3, atest = false; end; + if out4, atest = false; end; + if out5, atest = false; end; + if out6, atest = false; end; + if out7, atest = false; end; + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_loadobj.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_loadobj.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,151 @@ +% UTP_TIMESPAN_LOADOBJ a set of UTPs for the timespan/loadobj method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_loadobj.m,v 1.2 2009/01/08 16:46:24 ingo Exp $ +% + +% +% +% The loadobj method of the timespan class will be automatically called by +% MATLAB if an older object is not compatible with the current object structure. +% This happens only for objects which are stored as a MATLAB formatted +% (MAT-file). The load mechanism for XML formated files calls always the +% 'update_struct' method to keep the stored objects up to date. The +% 'update_struct' method convert the read object structure to the object +% structure which is used in the currend LTPDA version. +% This UTP will load old objects which are stored with an older LTPDA version. +% +% REMARK: Since LTPDA version 1.9.2 will be an object which should be saved as a +% MAT file stored as a struct and not as the object. +% +% + +function results = utp_timespan_loadobj(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'loadobj'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Run the tests + results = [results utp_01]; % getInfo call + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Get all .MAT and .XML files + path = fullfile(fileparts(which(mfilename)), '..', '..', 'utp_test_files'); + + matfiles = utils.prog.filescan(path, '.mat'); + xmlfiles = utils.prog.filescan(path, '.xml'); + + % Load .MAT files + obj_no = 1; + for ii=1:numel(matfiles) + fn = matfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = timespan(fn); + obj_no = obj_no+1; + end + end + + % Load .XML files + for ii=1:numel(xmlfiles) + fn = xmlfiles{ii}; + [path, name] = fileparts(fn); + cl = strtok(name, '_'); + + if strcmp(cl, class) + objs(obj_no).fname = name; + objs(obj_no).obj = timespan(fn); + obj_no = obj_no+1; + end + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the shape of the loaded objects. + % + % + + atest = true; + if stest + % + for ii = 1:numel(objs) + obj = objs(ii).obj; + fname = objs(ii).fname; + + if ~isempty(strfind(fname, '_vec')) + % Loaded object must be a vector + if ~isvector(obj), atest = false; end + elseif ~isempty(strfind(fname, '_mat')) + % Loaded object must be a matrix + % REMARK: Known error in LTPDA version 1.9.2 + % A saved matrix doesn't keep the shape of the matrix. + if isempty(strfind(fname, '_192')) + if ~(size(obj,1) > 1 && size(obj,2) > 1), atest = false; end + end + else + % Loaded object must be a single object + if ~(size(obj,1) == 1 && size(obj,2) == 1), + atest = false; end + end + + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_ne.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_ne.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,455 @@ +% UTP_TIMESPAN_NE a set of UTPs for the timespan/ne method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_ne.m,v 1.6 2011/04/19 18:14:02 ingo Exp $ +% + +% +% +% The ne() method of the timespan class ts1 ~= ts2 compares each element of an +% timespan object with the corresponding element of an second ts object and returns +% a logical 1 (true) where ts1 and ts2 are not equal, or logical 0 (false) +% where they are equal. +% +% + +function results = utp_timespan_ne(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'ne'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test TIMESPAN objects + [ts1, ts2, ts3, ts4, ts5, ts6, tsv, tsm] = get_test_objects_timespan; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test with the exception list 'name' + results = [results utp_08]; % Test exception list in a plist + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the ne method works with a vector of TIMESPAN objects as input. + % + % + function result = utp_02 + + % + % + % Test that the ne method works for a vector of TIMESPAN objects as input. + % Test the positive and the negative case. + % + % + + try + % + ts = ts3.setName('my name'); + tsv1 = [ts5, ts4, ts2, ts3]; + tsv2 = [ts5, ts4, ts2, ts]; + out1 = ne(tsv1, tsv1); + out2 = ne(tsv1, tsv2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the ne function. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the ne method works with a matrix of TIMESPAN objects as input. + % + % + function result = utp_03 + + % + % + % Test that the ne method works for a matrix of TIMESPAN objects as input. + % Test the positive and the negative case. + % + % + + try + % + ts = ts3.setName('my name'); + tsm1 = [ts5, ts4, ts3, ts3, ts2, ts5]; + tsm2 = [ts5, ts4, ts; ts3, ts2, ts5]; + out1 = ne(tsm1, tsm1); + out2 = ne(tsm1, tsm2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output of the ne function. + % + % + + atest = true; + if stest + % + if out1 ~= 0, atest = false; end + if out2 ~= 1, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the ne method works with a list of TIMESPAN objects as input. + % + % + function result = utp_04 + + % + % + % The ne method doesn't works for a list of TIMESPAN objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the ne method works with a mix of different shaped TIMESPAN objects + % as input. + % + % + function result = utp_05 + + % + % + % The ne method doesn't works for a list of TIMESPAN objects as input. + % Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the ne method properly applies history. + % + % + function result = utp_06 + + % + % + % The ne method doesn't change the TIMESPAN object, thus will no history added. + % Nothing to do + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Test the ne method with an exception list. + % The function timespan/ne use the function timespan/eq so it is not + % necessary to check all possibilities of the exception list. + % + % + function result = utp_07 + + % + % + % Test the ne method with the exception 'name'. Use the option 'internal' to + % suppress the history. It is necessary to add 'created' to the exception + % list because ts is created at an other time. + % + % + + try + % + ts = testCallerIsMethod(@setName, ts3, 'my name'); + out1 = ne(ts, ts3); + out2 = ne(ts, ts3, 'name', 'created', 'UUID'); + out3 = ne(ts, ts3, 'timespan/name', 'created', 'UUID'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + if out3 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Test the ne method with an exception list which is in a plist. + % + % + function result = utp_08 + + % + % + % Test that the ne method uses the exception list in a plist. + % + % + + try + % + ts = testCallerIsMethod(@setName, ts3, 'my name'); + pl = plist('Exceptions', {'name', 'created', 'UUID'}); + out1 = ne(ts, ts3); + out2 = ne(ts, ts3, pl); + out3 = ne(ts, ts3, pl); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check the shape of the output data + if out1 ~= 1, atest = false; end + if out2 ~= 0, atest = false; end + if out3 ~= 0, atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_rebuild.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_rebuild.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,413 @@ +% UTP_TIMESPAN_REBUILD a set of UTPs for the timespan/timespan method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_rebuild.m,v 1.3 2009/07/28 13:17:23 ingo Exp $ +% + +% +% +% The rebuild method of the timespan class rebuilds the input objects using the +% history. This method is also intensively tested in the most other UTPs. +% +% + +function results = utp_timespan_rebuild(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'rebuild'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test TIMESPAN objects + [ts1, ts2, ts3, ts4, ts5, ts6, tsv, tsm] = get_test_objects_timespan; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the output + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the rebuild method works with a vector of TIMESPAN objects as input. + % + % + function result = utp_02 + + % + % + % Test that the rebuild method works for a vector of TIMESPAN objects as input. + % + % + + try + % + out = rebuild(tsv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + % Check the output + if ~isa(out, 'timespan'), atest = false; end; + for kk = 1:numel(tsv) + if eq(out(kk), tsv(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the rebuild method works with a matrix of TIMESPAN objects as input. + % + % + function result = utp_03 + + % + % + % Test that the rebuild method works for a matrix of TIMESPAN objects as input. + % + % + + try + % + out = rebuild(tsm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + if ~isa(out, 'timespan'), atest = false; end; + for kk = 1:numel(tsm) + if eq(out(kk), tsm(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the rebuild method works with a list of TIMESPAN objects as input. + % + % + function result = utp_04 + + % + % + % Test that the rebuild method works for a list of TIMESPAN objects as input. + % + % + + try + % + out = rebuild(ts5,ts4,ts3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + tsin = [ts5,ts4,ts3]; + if stest + % + if ~isa(out, 'timespan'), atest = false; end; + for kk = 1:numel(tsin) + if eq(out(kk), tsin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the rebuild method works with a mix of different shaped TIMESPAN objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the rebuild method works with an input of matrices and vectors + % and single TIMESPAN objects. + % + % + + try + % + out = rebuild(ts4,tsv,ts2,tsm,ts1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + tsin = [ts4,reshape(tsv,1,[]),ts2,reshape(tsm,1,[]),ts1]; + if stest + % + if ~isa(out, 'timespan'), atest = false; end; + for kk = 1:numel(tsin) + if eq(out(kk), tsin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the rebuild method properly applies history. + % + % + function result = utp_06 + + % + % + % The method rebuild doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the rebuild method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = rebuild(ts1, ts2); + o3 = rebuild(ts1, ts2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, ts1, ple2), atest = false; end + if ~eq(o2, ts2, ple2), atest = false; end + if ~eq(o3, [ts1 ts2], ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_save.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_save.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,557 @@ +% UTP_TIMESPAN_SAVE a set of UTPs for the timespan/save method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_save.m,v 1.6 2010/09/06 08:05:40 hewitson Exp $ +% + +% +% +% The save method of the timespan class saves a timespan object to disk. Save stores +% the variables in a MATLAB formatted file (MAT-file) named filename.mat or in a +% XML fromat named filename.xml +% +% + +function results = utp_timespan_save(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'save'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test TIMESPAN objects + [ts1, ts2, ts3, ts4, ts5, ts6, tsv, tsm] = get_test_objects_timespan; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Test plist contains the filename + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(3).plists.isparam('filename'), atest = false; end + if ~io(3).plists.isparam('prefix'), atest = false; end + if ~io(3).plists.isparam('postfix'), atest = false; end + if ~io(3).plists.isparam('individual files'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('filename'), ''), atest = false; end + if ~isequal(io(3).plists.find('prefix'), ''), atest = false; end + if ~isequal(io(3).plists.find('postfix'), ''), atest = false; end + if ~isequal(io(3).plists.find('individual files'), false), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('filename'), {[]}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the save method works with a vector of TIMESPAN objects as input. + % + % + function result = utp_02 + + % + % + % Test that the save method works for a vector of TIMESPAN objects as input. + % Test both formats 'xml' and 'mat'. + % + % + + try + % + save(tsv, 'test.xml'); + save(tsv, 'test.mat'); + out1 = timespan('test.xml'); + out2 = timespan('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the same + % as in 'tsv' + % 2) Check that the loaded objects are the same as the saved objects. + % 3) The outputs 'out1' and 'out2' must be the same. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(tsv)), atest = false; end + if ~isequal(size(out2), size(tsv)), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(tsv(kk), out1(kk), ple1), atest = false; end + if ~eq(tsv(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the save method works with a matrix of TIMESPAN objects as input. + % + % + function result = utp_03 + + % + % + % Test that the save method works for a matrix of TIMESPAN objects as input. + % Test both formats 'xml' and 'mat'. + % + % + + try + % + save(tsm, 'test.xml'); + save(tsm, 'test.mat'); + out1 = timespan('test.xml'); + out2 = timespan('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the same + % as in 'tsm' + % 2) Check that the loaded objects are the same as the saved objects. + % 3) The outputs 'out1' and 'out2' must be the same. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out1), size(tsm)), atest = false; end + if ~isequal(size(out2), size(tsm)), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(tsm(kk), out1(kk), ple1), atest = false; end + if ~eq(tsm(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the save method works with a list of TIMESPAN objects as input. + % + % + function result = utp_04 + + % + % + % Test that the save method works for a list of TIMESPAN objects as input. + % Test both formats 'xml' and 'mat'. + % + % + + try + % + save(ts5, ts4, ts3, 'test.xml'); + save(ts5, ts4, ts3, 'test.mat'); + out1 = timespan('test.xml'); + out2 = timespan('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out1' and 'out2' are the same + % as in the list + % 2) Check that the loaded objects are the same as the saved objects. + % 3) The outputs 'out1' and 'out2' must be the same except. + % + % + + atest = true; + tsin = [ts5, ts4, ts3]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 3, atest = false; end + if numel(out2) ~= 3, atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(tsin(kk), out1(kk), ple1), atest = false; end + if ~eq(tsin(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the save method works with a mix of different shaped TIMESPAN objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the save method works with an input of matrices and vectors + % and single TIMESPAN objects. Test both formats 'xml' and 'mat'. + % + % + + try + % + save(ts5,tsv,ts4, 'test.xml'); + save(ts5,tsv,ts4, 'test.mat'); + out1 = timespan('test.xml'); + out2 = timespan('test.mat'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output TIMESPAN object contains the correct data. + % + % + + atest = true; + tsin = [ts5, reshape(tsv, 1, []), ts4]; + if stest + % + % Check we have the correct number of outputs + if numel(out1) ~= 2+numel(tsv), atest = false; end + if numel(out2) ~= 2+numel(tsv), atest = false; end + % Check each output against the input + for kk=1:numel(out1) + if ~eq(tsin(kk), out1(kk), ple1), atest = false; end + if ~eq(tsin(kk), out2(kk), ple1), atest = false; end + end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the save method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the save method can be processed back + % to an m-file. Do this for both extensions 'mat' and 'xml' + % + % + + try + % + out1 = save(ts2, 'test.xml'); + out2 = save(ts4, 'test.mat'); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the history applies to the output object. Check that + % save doesn't add a history step to the input object. + % 2) Check that the read object doesn't contain the save + load history steps. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % The last history step is not the save method + if ~eq(out1, ts2, ple1), atest = false; end + if ~eq(out2, ts4, ple1), atest = false; end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + % delete test file + delete('test.xml') + delete('test.mat') + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the save method works with the modify command. + % + % + function result = utp_07 + + % + % + % Use the save method with the modifier command. + % + % + + try + % + % copy ts5 to work with + ts_mat = timespan(ts5); + ts_mat.save('test.mat'); + ts_xml = timespan(ts5); + ts_xml.save('test.xml'); + out1 = timespan('test.mat'); + out2 = timespan('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the save method doesn't apply the history. + % 2) Check the output against the input. + % 3) Check the history of the output against the input. + % + % + + atest = true; + if stest + % + % Check the output + if ~eq(ts_mat, out1, ple1), atest = false; end + if ~eq(ts_xml, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Control the method with a plist. + % + % + function result = utp_08 + + % + % + % Test that the save method uses the filename which is stored in a plist. + % + % + + try + % + pl1 = plist('filename', 'test.mat'); + pl2 = plist('filename', 'test.xml'); + save(ts5, pl1); + save(ts5, pl2); + out1 = timespan('test.mat'); + out2 = timespan('test.xml'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % + % + + atest = true; + if stest + % + % Check the output + if ~eq(ts5, out1, ple1), atest = false; end + if ~eq(ts5, out2, ple1), atest = false; end + % Compare the outputs + if ~eq(out1, out2, ple2), atest = false; end + % + delete('test.xml'); + delete('test.mat'); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_setEndT.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_setEndT.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,618 @@ +% UTP_TIMESPAN_SETENDT a set of UTPs for the timespan/setEndT method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_setEndT.m,v 1.6 2011/04/19 18:14:02 ingo Exp $ +% + +% +% +% The setEndT method of the timespan class sets the name property. +% +% + +function results = utp_timespan_setEndT(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'setEndT'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test TIMESPAN objects + [ts1, ts2, ts3, ts4, ts5, ts6, tsv, tsm] = get_test_objects_timespan; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Use different inputs (char, time-objects, double) + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('endt'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('endt')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('endt'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setEndT method works with a vector of TIMESPAN objects as input. + % + % + function result = utp_02 + + % + % + % Test that the setEndT method works for a vector of TIMESPAN objects as input. + % + % + + try + % + out = setEndT(tsv, time(12345)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'tsv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(tsv)), atest = false; end + % Check name field of each output + for kk=1:numel(out) + if ~eq(out(kk).endT, time(12345), ple1), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setEndT method works with a matrix of TIMESPAN objects as input. + % + % + function result = utp_03 + + % + % + % Test that the setEndT method works for a matrix of TIMESPAN objects as input. + % + % + + try + % + out = setEndT(tsm, time(12345)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'tsm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(tsm)), atest = false; end + % Check name field of each output + for kk=1:numel(out) + if ~eq(out(kk).endT, time(12345), ple1), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setEndT method works with a list of TIMESPAN objects as input. + % + % + function result = utp_04 + + % + % + % Test that the setEndT method works for a list of TIMESPAN objects as input. + % + % + + try + % + out = setEndT(ts5,ts4,ts3, time(12345)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~eq(out(1).endT, time(12345), ple1), atest = false; end + if ~eq(out(2).endT, time(12345), ple1), atest = false; end + if ~eq(out(3).endT, time(12345), ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setEndT method works with a mix of different shaped TIMESPAN + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the setEndT method works with an input of matrices and vectors + % and single TIMESPAN objects. + % + % + + try + % + out = setEndT(ts5,tsv,ts4,tsm,ts3, time(12345)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(tsm)+numel(tsv)), atest = false; end + for kk=1:numel(out) + if ~eq(out(kk).endT, time(12345), ple1), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setEndT method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setEndT method can be processed back + % to an m-file. + % + % + + try + % + out1 = setEndT(timespan(ts5), time(12345)); + out2 = testCallerIsMethod(@setEndT, timespan(ts5), time(12345)); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setEndT'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setEndT'. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setEndT') && ... + eq(out1.hist.plistUsed, plist('endT', time(12345)), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('endT', time(12345)), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, timespan(ts5), ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setEndT method can modify the input TIMESPAN object. + % + % + function result = utp_07 + + % + % + % Test that the setEndT method can modify the input TIMESPAN object + % by calling with no output. + % + % + + try + % + % copy ts5 to work with + ain = timespan(ts5); + % modify ain + aout = ain.setEndT(time(12345)); + ain.setEndT(time(12345)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ts5' and 'ain' are now different. + % 2) Check that 'ain' has the correct name field + % + % + + atest = true; + if stest + % + % Check that setEndT modified the input by comparing to the copy + if eq(timespan(ts5), ain, ple1), atest = false; end + % Check that setEndT doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~eq(ain.endT, time(12345), ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setEndT method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setEndT method can modify the property 'endT' + % with a value in a plist. + % + % + + try + % + pl = plist('endT', time(12345)); + out = ts5.setEndT(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct name field + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'endT' + if ~eq(out.endT, time(12345), ple1), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setEndT method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setEndT(ts5, ts2, time(12345)); + o3 = setEndT(ts5, ts2, time(12345)); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the setEndT method accept different inputs. + % + % + function result = utp_10 + + % + % + % Test that the setEndT method accept input of double, char and + % time-objects. + % + % + + try + % + o1 = setEndT(ts5, time(54321)); + o2 = setEndT(ts5, '14:00:00'); + o3 = setEndT(ts5, 54321); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if ~eq(o1.endT, time(54321), ple1), atest = false; end + if ~eq(o2.endT, time('14:00:00'), ple1), atest = false; end + if ~eq(o3.endT, time(54321), ple1), atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_setName.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_setName.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,561 @@ +% UTP_TIMESPAN_SETNAME a set of UTPs for the timespan/setName method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_setName.m,v 1.6 2011/04/19 18:14:02 ingo Exp $ +% + +% +% +% The setName method of the timespan class sets the name property. +% +% + +function results = utp_timespan_setName(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'setName'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test TIMESPAN objects + [ts1, ts2, ts3, ts4, ts5, ts6, tsv, tsm] = get_test_objects_timespan; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('name'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('name')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('name'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setName method works with a vector of TIMESPAN objects as input. + % + % + function result = utp_02 + + % + % + % Test that the setName method works for a vector of TIMESPAN objects as input. + % + % + + try + % + out = setName(tsv, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'tsv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(tsv)), atest = false; end + % Check name field of each output + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setName method works with a matrix of TIMESPAN objects as input. + % + % + function result = utp_03 + + % + % + % Test that the setName method works for a matrix of TIMESPAN objects as input. + % + % + + try + % + out = setName(tsm, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'tsm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(tsm)), atest = false; end + % Check name field of each output + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setName method works with a list of TIMESPAN objects as input. + % + % + function result = utp_04 + + % + % + % Test that the setName method works for a list of TIMESPAN objects as input. + % + % + + try + % + out = setName(ts5,ts4,ts3, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~strcmp(out(1).name, 'my name'), atest = false; end + if ~strcmp(out(2).name, 'my name'), atest = false; end + if ~strcmp(out(3).name, 'my name'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setName method works with a mix of different shaped TIMESPAN + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the setName method works with an input of matrices and vectors + % and single TIMESPAN objects. + % + % + + try + % + out = setName(ts5,tsv,ts4,tsm,ts3, 'my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(tsm)+numel(tsv)), atest = false; end + for kk=1:numel(out) + if ~strcmp(out(kk).name, 'my name'), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setName method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setName method can be processed back + % to an m-file. + % + % + + try + % + out1 = setName(timespan(ts5), 'my name'); + out2 = testCallerIsMethod(@setName, timespan(ts5), 'my name'); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setName'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setName'. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setName') && ... + eq(out1.hist.plistUsed, plist('name', 'my name'), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('name', 'my name'), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + e = ple2.find('EXCEPTIONS'); + ple = plist('EXCEPTIONS', [e {'name'}]); + if ~eq(mout2, out2, ple), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setName method can modify the input TIMESPAN object. + % + % + function result = utp_07 + + % + % + % Test that the setName method can modify the input TIMESPAN object + % by calling with no output. + % + % + + try + % + % copy ts5 to work with + ain = timespan(ts5); + % modify ain + aout = ain.setName('my name'); + ain.setName('my name'); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ts5' and 'ain' are now different. + % 2) Check that 'ain' has the correct name field + % + % + + atest = true; + if stest + % + % Check that setName modified the input by comparing to the copy + if eq(timespan(ts5), ain, ple1), atest = false; end + % Check that setName doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~strcmp(ain.name, 'my name'), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setName method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setName method can modify the property 'name' + % with a value in a plist. + % + % + + try + % + pl = plist('name', 'my name'); + out = ts5.setName(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct name field + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'name' + if ~strcmp(out.name, 'my name'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setName method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setName(ts5, ts2, 'new name'); + o3 = setName(ts5, ts2, 'new name'); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_setStartT.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_setStartT.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,618 @@ +% UTP_TIMESPAN_SETSTARTT a set of UTPs for the timespan/setStartT method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_setStartT.m,v 1.6 2011/04/19 18:14:02 ingo Exp $ +% + +% +% +% The setStartT method of the timespan class sets the name property. +% +% + +function results = utp_timespan_setStartT(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'setStartT'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test TIMESPAN objects + [ts1, ts2, ts3, ts4, ts5, ts6, tsv, tsm] = get_test_objects_timespan; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test the modify call works + results = [results utp_08]; % Set the property with a plist + results = [results utp_09]; % Test output of the data + results = [results utp_10]; % Use different inputs (char, time-objects, double) + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 1, atest = false; end + % Check key + if ~io(3).plists.isparam('startt'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('startt')), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('startt'), {''}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the setStartT method works with a vector of TIMESPAN objects as input. + % + % + function result = utp_02 + + % + % + % Test that the setStartT method works for a vector of TIMESPAN objects as input. + % + % + + try + % + out = setStartT(tsv, time(12345)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'tsv' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(tsv)), atest = false; end + % Check name field of each output + for kk=1:numel(out) + if ~eq(out(kk).startT, time(12345), ple1), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the setStartT method works with a matrix of TIMESPAN objects as input. + % + % + function result = utp_03 + + % + % + % Test that the setStartT method works for a matrix of TIMESPAN objects as input. + % + % + + try + % + out = setStartT(tsm, time(12345)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in 'tsm' + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if ~isequal(size(out), size(tsm)), atest = false; end + % Check name field of each output + for kk=1:numel(out) + if ~eq(out(kk).startT, time(12345), ple1), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the setStartT method works with a list of TIMESPAN objects as input. + % + % + function result = utp_04 + + % + % + % Test that the setStartT method works for a list of TIMESPAN objects as input. + % + % + + try + % + out = setStartT(ts5,ts4,ts3, time(12345)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + % Check each output against the input + if ~eq(out(1).startT, time(12345), ple1), atest = false; end + if ~eq(out(2).startT, time(12345), ple1), atest = false; end + if ~eq(out(3).startT, time(12345), ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the setStartT method works with a mix of different shaped TIMESPAN + % objects as input. + % + % + function result = utp_05 + + % + % + % Test that the setStartT method works with an input of matrices and vectors + % and single TIMESPAN objects. + % + % + + try + % + out = setStartT(ts5,tsv,ts4,tsm,ts3, time(12345)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same as in + % input. + % 2) Check that each output contains the correct data. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= (3+numel(tsm)+numel(tsv)), atest = false; end + for kk=1:numel(out) + if ~eq(out(kk).startT, time(12345), ple1), atest = false; break; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the setStartT method properly applies history and that the + % option 'internal' suppresses the history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the setStartT method can be processed back + % to an m-file. + % + % + + try + % + out1 = setStartT(timespan(ts5), time(12345)); + out2 = testCallerIsMethod(@setStartT, timespan(ts5), time(12345)); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out1' corresponds to + % 'setStartT'. + % 2) Check that the last entry in the history of 'out2' NOT corresponds to + % 'setStartT'. + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out1' + if ~(strcmp(out1.hist.methodInfo.mname, 'setStartT') && ... + eq(out1.hist.plistUsed, plist('STARTT', time(12345)), ple1)) + atest = false; + end + % Check the last step in the history of 'out2' + if eq(out2.hist.plistUsed, plist('startT', time(12345)), ple1) + atest = false; + end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, timespan(ts5), ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the setStartT method can modify the input TIMESPAN object. + % + % + function result = utp_07 + + % + % + % Test that the setStartT method can modify the input TIMESPAN object + % by calling with no output. + % + % + + try + % + % copy ts5 to work with + ain = timespan(ts5); + % modify ain + aout = ain.setStartT(time(12345)); + ain.setStartT(time(12345)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ts5' and 'ain' are now different. + % 2) Check that 'ain' has the correct name field + % + % + + atest = true; + if stest + % + % Check that setStartT modified the input by comparing to the copy + if eq(timespan(ts5), ain, ple1), atest = false; end + % Check that setStartT doesn't modified the input for the function notation + if ~eq(aout, ain, ple1), atest = false; end + % Check that the modified object contains the changed value + if ~eq(ain.startT, time(12345), ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the setStartT method can set the property with a plist. + % + % + function result = utp_08 + + % + % + % Test that the setStartT method can modify the property 'startT' + % with a value in a plist. + % + % + + try + % + pl = plist('startT', time(12345)); + out = ts5.setStartT(pl); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that 'ain' has the correct name field + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the field 'startT' + if ~eq(out.startT, time(12345), ple1), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + %% UTP_09 + + % + % + % Check that the setStartT method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_09 + + % + % + % Call the method with a list of output variables and with a single output + % variable. Additionaly check that the rebuild method works on the output. + % + % + + try + % + [o1, o2] = setStartT(ts5, ts2, time(12345)); + o3 = setStartT(ts5, ts2, time(12345)); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Check that the setStartT method accept different inputs. + % + % + function result = utp_10 + + % + % + % Test that the setStartT method accept input of double, char and + % time-objects. + % + % + + try + % + o1 = setStartT(ts5, time(54321)); + o2 = setStartT(ts5, '14:00:00'); + o3 = setStartT(ts5, 54321); + mout1 = rebuild(o1); + mout2 = rebuild(o2); + mout3 = rebuild(o3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the output + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the number of outputs + if ~eq(o1.startT, time(54321), ple1), atest = false; end + if ~eq(o2.startT, time('14:00:00'), ple1), atest = false; end + if ~eq(o3.startT, time(54321), ple1), atest = false; end + % Check the rebuilding of the object + if ~eq(o1, mout1, ple2), atest = false; end + if ~eq(o2, mout2, ple2), atest = false; end + if ~eq(o3, mout3, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_string.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_string.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,430 @@ +% UTP_TIMESPAN_STRING a set of UTPs for the timespan/string method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_string.m,v 1.2 2009/07/28 13:17:24 ingo Exp $ +% + +% +% +% The string method of the timespan class writes a command string that can be +% used to recreate the input object(s). But the object must be created with a +% plist. +% +% + +function results = utp_timespan_string(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'string'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + pl1 = plist('timezone', 'PST', 'timeformat', 'HH:MM:SS.FFF', 'startT', time(1234), 'endT', time(12345)); + ts1 = timespan(pl1); + pl2 = plist('startT', '14:00:00', 'endT', '15:15:00'); + ts2 = timespan(pl2); + tsv = [ts1, ts2, ts1]; + tsm = [ts1, ts2, ts1; ts1, ts2, ts1]; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Negative test: The object have more than one history step. + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 0, atest = false; end + % Check key + % Check default value + % Check options + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the string method works with a vector of TIMESPAN objects as input. + % + % + function result = utp_02 + + % + % + % Test that the string method works for a vector of TIMESPAN objects as input. + % + % + + try + % + out = string(tsv); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end; + if ~isa(rout, 'timespan'), atest = false; end + if numel(rout) ~= numel(tsv), atest = false; end + for kk = 1:numel(tsv) + if eq(rout(kk), tsv(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the string method works with a matrix of TIMESPAN objects as input. + % + % + function result = utp_03 + + % + % + % Test that the string method works for a matrix of TIMESPAN objects as input. + % + % + + try + % + out = string(tsm); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'timespan'), atest = false; end + if numel(rout) ~= numel(tsm), atest = false; end + for kk = 1:numel(tsm) + if eq(rout(kk), tsm(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the string method works with a list of TIMESPAN objects as input. + % + % + function result = utp_04 + + % + % + % Test that the string method works for a list of TIMESPAN objects as input. + % + % + + try + % + out = string(ts1,ts2); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + tsin = [ts1, ts2]; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'timespan'), atest = false; end + if numel(rout) ~= numel(tsin), atest = false; end + for kk = 1:numel(tsin) + if eq(rout(kk), tsin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the string method works with a mix of different shaped TIMESPAN objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the string method works with an input of matrices and vectors + % and single TIMESPAN objects. + % + % + + try + % + out = string(ts1,tsm,ts2); + rout = eval(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output is a executable string. + % 2) Check the correct number of rout + % 3) Check the rebuild objects. + % + % + + atest = true; + tsin = [ts1, reshape(tsm, 1, []), ts2]; + if stest + % + % Check the output + if ~ischar(out), atest = false; end + if ~isa(rout, 'timespan'), atest = false; end + if numel(rout) ~= numel(tsin), atest = false; end + for kk = 1:numel(tsin) + if eq(rout(kk), tsin(kk)), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the string method properly applies history. + % + % + function result = utp_06 + + % + % + % The method string doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the string method doesn't work if the TIMESPAN object have more + % than one history step. + % + % + function result = utp_07 + + % + % + % The method string throws an error because the input object have more than + % one history step. + % + % + + try + % + ts3 = timespan(3000, 5000); + ts3.setName('Second history step'); + out = ts3.string(); + % + stest = false; + catch err + stest = true; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_submit.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_submit.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,528 @@ +% UTP_TIMESPAN_SUBMIT a set of UTPs for the timespan/submit method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_submit.m,v 1.13 2010/08/18 09:25:55 ingo Exp $ +% + +% +% +% The bsubmit method of the timespan class submits a collection of objects +% in XML form to an LTPDA Repository. The type of the objects are +% independent. +% +% + +function results = utp_timespan_submit(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'submit'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + [ts1, ts2, ts3, ts4, ts5, ts6, tsv, tsm] = get_test_objects_timespan; + plForAutoTest = plist('no dialog', true, 'use selector', false); + + try + conn = utpGetConnection(); + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_timespan_submit: submit timespan'; + sinfo.experiment_description = 'utp_timespan_submit: description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + results = [results utp_07]; % Test output of the data + catch + end + + % Close connection + utpCloseConnection(conn) + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 16, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('sinfo filename'), atest = false; end + if ~io(3).plists.isparam('binary'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isEmptyChar(io(3).plists.find('sinfo filename')), atest = false; end + if ~isequal(io(3).plists.find('binary'), false), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the submit method works with a vector of TIMESPAN objects as + % input. + % + % + function result = utp_02 + + % + % + % Test that the submit method works for a vector of TIMESPAN objects as + % input. + % + % + + try + % + [ids, cids] = submit(tsv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + robjs3 = ltpda_uo.retrieve(conn, ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(tsv), atest = false; end + if numel(robjs2) ~= numel(tsv), atest = false; end + if numel(robjs3) ~= numel(tsv), atest = false; end + % Check the retrieved object against the submitted + if ~eq(tsv, [robjs1{:}]), atest = false; end + if ~eq(tsv, [robjs2{:}]), atest = false; end + if ~eq(tsv, [robjs3{:}]), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the submit method works with a matrix of TIMESPAN objects as + % input. + % + % + function result = utp_03 + + % + % + % Tests that the submit method works with a matrix of TIMESPAN objects + % as input. + % + % + + try + % + [ids, cids] = submit(tsm, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + robjs3 = ltpda_uo.retrieve(conn, ids(1), ids(2), ids(3), ids(4), ids(5), ids(6)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= numel(tsm), atest = false; end + if numel(robjs2) ~= numel(tsm), atest = false; end + if numel(robjs3) ~= numel(tsm), atest = false; end + % Check the retrieved object against the submitted + if ~eq(tsm, reshape([robjs1{:}], size(tsm))), atest = false; end + if ~eq(tsm, reshape([robjs2{:}], size(tsm))), atest = false; end + if ~eq(tsm, reshape([robjs3{:}], size(tsm))), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the submit method works with a list of TIMESPAN objects as + % input. + % + % + function result = utp_04 + + % + % + % Tests that the submit method works with a list of TIMESPAN objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = submit(ts1, pl, iir, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + robjs3 = ltpda_uo.retrieve(conn, ids(1), ids(2), ids(3)); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 3, atest = false; end + if numel(robjs2) ~= 3, atest = false; end + if numel(robjs3) ~= 3, atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, ts1), atest = false; end + if ~eq(robjs1{3}, pl), atest = false; end + if ~eq(robjs1{2}, iir), atest = false; end + % Check robjs2 + if ~eq(robjs2{1}, ts1), atest = false; end + if ~eq(robjs2{3}, pl), atest = false; end + if ~eq(robjs2{2}, iir), atest = false; end + % Check robjs3 + if ~eq(robjs3{1}, ts1), atest = false; end + if ~eq(robjs3{3}, pl), atest = false; end + if ~eq(robjs3{2}, iir), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the abs method works with a mix of different shaped TIMESPAN + % objects as input. + % + % + function result = utp_05 + + % + % + % Tests that the submit method works with a list of TIMESPAN objects as + % input. Use for this a mix of different object types. + % + % + + try + % + pl = plist('key1', 'val', 'key2', 2); + iir = miir(plist('type', 'highpass')); + [ids, cids] = submit(pl, tsm, iir, tsv, sinfo, plForAutoTest); + robjs1 = ltpda_uo.retrieve(conn, 'Collection', cids); + robjs2 = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the number of retrieved objects. + % 2) Check that the retrieved object is the same as the submitted + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if numel(robjs1) ~= 2 + numel(tsm) + numel(tsv), atest = false; end + if numel(robjs2) ~= 2 + numel(tsm) + numel(tsv), atest = false; end + % Check the retrieved object against the submitted + % Check robjs1 + if ~eq(robjs1{1}, tsm(1)), atest = false; end + if ~eq(robjs1{2}, tsm(2)), atest = false; end + if ~eq(robjs1{3}, tsm(3)), atest = false; end + if ~eq(robjs1{4}, tsm(4)), atest = false; end + if ~eq(robjs1{5}, tsm(5)), atest = false; end + if ~eq(robjs1{6}, tsm(6)), atest = false; end + if ~eq(robjs1{7}, iir), atest = false; end + if ~eq(robjs1{8}, tsv(1)), atest = false; end + if ~eq(robjs1{9}, tsv(2)), atest = false; end + if ~eq(robjs1{10}, tsv(3)), atest = false; end + if ~eq(robjs1{11}, pl), atest = false; end + % Check robjs2 + if ~isequalwithequalnans(robjs1, robjs2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tthe submit method properly applies history. + % + % + function result = utp_06 + + % + % + % Tthe submit method properly applies history. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Nothing to test. + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Check that the submit method pass back the output objects to a list of + % output variables or to a single variable. + % + % + function result = utp_07 + + % + % + % Call the method with a list of output variables and with a single + % output variable. Additionaly check that the rebuild method works on + % the output. + % + % + + try + % + [ids, cids] = submit(ts1, ts2, sinfo, plForAutoTest); + + [o1, o2] = ltpda_uo.retrieve(conn, 'Collection', cids); + o3 = ltpda_uo.retrieve(conn, 'Collection', cids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the output contains the right number of objects + % + % + + atest = true; + if stest + % + % Check the number of outputs + if numel(o1) ~=1, atest = false; end + if numel(o2) ~=1, atest = false; end + if numel(o3) ~=2, atest = false; end + % Check the output + if ~eq(o1, ts1), atest = false; end + if ~eq(o2, ts2), atest = false; end + if ~eq(o3{1}, ts1), atest = false; end + if ~eq(o3{2}, ts2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_timespan.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_timespan.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,1269 @@ +% UTP_TIMESPAN_TIMESPAN a set of UTPs for the timespan/timespan method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_timespan.m,v 1.31 2011/09/29 13:46:19 ingo Exp $ +% + +% +% +% The timespan method of the timespan class constructs TIMESPAN objects. +% +% + +function results = utp_timespan_timespan(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'timespan'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test objects + [ts1, ts2, ts3, ts4, ts5, ts6, tsv, tsm] = get_test_objects_timespan; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % get preferences + prefs = getappdata(0, 'LTPDApreferences'); + oldTimezone = char(prefs.getTimePrefs.getTimeTimezone); + oldTimeformat = char(prefs.getTimePrefs.getTimestringFormat); + + % set timezone to UTC for all tests + prefs.getTimePrefs.setTimeTimezone('UTC'); + + try + % Run the tests + results = [results utp_00]; + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working with empty constructor + results = [results utp_07]; % Test history is working with copy constructor + results = [results utp_08]; % Test history is working with MAT file constructor + results = [results utp_09]; % Test history is working with XML file constructor + results = [results utp_10]; % Test history is working with struct constructor + results = [results utp_11]; % Test history is working with plist(filename) constructor + results = [results utp_12]; % Test history is working with plist(hostname) constructor + results = [results utp_13]; % Test history is working with plist(startT+endT) constructor + results = [results utp_15]; % Test history is working with start + end time constructor + results = [results utp_16]; % Test history is working with conn+Id constructor + results = [results utp_17]; % Test history is working with start + end time + format constructor + catch ex + end + + % restore preferences + prefs.getTimePrefs.setTimeTimezone(oldTimezone); + prefs.getTimePrefs.setTimestringFormat(oldTimeformat); + + disp('Done.'); + disp('******************************************************'); + + elseif nargin == 1 % Check for UTP functions + if strcmp(varargin{1}, 'isutp') + results = 1; + elseif strcmpi(varargin{1}, 'needs repository') + results = 2; + else + results = 0; + end + else + error('### Incorrect inputs') + end + + %% UTP_00 + + % + % + % Tests that the timespan constructor does what is supposed to do. + % + % + function result = utp_00 + + stest = false; + try + % + ts(1) = timespan(1, 2); + ts(end+1) = timespan('00:00:01', '00:00:02'); + ts(end+1) = timespan(time(1), time(2)); + ts(end+1) = timespan(plist('startT', 1, 'endT', 2)); + ts(end+1) = timespan(plist('startT', '00:00:01', 'endT', '00:00:02')); + ts(end+1) = timespan(plist('startT', time(1), 'endT', time(2))); + ts(end+1) = timespan(plist('startT', '00:00:01', 'endT', '00:00:02')); + ts(end+1) = timespan(plist('startT', '01:00:01', 'endT', '01:00:02', 'timezone', 'CET')); + % + stest = true; + end + + atest = true; + try + % do not run algorithm tests if sintax tests failed + assert(stest); + + % + % check that all the start and end time has been interpreted correctly + tstart = [ts.startT]; + assert(all([tstart.utc_epoch_milli] == 1000)); + tend = [ts.endT]; + assert(all([tend.utc_epoch_milli] == 2000)); + % + catch + atest = false; + end + + % return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From XML File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From MAT File')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Repository')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Timespan Definition')), atest = false; end + if ~any(strcmpi(io(2).sets, 'From Built-in Model')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + pn = 3; + if io(pn).plists.nparams ~= 3, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + %%%%%%%%%% SET 'From MAT File' + pn = 4; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + %%%%%%%%%% SET 'From XML File' + pn = 5; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('filename'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end + %%%%%%%%%% SET 'From Repository' + pn = 6; + if io(pn).plists.nparams ~= 10, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('hostname'), atest = false; end + if ~io(pn).plists.isparam('id'), atest = false; end + if ~io(pn).plists.isparam('cid'), atest = false; end + if ~io(pn).plists.isparam('database'), atest = false; end + if ~io(pn).plists.isparam('binary'), atest = false; end + if ~io(pn).plists.isparam('username'), atest = false; end + if ~io(pn).plists.isparam('password'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('id')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('cid')), atest = false; end + if ~isequal(io(pn).plists.find('binary'), 'yes'), atest = false; end + %%%%%%%%%% SET 'From Built-in Model' + pn = 7; + if io(pn).plists.nparams ~= 4, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('built-in'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('built-in')), atest = false; end + %%%%%%%%%% SET 'From Timespan Definition' + pn = 8; + if io(pn).plists.nparams ~= 7, atest = false; end + % Check key + if ~io(pn).plists.isparam('name'), atest = false; end + if ~io(pn).plists.isparam('description'), atest = false; end + if ~io(pn).plists.isparam('plotinfo'), atest = false; end + if ~io(pn).plists.isparam('startt'), atest = false; end + if ~io(pn).plists.isparam('endt'), atest = false; end + if ~io(pn).plists.isparam('timezone'), atest = false; end + if ~io(pn).plists.isparam('timeformat'), atest = false; end + % Check default value + if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end + if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end + if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end + if ~strcmp(io(pn).plists.find('startt'), ''), atest = false; end + if ~strcmp(io(pn).plists.find('endt'), ''), atest = false; end + if ~isequal(io(pn).plists.find('timezone'), 'UTC'), atest = false; end + if ~isequal(io(pn).plists.find('timeformat'), ''), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the timespan method works with a vector of TIMESPAN objects as input. + % + % + function result = utp_02 + + % + % + % Test that the timespan method works with a vector of TIMESPAN objects as input. + % + % + + try + % + out = timespan(tsv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output TIMESPANs is the same as the input shape. + % 2) Check that each output TIMESPAN is a copy of the input TIMESPAN. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + if stest + % + % Check we have the correct shape + if size(out) ~= size(tsv), atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(tsv(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(tsv(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(tsv(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the timespan method works with a matrix of TIMESPAN objects as input. + % + % + function result = utp_03 + + % + % + % Test that the timespan method works with a matrix of TIMESPAN objects as input. + % + % + + try + % + out = timespan(tsm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the shape of the output TIMESPANs is the same as the input shape. + % 2) Check that each output TIMESPAN is a copy of the input TIMESPAN. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + if stest + % + % Check we have the correct number of outputs + if size(out) ~= size(tsm), atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(tsm(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(tsm(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(tsm(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the timespan method works with a list of TIMESPAN objects as input. + % + % + function result = utp_04 + + % + % + % Test that the timespan method works with a list of TIMESPAN objects as input. + % + % + + try + % + out = timespan(ts5, ts4, ts3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same of the + % number in the input. + % 2) Check that each output TIMESPAN is a copy of the input TIMESPAN. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + tsin = [ts5, ts4, ts3]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3, atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(tsin(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(tsin(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(tsin(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the timespan method works with a mix of different shaped TIMESPANs as + % input. + % + % + function result = utp_05 + + % + % + % Test that the timespan method works with a mix of different shaped TIMESPANs as + % input. + % + % + + try + % + out = timespan(ts5,tsv,ts2,tsm,ts4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the number of elements in 'out' is the same of the + % number in the input. + % 2) Check that each output TIMESPAN is a copy of the input TIMESPAN. + % 3) Check that the copy have an additional history step. + % + % + + atest = true; + tsin = [ts5, reshape(tsv, 1, []), ts2, reshape(tsm, 1, []), ts4]; + if stest + % + % Check we have the correct number of outputs + if numel(out) ~= 3+numel(tsv)+numel(tsm), atest = false; end + + % Check that the output is a copy. + for ii = 1:numel(out) + % Check that the output is the same except the history + if ~eq(tsin(ii), out(ii), ple3), atest = false; end + % Check the history + if ~eq(tsin(ii).hist, out(ii).hist.inhists), atest = false; end + % Change the output to make sure that it is a 'real' copy + out(ii).setDescription('my desc'); + if eq(tsin(ii), out(ii), ple3), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the timespan method properly applies history. + % + % + function result = utp_06 + + % + % + % Test that the result of applying the timespan method can be processed back. + % + % + + try + % + out = timespan(ts4); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'timespan'. + % 2) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'timespan'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + + %% UTP_07 + + % + % + % Tests that the timespan method properly applies history to the copy constructor. + % + % + function result = utp_07 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % Test the constructor with a different number of inputs. + % + % + + try + % + out1 = timespan(ts5); + out2 = timespan(ts5, ts4); + out3 = timespan(ts5, ts4, ts3); + out1.setName('my name'); + out2(1).setName('my name'); + out2(2).setName('my name'); + out3(1).setName('my name'); + out3(2).setName('my name'); + out3(3).setName('my name'); + mout = rebuild(out1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'timespan'. + % 2) Check that the original objects are not changed by the setter function + % 3) Check that the method rebuild produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + % It is the method 'setName' because we set it in above + if ~strcmp(out1.hist.methodInfo.mname, 'setName'), atest = false; end + % Check next to the last step in the history of 'out' + if ~strcmp(out1.hist.inhists.methodInfo.mname, 'timespan'), atest = false; end + % Check the originals + if strcmp(ts5, 'my name'), atest = false; end + if strcmp(ts4, 'my name'), atest = false; end + if strcmp(ts3, 'my name'), atest = false; end + % Check the rebuilt object + if ~eq(mout, out1, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_07 + + %% UTP_08 + + % + % + % Tests that the timespan method properly applies history to the read + % MAT-file constructor. + % + % + function result = utp_08 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + filename = 'test_ts.mat'; + ts = timespan(ts4); + save(ts, filename); + + out = timespan(filename); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + if ~eq(out, ts, ple1), atest = false; end + % Check the rebuilt object + if ~eq(mout, out, ple2), atest = false; end + % + delete(filename); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_08 + + + %% UTP_09 + + % + % + % Tests that the timespan method properly applies history to the read + % XML-file constructor. + % + % + function result = utp_09 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + filename = 'test_ts.xml'; + amat = timespan(tsm); + save(amat, filename); + + out = timespan(filename); + mout = rebuild(out); + % + stest = true; + catch err + disp(err.message) + stest = false; + rethrow(err); + end + + % + % + % 1) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the algorithm + for kk = 1:numel(out) + if ~eq(out(kk), amat(kk), ple1), atest = false; end + end + + % Check the rebuilt object + for kk = 1:numel(out) + if ~eq(mout(kk), out(kk), ple2), atest = false; end + end + % + delete(filename); + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_09 + + %% UTP_10 + + % + % + % Tests that the timespan method properly applies history to the struct constructor. + % + % + function result = utp_10 + + % + % + % Test that the output can be processed back with the 'rebuild' method. + % + % + + try + % + % silence warnings about converting objects to struct + w = warning('off', 'MATLAB:structOnObject'); + + sts5 = struct(ts5); + sts5.startT = struct(ts5.startT); + sts5.endT = struct(ts5.endT); + sts5.hist = struct(ts5.hist); + + out1 = timespan(struct(ts5)); + out2 = timespan(sts5); + mout1 = rebuild(out1); + mout2 = rebuild(out2); + + % restore warnings + warning(w); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' + % corresponds to 'timespan'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check that the output is a TIMESPAN object + if ~isa(out1,'timespan'), atest = false; end + if ~isa(out2,'timespan'), atest = false; end + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'setName'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'setName'), atest = false; end + % Check the rebuilt object + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_10 + + %% UTP_11 + + % + % + % Tests that the timespan method properly applies history to the + % plist(filename) constructor. + % + % + function result = utp_11 + + % + % + % Test that the output can be processed back to an m-file. + % + % + + try + % + filename1 = 'test_ts.xml'; + filename2 = 'test_ts.mat'; + + f1 = timespan(ts5); + f2 = timespan(ts4); + + save(f1, filename1); + save(f2, filename2); + + out1 = timespan(plist('filename', filename1)); + out2 = timespan(plist('filename', filename2)); + + mout1 = out1.rebuild; + mout2 = out2.rebuild; + + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the save method doesn't change the input object + % 2) Check that the last two entries in the history of 'out' corresponds to + % 'timespan' and 'save' + % 3) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the input object + if ~eq(f1, timespan(ts5), ple1), atest = false; end + if ~eq(f2, timespan(ts4), ple1) , atest = false; end + % The load doesn't have two additionally history steps (save + load) + if ~eq(out1, f1, ple1), atest = false; end + if ~eq(out2, f2, ple1), atest = false; end + % Rebuild object and check the result + if ~eq(mout1, out1, ple2), atest = false; end + if ~eq(mout2, out2, ple2), atest = false; end + % + % delete test file + delete(filename1) + delete(filename2) + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_11 + + %% UTP_12 + + % + % + % Tests that the TIMESPAN method properly applies history to the + % plist(conn) constructor. + % + % + function result = utp_12 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + conn = utpGetConnection + try + % + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_timespan_timespan_12: submit timespan vector'; + sinfo.experiment_description = 'utp_timespan_timespan_12: &description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + plForAutoTest = plist('no dialog', true, 'use selector', false); + ids = submit(tsv, sinfo, plForAutoTest); + + out = timespan(plist('hostname', utpGetHostname, 'database', utpGetDatabase, 'conn', conn, 'id', ids)); + % + utpCloseConnection(conn); + stest = true; + catch err + disp(err.message) + % Close connection + utpCloseConnection(conn); + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'timespan'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + for kk = 1:numel(out) + if ~strcmp(out(kk).hist.methodInfo.mname, 'timespan'), atest = false; end + end + % Check data values + if ~eq(out, tsv, ple3), atest = false; end + % Rebuild object and check the result + mout = rebuild(out); + if ~eq(mout, out, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_12 + + %% UTP_13 + + % + % + % Tests that the TIMESPAN method properly applies history to the + % plist(type) constructor. + % + % + function result = utp_13 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + tf = 'HH:MM:SS.FFF'; + tz = 'GMT-04'; + pl1 = plist('startT', time(1), 'endT', 2); + pl2 = plist('startT', '00:01:00.000', 'endT', '00:02:00.000', 'timezone', tz); + pl3 = plist('startT', '00:00:00.000', 'endT', 2, 'timeformat', tf); + + out1 = timespan(pl1); + out2 = timespan(pl2); + out3 = timespan(pl3); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + % + stest = true; + catch err + disp(err.message) + stest = false; + % rethrow(err) + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'timespan'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'timespan'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'timespan'), atest = false; end + if ~strcmp(out3.hist.methodInfo.mname, 'timespan'), atest = false; end + % Check first plist + if ~eq(out1.startT, time(1)), atest = false; end + if ~eq(out1.endT, time(2)), atest = false; end + % Check second plist + if ~eq(out2.startT, time(plist('time', '00:01:00', 'timezone', tz))), atest = false; end + if ~eq(out2.endT, time(plist('time', '00:02:00', 'timezone', tz))), atest = false; end + % Check third plist + if ~eq(out3.startT, time(0)), atest = false; end + if ~eq(out3.endT, time(2)), atest = false; end + % Rebuild object and check the result + if ~eq(mout1, out1, ple1), atest = false; end + if ~eq(mout2, out2, ple1), atest = false; end + if ~eq(mout3, out3, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_13 + + + %% UTP_15 + + % + % + % Tests that the TIMESPAN method properly applies history to + % the start + end time constructor. + % + % + function result = utp_15 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + out1 = timespan('14:00:00', '14:00:05'); + out2 = timespan('00:00:01', time(4)); + out3 = timespan(time(1234), time(2345)); + out4 = timespan(time(1.234), '00:00:05'); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'timespan'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'timespan'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'timespan'), atest = false; end + if ~strcmp(out3.hist.methodInfo.mname, 'timespan'), atest = false; end + if ~strcmp(out4.hist.methodInfo.mname, 'timespan'), atest = false; end + % Check values + if ~eq(out1.startT, time('14:00:00')), atest = false; end + if ~eq(out1.endT, time('14:00:05')), atest = false; end + if ~eq(out2.startT, time('00:00:01')), atest = false; end + if ~eq(out2.endT, time(4)), atest = false; end + if ~eq(out3.startT, time(1234)), atest = false; end + if ~eq(out3.endT, time(2345)), atest = false; end + if ~eq(out4.startT, time(1.234)), atest = false; end + if ~eq(out4.endT, time('00:00:05')), atest = false; end + % Rebuild object and check the result + if ~eq(mout1, out1, ple1), atest = false; end + if ~eq(mout2, out2, ple1), atest = false; end + if ~eq(mout3, out3, ple1), atest = false; end + if ~eq(mout4, out4, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_15 + + %% UTP_16 + + % + % + % Tests that the TIMESPAN method properly applies history to the conn+Id constructor. + % + % + function result = utp_16 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + conn = utpGetConnection + try + % + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_timespan_timespan_16: submit timespan'; + sinfo.experiment_description = 'utp_timespan_timespan_16: description'; + sinfo.analysis_description = 'utp_timespan_timespan_16'; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + plForAutoTest = plist('no dialog', true, 'use selector', false); + [ids] = submit(ts4, sinfo, plForAutoTest); + + out = timespan(conn, ids); + % + utpCloseConnection(conn); + stest = true; + catch err + disp(err.message) + % Close connection + utpCloseConnection(conn); + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'timespan'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out.hist.methodInfo.mname, 'timespan'), atest = false; end + % Check data values + if ~eq(out,ts4, ple3), atest = false; end + % Check the history except the additional 'submit' + 'retrieve' steps + if ~eq(out.hist.inhists, ts4.hist), atest = false; end + % Rebuild object and check the result + mout = rebuild(out); + if ~eq(mout, out, ple3), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_16 + + %% UTP_17 + + % + % + % Tests that the TIMESPAN method properly applies history to + % the start + end time + format constructor. + % + % + function result = utp_17 + + % + % + % Test that the output can be processed back with the rebuild method. + % + % + + try + % + f1 = 'HH:MM:SS'; + f2 = 'HH:MM:SS'; + f4 = 'HH:MM:SS'; + out1 = timespan('14:00:00', '14:00:05', f1); + out2 = timespan('00:00:01', time(4), f2); + out3 = timespan(time(1.234), time(2.345)); + out4 = timespan(time(1.234), '00:00:05', f4); + + mout1 = rebuild(out1); + mout2 = rebuild(out2); + mout3 = rebuild(out3); + mout4 = rebuild(out4); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the last entry in the history of 'out' corresponds to + % 'timespan'. + % 2) Check that the 'rebuild' method produces the same object as 'out'. + % + % + + atest = true; + if stest + % + % Check the last step in the history of 'out' + if ~strcmp(out1.hist.methodInfo.mname, 'timespan'), atest = false; end + if ~strcmp(out2.hist.methodInfo.mname, 'timespan'), atest = false; end + if ~strcmp(out3.hist.methodInfo.mname, 'timespan'), atest = false; end + if ~strcmp(out4.hist.methodInfo.mname, 'timespan'), atest = false; end + % Check first object + if ~eq(out1.startT, time('14:00:00', f1)), atest = false; end + if ~eq(out1.endT, time('14:00:05', f1)), atest = false; end + % Check second object + if ~eq(out2.startT, time('00:00:01', f2)), atest = false; end + if ~eq(out2.endT, time(4.000)), atest = false; end + % Check third object + if ~eq(out3.startT, time(1.234)), atest = false; end + if ~eq(out3.endT, time(2.345)), atest = false; end + % Check fourth object + if ~eq(out4.startT, time(1.234)), atest = false; end + if ~eq(out4.endT, time('00:00:05', f4)), atest = false; end + % Rebuild object and check the result + if ~eq(mout1, out1, ple1), atest = false; end + if ~eq(mout2, out2, ple1), atest = false; end + if ~eq(mout3, out3, ple1), atest = false; end + if ~eq(mout4, out4, ple1), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_17 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_type.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_type.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,395 @@ +% UTP_TIMESPAN_TYPE a set of UTPs for the timespan/type method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_type.m,v 1.2 2009/07/28 13:17:24 ingo Exp $ +% + +% +% +% The type method of the timespan class converts the input objects to +% MATLAB functions that reproduce the processing steps that led to the +% input objects. +% +% + +function results = utp_timespan_type(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'type'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + % Test TIMESPAN objects + [ts1, ts2, ts3, ts4, ts5, ts6, tsv, tsm] = get_test_objects_timespan; + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % DEfine the filename + filename = 'test_timespan_type.m'; + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Vector input + results = [results utp_03]; % Matrix input + results = [results utp_04]; % List input + results = [results utp_05]; % Test with mixed input + results = [results utp_06]; % Test history is working + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + %%% SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + %%% Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + %%%%%%%%%% SET 'Default' + if io(3).plists.nparams ~= 2, atest = false; end + % Check key + if ~io(3).plists.isparam('filename'), atest = false; end + if ~io(3).plists.isparam('stop_option'), atest = false; end + % Check default value + if ~isEmptyChar(io(3).plists.find('filename')), atest = false; end + if ~isequal(io(3).plists.find('stop_option'), 'full'), atest = false; end + % Check options + if ~isequal(io(3).plists.getOptionsForParam('filename'), {''}), atest = false; end + if ~isequal(io(3).plists.getOptionsForParam('stop_option'), {'full', 'File', 'Repo', 'File Repo', 'N'}), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the type method works with a vector of TIMESPAN objects as input. + % + % + function result = utp_02 + + % + % + % Test that the type method works for a vector of TIMESPAN objects as input. + % + % + + try + % + type(tsv, filename); + type(tsv); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + if ~eq(tsv, mout, ple2), atest = false; end; + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the type method works with a matrix of TIMESPAN objects as input. + % + % + function result = utp_03 + + % + % + % Test that the type method works for a matrix of TIMESPAN objects as input. + % + % + + try + % + type(tsm, filename); + type(tsm); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + % Type doesn't keep the shape + for ii = 1:numel(tsm) + if ~eq(tsm(ii), mout(ii), ple2), atest = false; end; + end + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the type method works with a list of TIMESPAN objects as input. + % + % + function result = utp_04 + + % + % + % Test that the type method works for a list of TIMESPAN objects as input. + % + % + + try + % + type(ts5,ts4,ts3, filename); + type(ts5,ts4,ts3); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + tsin = [ts5,ts4,ts3]; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + % Type doesn't keep the shape + for ii = 1:numel(tsin) + if ~eq(tsin(ii), mout(ii), ple2), atest = false; end; + end + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the type method works with a mix of different shaped TIMESPAN objects + % as input. + % + % + function result = utp_05 + + % + % + % Test that the type method works with an input of matrices and vectors + % and single TIMESPAN objects. + % + % + + try + % + type(ts4,tsv,ts2,tsm,ts1, filename); + type(ts4,tsv,ts2,tsm,ts1); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check the rebuilt output. + % + % + + atest = true; + tsin = [ts4,reshape(tsv,1,[]),ts2,reshape(tsm,1,[]),ts1]; + if stest + % + % Check the output + res = exist(filename, 'file'); + if res ~= 2, atest = false; end; + % Run the created test file + mout = eval(strtok(filename, '.')); + % Type doesn't keep the shape + for ii = 1:numel(tsin) + if ~eq(tsin(ii), mout(ii), ple2), atest = false; end; + end + % Necessary for the next test + delete(filename); + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + + %% UTP_06 + + % + % + % Tests that the type method properly applies history. + % + % + function result = utp_06 + + % + % + % The method type doesn't change the data, thus it is not possible to check + % the history. Nothing to do. + % + % + + try + % + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % + + atest = true; + if stest + % + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_06 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/utps/timespan/utp_timespan_update.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/utps/timespan/utp_timespan_update.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,388 @@ +% UTP_TIMESPAN_UPDATE a set of UTPs for the timespan/update method +% +% M Hewitson 06-08-08 +% +% $Id: utp_timespan_update.m,v 1.13 2010/08/18 09:25:55 ingo Exp $ +% + +% +% +% The update method of the timespan class updates (replace) an LTPDA object +% in the repository with the given replacement object. It is only possible +% to update one object. This is the reason why the general UTPs are not +% possible. +% +% + +function results = utp_timespan_update(varargin) + + % Check the inputs + if nargin == 0 + + % Some keywords + class = 'timespan'; + mthd = 'update'; + + results = []; + disp('******************************************************'); + disp(['**** Running UTPs for ' class '/' mthd]); + disp('******************************************************'); + + plForAutoTest = plist('no dialog', true, 'use selector', false); + pl = plist('timezone', 'PST', 'timeformat', 'HH:MM:SS.FFF', 'startT', time(1234), 'endT', time(12345)); + obj = timespan(pl); + obj.setName(); + + try + conn = utpGetConnection(); + + sinfo.conn = conn; + sinfo.experiment_title = 'utp_timespan_update: update timespan'; + sinfo.experiment_description = 'utp_timespan_update: description'; + sinfo.analysis_description = ''; + sinfo.quantity = 'none'; + sinfo.keywords = 'none'; + sinfo.reference_ids = ''; + sinfo.additional_comments = 'none'; + sinfo.additional_authors = 'no one'; + + [ids, cids] = submit(obj, sinfo, plForAutoTest); + + % Exception list for the UTPs: + [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); + + % Run the tests + results = [results utp_01]; % getInfo call + results = [results utp_02]; % Test with conn + results = [results utp_03]; % Test with sinfo + results = [results utp_04]; % Test update of an binary file + results = [results utp_05]; % Test replace with other object + catch + end + + % Close connection + utpCloseConnection(conn) + + 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 + + %% UTP_01 + + % + % + % Tests that the getInfo call works for this method. + % + % + function result = utp_01 + + + % + % + % Test that the getInfo call works for no sets, all sets, and each set + % individually. + % + % + + try + % + % Call for no sets + io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); + % Call for all sets + io(2) = eval([class '.getInfo(''' mthd ''')']); + % Call for each set + for kk=1:numel(io(2).sets) + io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); + end + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that getInfo call returned an minfo object in all cases. + % 2) Check that all plists have the correct parameters. + % + % + + atest = true; + if stest + % + % check we have minfo objects + if isa(io, 'minfo') + prefs = getappdata(0, 'LTPDApreferences'); + hosts = utils.helper.jArrayList2CellArray(prefs.getRepoPrefs.getHostnames()); + % SET 'None' + if ~isempty(io(1).sets), atest = false; end + if ~isempty(io(1).plists), atest = false; end + % Check all Sets + if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end + if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end + % SET 'Default' + % Check key + if io(3).plists.nparams ~= 15, atest = false; end + if ~io(3).plists.isparam('hostname'), atest = false; end + if ~io(3).plists.isparam('database'), atest = false; end + if ~io(3).plists.isparam('username'), atest = false; end + if ~io(3).plists.isparam('password'), atest = false; end + if ~io(3).plists.isparam('experiment title'), atest = false; end + if ~io(3).plists.isparam('experiment description'), atest = false; end + if ~io(3).plists.isparam('analysis description'), atest = false; end + if ~io(3).plists.isparam('quantity'), atest = false; end + if ~io(3).plists.isparam('keywords'), atest = false; end + if ~io(3).plists.isparam('reference ids'), atest = false; end + if ~io(3).plists.isparam('additional comments'), atest = false; end + if ~io(3).plists.isparam('additional authors'), atest = false; end + if ~io(3).plists.isparam('no dialog'), atest = false; end + if ~io(3).plists.isparam('use selector'), atest = false; end + if ~io(3).plists.isparam('binary'), atest = false; end + % Check default value + if ~isequal(io(3).plists.find('hostname'), hosts{1}), atest = false; end + if ~isEmptyChar(io(3).plists.find('database')), atest = false; end + if ~isEmptyChar(io(3).plists.find('username')), atest = false; end + if ~isEmptyChar(io(3).plists.find('password')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment title')), atest = false; end + if ~isEmptyChar(io(3).plists.find('experiment description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('analysis description')), atest = false; end + if ~isEmptyChar(io(3).plists.find('quantity')), atest = false; end + if ~isEmptyChar(io(3).plists.find('keywords')), atest = false; end + if ~isEmptyChar(io(3).plists.find('reference ids')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional comments')), atest = false; end + if ~isEmptyChar(io(3).plists.find('additional authors')), atest = false; end + if ~isequal(io(3).plists.find('no dialog'), false), atest = false; end + if ~isequal(io(3).plists.find('use selector'), true), atest = false; end + if ~isequal(io(3).plists.find('binary'), false), atest = false; end + end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_01 + + %% UTP_02 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_02 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Use a database object (conn) to establish the connection. + % + % + + try + % + % Make some changes to the object. + uobj = obj.setName('I was updated (conn)'); + update(uobj, ids, conn, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_02 + + %% UTP_03 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_03 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Use a database info structure (sinfo) to establish the connection. + % + % + + try + % + % Make some changes to the object. + uobj = obj.setName('I was updated (sinfo)'); + update(uobj, ids, sinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_03 + + %% UTP_04 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % + % + function result = utp_04 + + % + % + % Tests that the update method updates the repository at the given + % position 'ids' with the new object. + % Check that the update method also updates objects which are stored as + % a binary file. + % + % + + try + % + % Submit the object as a binary + [ids_bin, cids] = bsubmit(obj, sinfo, plForAutoTest); + % Make some changes to the object. + uobj = obj.setName('I was updated (sinfo)'); + update(uobj, ids_bin, sinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids_bin' + robj = ltpda_uo.retrieve(conn, ids_bin); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_04 + + %% UTP_05 + + % + % + % Tests that the update method replaces the object in the repository with + % a completely other object. + % + % + function result = utp_05 + + % + % + % Tests that the update method replaces the object in the repository + % with a completely other object. + % Replace the timespan object with a filter object. + % + % + + try + % + % Make some changes to the object. + uobj = miir(plist('type', 'lowpass')); + update(uobj, ids, sinfo, plForAutoTest); + % Retrieve the object from the repository position 'ids' + robj = ltpda_uo.retrieve(conn, ids); + % + stest = true; + catch err + disp(err.message) + stest = false; + end + + % + % + % 1) Check that the updated object 'uobj' and the retrieved object + % 'robj' are the same. + % + % + + atest = true; + if stest + % + if ~eq(uobj, robj), atest = false; end + % + else + atest = false; + end + + % Return a result structure + result = utp_prepare_result(atest, stest, dbstack, mfilename); + end % END UTP_05 + +end diff -r f90d4f666cc7 -r a59cdb8aaf31 testing/utp_1.1/write_utp_document.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testing/utp_1.1/write_utp_document.m Tue Dec 06 19:07:22 2011 +0100 @@ -0,0 +1,127 @@ +function write_utp_document(outfile, results) + + txt = ''; + + fd = fopen(outfile, 'w+'); + + fprintf(fd, '\\section{Results}\n'); + + + + while ~isempty(results) + + % get the first method + cls = results(1).class; + mthd = results(1).method; + + % find all results for this method + n = 1; + indices = []; + clear mresults; + for ll=1:numel(results) + if strcmp(cls, results(ll).class) && strcmp(mthd, results(ll).method) + mresults(n) = results(ll); + indices = [indices ll]; + n = n + 1; + end + end + if n==1 + mresults = []; + end + + results(indices) = []; + + writeTestTable(fd, mresults); + + fprintf('remaining %d\n', length(results)); + + end + + + % write output + + + fclose(fd); + +end + + +function txt = writeTestTable(fd, results) + txt = ''; + + cls = results(1).class; + mth = results(1).method; + + writeHeader(fd, cls, mth); + + for kk=1:numel(results) + + res = results(kk); + + rcol = ''; + if ~res.a || ~res.s + rcol = '\rowcolor{red}'; + end + + if res.s + syntax = 'pass'; + else + syntax = 'fail'; + end + + if res.a + algo = 'pass'; + else + algo = 'fail'; + end + + + fprintf(fd, '%s \\multirow{2}{3cm}{%s %s} & \\multirow{2}{5cm}{%s} & %s & %s \\\\ \\cline{3-4}\n', rcol, res.num, res.subnum, fix(res.doc.desc), fix(res.doc.syntax), syntax); + fprintf(fd, '%s & & %s & %s \\\\ \\hline\n', rcol, fix(res.doc.algo), algo); + + end + + writeFooter(fd, cls, mth); + + +end + +function s = fix(str) + + s = strrep(str, '_', '\_'); + s = strrep(s, '^', '\^'); + + parts = regexp(s, '\n', 'split'); + parts(cellfun('isempty', parts)) = []; + + if isempty(parts) + s = ''; + else + s = parts{1}; + for kk=2:numel(parts) + s = [s sprintf('\n') parts{kk}]; + end + end + + +end + +function writeHeader(fd, cls, mth) + + fprintf(fd, '\\begin{longtable}{|p{3cm}|p{5cm}|p{5cm}|c|} \\hline\n'); + fprintf(fd, '{\\bf %s/%s} &&& \\\\ \\hline\n', cls, mth); + fprintf(fd, '\\endhead\n'); + + +end + + +function writeFooter(fd, cls, mth) +% fprintf(fd, '\\end{tabular}\n'); +% fprintf(fd, '\\end{center}\n'); + fprintf(fd, '\\caption{Unit tests for %s/%s.}\n', cls, mth); + fprintf(fd, '\\label{tab:%s_%s}\n', cls, mth); + fprintf(fd, '\\end{longtable}\n'); + fprintf(fd, '\\clearpage\n\n\n'); +end +