view testing/utp_1.1/generic_utps/utp_11.m @ 44:409a22968d5e default

Add unit tests
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 18:42:11 +0100
parents
children
line wrap: on
line source

% <TestDescription>
%
% Check that the <METHOD> method pass back the output objects to a list of
% output variables or to a single variable.
%
% </TestDescription>
function result = utp_11(method, obj1, ple1, varargin)
  
  % <SyntaxDescription>
  %
  % Call the method with a list of output variables and with a single output
  % variable. Additionaly check that the rebuild method works on the output.
  %
  % </SyntaxDescription>
  
  if ~isempty(varargin)
    pli = varargin{1};
  else
    pli = [];
  end
  
  try
    % <SyntaxCode>
    obj1 = obj1.setPlotinfo(plist('color', 'r'));
    if isempty(pli)
      o1 = feval(method, obj1);
    else
      o1 = feval(method, obj1, pli);
    end
    % </SyntaxCode>
    stest = true;
  catch err
    disp(err.message)
    stest = false;
  end
  
  % <AlgoDescription>
  %
  % 1) Check that the output contains the same plotinfo plist
  %
  % </AlgoDescription>
  
  atest = true;
  if stest
    % <AlgoCode>
    if ~eq(obj1(1).plotinfo, o1(1).plotinfo, ple1), atest = false; 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_30