view testing/utp_1.1/generic_utps/utp_genericSet_minfo.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_GENERICSET_MINFO a set of UTPs for a general setter method
%
% M Hewitson 06-08-08
%
% $Id: utp_genericSet_minfo.m,v 1.1 2010/02/08 19:26:41 ingo Exp $
%

% <TestDescription>
%
% Tests that the getInfo call works for this a general setter method.
%
% </TestDescription>

function result = utp_genericSet_minfo(method, objs, prop, algoTests)
  
  % <SyntaxDescription>
  %
  % Test that the getInfo call works for no sets, all sets, and each set
  % individually.
  %
  % </SyntaxDescription>
  
  try
    % <SyntaxCode>
    % Call for no sets
    io(1) = eval([class(objs) '.getInfo(''' method ''', ''None'')']);
    % Call for all sets
    io(2) = eval([class(objs) '.getInfo(''' method ''')']);
    % Call for each set
    for kk=1:numel(io(2).sets)
      io(kk+2) = eval([class(objs) '.getInfo(''' method ''', ''' io(2).sets{kk} ''')']);
    end
    % </SyntaxCode>
    stest = true;
  catch err
    disp(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')
      %%% SET 'None'
      if ~isempty(io(1).sets), atest = false; end
      if ~isempty(io(1).plists), atest = false; end
      %%% Check all Sets
      if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end
      if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end
      %%%%%%%%%%   SET 'Default'
      if io(3).plists.nparams < 1, atest = false; end
      % Check key
      if ~io(3).plists.isparam(prop), atest = false; end
      % Check default value
      if ~algoTests(io(3).plists.find(prop)), atest = false; end
    end
    % </AlgoCode>
  else
    atest = false;
  end
  
  % Return a result structure
  result = utp_prepare_result(atest, stest, dbstack, ['utp_' class(objs) '_' method]);
end