view m-toolbox/m/dev/test_getInfo.m @ 11:9174aadb93a5 database-connection-manager

Add LTPDA Repository utility functions into utils.repository
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% Checks the getInfo call for all class methods
%

classes = utils.helper.ltpda_classes;
fails   = {};
for jj=1:numel(classes)
  cl = classes{jj};
  disp(sprintf('=========== %s ===============', cl))
  % Class info
  try
    % get meta info for this class
    ci = eval(sprintf('?%s', cl));
    % Get methods
    ms = ci.Methods;

    % Check if this is an abstract class
    try 
      o = feval(cl);
      abstract = false;
    catch
      abstract = true;
    end      
    
    if ~abstract
      % Go through methods
      for kk=1:numel(ms)
        m = ms{kk};
        % If this is not an inherited
        if strcmp(m.DefiningClass.Name, cl)
          disp(sprintf('   -- checking %s/%s', cl, m.Name));
          if strcmp(m.Access, 'public') && ~m.Static && ~strcmp(m.Name, 'Contents')
            cmd = sprintf('%s.getInfo(''%s'')', cl, m.Name);
            ii = [];
            try
              ii  = eval(cmd);
            end
            if ~isa(ii, 'minfo')
              fails = [fails sprintf('%s/%s', cl, m.Name)];
            end
          end
        else
          warning('!!! Skipping inherited method %s/%s', cl, m.Name);
        end
      end
    end
  catch
    warning('!!! Couldn''t get meta info for class %s', cl);
  end
end

fd = fopen('getinfo_fails.txt', 'w+');
for j=1:numel(fails)
  fprintf(fd, '%s\n', fails{j});
end
fclose(fd)
edit getinfo_fails.txt