view testing/utp_1.1/generic_utps/utp_63.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 constructor properly applies history to the pzmodel constructor.
%
% </TestDescription>
function result = utp_63(cl, ple1)
  
  % <SyntaxDescription>
  %
  % Tests that the constructor properly applies history to the pzmodel constructor.
  %
  % </SyntaxDescription>
  
  try
    % <SyntaxCode>
    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);
    % </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 the class name.
  % 2) Check that the 'rebuild' method produces the same object as 'out'.
  %
  % </AlgoDescription>
  
  atest = true;
  if stest
    % <AlgoCode>
    % 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
    % </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_63