view m-toolbox/classes/tests/@ut_result_printer/printRuntimeString.m @ 33:5e7477b94d94 database-connection-manager

Add known repositories list to LTPDAPreferences
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% PRINTRUNTIMESTRING returns a string listing the run time of the tests.
%
% VERSION: $Id: printRuntimeString.m,v 1.2 2010/10/26 12:18:33 hewitson Exp $
%
function res = printRuntimeString(varargin)
  
  urp = varargin{1};
  if nargin>1
    limit = varargin{2};
  else
    limit = inf;
  end
  
  % build array of runtimes
  runtimes = zeros(1,numel(urp.results));
  for kk=1:numel(urp.results)
    r = urp.results(kk);
    runtimes(kk) = r.runtime;
  end
  
  % sort array
  [y,idx] = sort(runtimes,'descend');
  results = urp.results(idx);
  
  res = sprintf('-------- Runtime ----------\n\n');
  for kk=1:numel(results)
    r = results(kk);
    res = [res sprintf('%0.3f s - %s/%s\n', r.runtime, r.testClass, r.testMethod)];
    if kk>limit
      break
    end
  end  
  res = [res sprintf('\n\n----------------------------\n')];
end