Mercurial > hg > ltpda
view testing/utp_1.1/utps/ao/utp_ao_ao.m @ 52:daf4eab1a51e database-connection-manager tip
Fix. Default password should be [] not an empty string
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 07 Dec 2011 17:29:47 +0100 |
parents | 409a22968d5e |
children |
line wrap: on
line source
% 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 $ % % <MethodDescription> % % The ao method of the ao class constructs AOs. % % </MethodDescription> 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 % <TestDescription> % % Tests that the getInfo call works for this method. % % </TestDescription> function result = utp_01 % <SyntaxDescription> % % Test that the getInfo call works for no sets, all sets, and each set % individually. % % </SyntaxDescription> msg = ''; try % <SyntaxCode> % Call for no sets io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); % Call for all sets io(2) = eval([class '.getInfo(''' mthd ''')']); % Call for each set for kk=1:numel(io(2).sets) io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); end % </SyntaxCode> stest = true; catch err disp(err.message) msg = err.message; stest = false; end % <AlgoDescription> % % 1) Check that getInfo call returned an minfo object in all cases. % 2) Check that all plists have the correct parameters. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % 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 % </AlgoCode> 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 % <TestDescription> % % Tests that the ao method properly applies history to the % ASCII-file constructor. % % </TestDescription> function result = utp_08 % <SyntaxDescription> % % Test that the output can be processed back to an m-file. % % </SyntaxDescription> try % <SyntaxCode> 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); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 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' % % </AlgoDescription> atest = true; if stest % <AlgoCode> % 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 % </AlgoCode> % 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 % <TestDescription> % % Tests that the ao method properly applies history to the complex % ASCII-file constructor. % % </TestDescription> function result = utp_09 % <SyntaxDescription> % % Test that the output can be processed back to an m-file. % % </SyntaxDescription> try % <SyntaxCode> 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); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 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' % % </AlgoDescription> atest = true; TOL = 1e-14; if stest % <AlgoCode> % 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 % </AlgoCode> % 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 % <TestDescription> % % Tests that the ao method properly applies history to the vals constructor. % % </TestDescription> function result = utp_13 % <SyntaxDescription> % % Test that the output can be processed back to an m-file. % % </SyntaxDescription> try % <SyntaxCode> vals = [1 2 3 4 5; 1 2 3 4 5]; out = ao(vals); mout = rebuild(out); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 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'. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % 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 % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_13 %% UTP_15 % <TestDescription> % % Tests that the ao method properly applies history to the plist(fcn) constructor. % % </TestDescription> function result = utp_15 % <SyntaxDescription> % % Test that the output can be processed back to an m-file. % % </SyntaxDescription> try % <SyntaxCode> fcn = 'complex(randn(100,1), randn(100,1))'; out = ao(plist('fcn', fcn)); mout = rebuild(out); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 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'. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % 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 % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_15 %% UTP_16 % <TestDescription> % % Tests that the ao method properly applies history to the plist(vals) constructor. % % </TestDescription> function result = utp_16 % <SyntaxDescription> % % Test that the output can be processed back to an m-file. % % </SyntaxDescription> try % <SyntaxCode> vals = [1 2 3 4 5; 6 7 8 9 0]; out = ao(plist('vals', vals)); mout = rebuild(out); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 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'. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % 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 % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_16 %% UTP_17 % <TestDescription> % % Tests that the ao method properly applies history to the plist(x/y-vals) constructor. % % </TestDescription> function result = utp_17 % <SyntaxDescription> % % Test that the output can be processed back to an m-file. % % </SyntaxDescription> try % <SyntaxCode> xvals = 0:99; yvals = randn(100,1); out = ao(plist('xvals', xvals, 'yvals', yvals)); mout = rebuild(out); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 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'. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % 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 % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_17 %% UTP_18 % <TestDescription> % % Tests that the ao method properly applies history to the plist(tsfcn) constructor. % % </TestDescription> function result = utp_18 % <SyntaxDescription> % % Test that the output can be processed back to an m-file. % % </SyntaxDescription> try % <SyntaxCode> tsfcn = 'sin(2*pi*7.433*t) + randn(size(t))'; out = ao(plist('tsfcn', tsfcn, 'nsecs', 10, 'fs', 12.3)); mout = rebuild(out); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 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'. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % 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 % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_18 %% UTP_19 % <TestDescription> % % Tests that the ao method properly applies history to the plist(fsfcn) constructor. % % </TestDescription> function result = utp_19 % <SyntaxDescription> % % Test that the output can be processed back to an m-file. % % </SyntaxDescription> try % <SyntaxCode> 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); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 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' % % </AlgoDescription> atest = true; if stest % <AlgoCode> % 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 % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_19 %% UTP_20 % <TestDescription> % % Tests that the ao method properly applies history to the plist(win) constructor. % % </TestDescription> function result = utp_20 % <SyntaxDescription> % % Test that the output can be processed back to an m-file. % % </SyntaxDescription> msg = ''; try % <SyntaxCode> win = specwin('Hamming', 10); out1 = ao(plist('win', win)); mout1 = rebuild(out1); out2 = ao(plist('win', 'Kaiser', 'length', 53, 'psll', 75)); mout2 = rebuild(out2); % </SyntaxCode> stest = true; catch err disp(err.message) msg = err.message; stest = false; end % <AlgoDescription> % % 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'. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % 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 % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename, msg); end % END UTP_20 %% UTP_21 % <TestDescription> % % Tests that the ao method properly applies history to the plist(waveform) constructor. % % </TestDescription> function result = utp_21 % <SyntaxDescription> % % Test that the output can be processed back to an m-file. % % </SyntaxDescription> try % <SyntaxCode> 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); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 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_...'. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % 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 % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_21 %% UTP_23 % <TestDescription> % % Tests that the ao method properly applies history to the plist(polynomial) constructor. % % </TestDescription> function result = utp_23 % <SyntaxDescription> % % Test that the output can be processed back to an m-file. % % </SyntaxDescription> try % <SyntaxCode> 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); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 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'. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % 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 % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_23 %% UTP_25 % <TestDescription> % % Tests that the ao method properly applies history to the plist(specwin) constructor. % Tests that the ao method properly uses the specwin values. % % </TestDescription> function result = utp_25 % <SyntaxDescription> % % Test that the output can be processed back to an m-file. % % </SyntaxDescription> stest = true; atest = true; msg = ''; % Test Kaiser window try % <SyntaxCode> win = specwin('kaiser', randi(1000, 1), 10); out = ao(win); mout = rebuild(out); % </SyntaxCode> catch err disp(err.message) msg = err.message; stest = false; end % <AlgoDescription> % % 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'. % % </AlgoDescription> if stest % <AlgoCode> % 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 % </AlgoCode> else atest = false; end win_list = specwin.getTypes; % Test standard windows for kk = 1:numel(win_list)-2 try % <SyntaxCode> win = specwin(win_list{kk}, randi(1000, 1)); out = ao(win); mout = rebuild(out); % </SyntaxCode> catch err disp(err.message) msg = err.message; stest = false; end % <AlgoDescription> % % 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'. % % </AlgoDescription> if stest % <AlgoCode> % 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 % </AlgoCode> else atest = false; end end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename, msg); end % END UTP_25 %% UTP_26 % <TestDescription> % % Tests that the ao method properly applies history to the data-object constructor. % % </TestDescription> function result = utp_26 % <SyntaxDescription> % % Test that the output can be processed back to an m-file. % % </SyntaxDescription> try % <SyntaxCode> 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); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 1) Check that the last entry in the history of 'out' corresponds to % 'ao'. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % 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 % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_26 %% UTP_28 % <TestDescription> % % Tests that the ao method properly applies history to the x-vector, y-vector constructor. % % </TestDescription> function result = utp_28 % <SyntaxDescription> % % Test that the output can be processed back to an m-file. % % </SyntaxDescription> try % <SyntaxCode> x = 0:99; y = randn(100,1); out = ao(x, y); mout = rebuild(out); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 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'. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % 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 % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_28 %% UTP_29 % <TestDescription> % % Tests that the ao method properly applies history to the filename + % plist constructor. % % </TestDescription> function result = utp_29 % <SyntaxDescription> % % Test that the output can be processed back to an m-file. % % </SyntaxDescription> try % <SyntaxCode> %---- 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); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 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'. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % 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 % </AlgoCode> delete(filename); else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_29 %% UTP_30 % <TestDescription> % % Tests that the ao method properly applies history to the filename + % plist constructor. % % </TestDescription> function result = utp_30 % <SyntaxDescription> % % Test that the output can be processed back to an m-file. % % </SyntaxDescription> try % <SyntaxCode> %---- 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); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 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' % % </AlgoDescription> atest = true; if stest % <AlgoCode> % 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 % </AlgoCode> % 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 % <TestDescription> % % Tests that the ao method properly applies history to the filename + plist constructor. % % </TestDescription> function result = utp_31 % <SyntaxDescription> % % Test that the output can be processed back to an m-file. % % </SyntaxDescription> try % <SyntaxCode> 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); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 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'. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % 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 % </AlgoCode> % 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