Mercurial > hg > ltpda
view testing/utp_1.1/generic_utps/utp_03.m @ 50:7d2e2e065cf1 database-connection-manager
Update unit tests
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 07 Dec 2011 17:24:37 +0100 |
parents | 409a22968d5e |
children |
line wrap: on
line source
% <TestDescription> % % Tests that the <METHOD> method works with a matrix of objects as input. % % </TestDescription> function result = utp_03(method, mat, algo, pli, ple3) % <SyntaxDescription> % % Test that the <METHOD> method works for a matrix of objects as input. % % </SyntaxDescription> try % <SyntaxCode> if isempty(pli) out = feval(method, mat); else out = feval(method, mat, pli); end % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 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. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % 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 % </AlgoCode> 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