% <TestDescription>
%
% Tests that the internal call of general setter method works with any
% shape of objects as input.
%
% </TestDescription>
function result = utp_genericAnyShapeInternal(method, objs, values, algo)
  
  % <SyntaxDescription>
  %
  % Test that the internal call of a general setter method works with any
  % shape of objects as input.
  %
  % </SyntaxDescription>
  
  try
    % <SyntaxCode>
    out = testCallerIsMethod(str2func(method), objs, values);
    % </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 'objs'
  % 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(objs)), atest = false; end
    % Check each output against the correct value
    for kk=1:numel(out)
      atest = algo(objs, out, kk, values);
      if ~atest
        break;
      end
    end
    
    % </AlgoCode>
  else
    atest = false;
  end
  
  % Return a result structure
  stack = dbstack;
  if numel(objs) > 1    
    stack(1).name = sprintf('%s %dx%d', stack(1).name, size(objs));
  end
  result = utp_prepare_result(atest, stest, stack, ['utp_' class(objs) '_' method]);
end
