% <TestDescription>
%
% Tests that the construuctor properly works with the plist(pzmodel)
% constructor.
%
% </TestDescription>
function result = utp_66(cl, ple1)
  
  % <SyntaxDescription>
  %
  % Tests that the constructor properly works with the plist(pzmodel)
  % constructor.
  %
  % </SyntaxDescription>
  
  try
    % <SyntaxCode>
    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);
    % </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
  %    'ssm'.
  % 2) Check that the 'rebuild' method produces the same object as 'out'.
  %
  % </AlgoDescription>
  
  atest = true;
  if stest
    % <AlgoCode>
    % 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
    % </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_66